Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Inria
3 * SPDX-FileCopyrightText: 2017 OTA keys
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
19
20/* Add specific clock configuration (HSE, LSE) for this board here */
21#ifndef CONFIG_BOARD_HAS_LSE
22#define CONFIG_BOARD_HAS_LSE 1
23#endif
24
25#include "periph_cpu.h"
26#include "clk_conf.h"
27#include "cfg_i2c1_pb6_pb7.h"
28#include "cfg_rtt_default.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
39static const uart_conf_t uart_config[] = {
40 {
41 .dev = USART2,
42 .rcc_mask = RCC_APB1ENR1_USART2EN,
43 .rx_pin = GPIO_PIN(PORT_A, 15),
44 .tx_pin = GPIO_PIN(PORT_A, 2),
45 .rx_af = GPIO_AF3,
46 .tx_af = GPIO_AF7,
47 .bus = APB1,
48 .irqn = USART2_IRQn,
49 .type = STM32_USART,
50 .clk_src = 0, /* Use APB clock */
51 },
52 {
53 .dev = USART1,
54 .rcc_mask = RCC_APB2ENR_USART1EN,
55 .rx_pin = GPIO_PIN(PORT_A, 10),
56 .tx_pin = GPIO_PIN(PORT_A, 9),
57 .rx_af = GPIO_AF7,
58 .tx_af = GPIO_AF7,
59 .bus = APB2,
60 .irqn = USART1_IRQn,
61 .type = STM32_USART,
62 .clk_src = 0, /* Use APB clock */
63 },
64};
65
66#define UART_0_ISR (isr_usart2)
67#define UART_1_ISR (isr_usart1)
68
69#define UART_NUMOF ARRAY_SIZE(uart_config)
71
76static const pwm_conf_t pwm_config[] = {
77 {
78 .dev = TIM1,
79 .rcc_mask = RCC_APB2ENR_TIM1EN,
80 .chan = { { .pin = GPIO_PIN(PORT_A, 8) /* D9 */, .cc_chan = 0 },
81 { .pin = GPIO_UNDEF, .cc_chan = 0 },
82 { .pin = GPIO_UNDEF, .cc_chan = 0 },
83 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
84 .af = GPIO_AF1,
85 .bus = APB2
86 }
87};
88
89#define PWM_NUMOF ARRAY_SIZE(pwm_config)
91
96static const spi_conf_t spi_config[] = {
97 {
98 .dev = SPI1,
99 .mosi_pin = GPIO_PIN(PORT_B, 5),
100 .miso_pin = GPIO_PIN(PORT_B, 4),
101 .sclk_pin = GPIO_PIN(PORT_B, 3),
102 .cs_pin = SPI_CS_UNDEF,
103 .mosi_af = GPIO_AF5,
104 .miso_af = GPIO_AF5,
105 .sclk_af = GPIO_AF5,
106 .cs_af = GPIO_AF5,
107 .rccmask = RCC_APB2ENR_SPI1EN,
108 .apbbus = APB2
109 }
110};
111
112#define SPI_NUMOF ARRAY_SIZE(spi_config)
114
138static const adc_conf_t adc_config[] = {
139 {GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 5}, /* ADC12_IN5 */
140 {GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 6}, /* ADC12_IN6 */
141 {GPIO_PIN(PORT_A, 3), .dev = 0, .chan = 8}, /* ADC12_IN8 */
142 {GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 9}, /* ADC12_IN9 */
143 {GPIO_PIN(PORT_A, 7), .dev = 0, .chan = 12}, /* ADC12_IN12 */
144};
145
149#define ADC_NUMOF ARRAY_SIZE(adc_config)
150
152
153#ifdef __cplusplus
154}
155#endif
156
@ PORT_B
port B
Definition periph_cpu.h:44
@ PORT_A
port A
Definition periph_cpu.h:43
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Common configuration for STM32 I2C.
Common configuration for STM32 Timer peripheral based on TIM2, TIM15, and TIM16.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:102
@ GPIO_AF5
use alternate function 5
Definition cpu_gpio.h:106
@ GPIO_AF3
use alternate function 3
Definition cpu_gpio.h:104
@ GPIO_AF7
use alternate function 7
Definition cpu_gpio.h:108
@ STM32_USART
STM32 USART module type.
Definition cpu_uart.h:37
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition periph_cpu.h:362
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:78
@ APB2
Advanced Peripheral Bus 2.
Definition periph_cpu.h:79
ADC device configuration.
Definition periph_cpu.h:374
PWM device configuration.
SPI device configuration.
Definition periph_cpu.h:333
UART device configuration.
Definition periph_cpu.h:214