periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2018 Inria
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 /* Add specific clock configuration (HSE, LSE) for this board here */
19 #ifndef CONFIG_BOARD_HAS_LSE
20 #define CONFIG_BOARD_HAS_LSE 1
21 #endif
22 
23 #include "periph_cpu.h"
24 #include "clk_conf.h"
25 #include "cfg_rtt_default.h"
26 #include "cfg_usb_otg_fs.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
36 static const timer_conf_t timer_config[] = {
37  {
38  .dev = TIM5,
39  .max = 0xffffffff,
40  .rcc_mask = RCC_APB1ENR1_TIM5EN,
41  .bus = APB1,
42  .irqn = TIM5_IRQn
43  }
44 };
45 
46 #define TIMER_0_ISR isr_tim5
47 
48 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
55 static const uart_conf_t uart_config[] = {
56  {
57  .dev = USART2,
58  .rcc_mask = RCC_APB1ENR1_USART2EN,
59  .rx_pin = GPIO_PIN(PORT_D, 6),
60  .tx_pin = GPIO_PIN(PORT_D, 5),
61  .rx_af = GPIO_AF7,
62  .tx_af = GPIO_AF7,
63  .bus = APB1,
64  .irqn = USART2_IRQn,
65  .type = STM32_USART,
66  .clk_src = 0, /* Use APB clock */
67 #ifdef UART_USE_DMA
68  .dma_stream = 6,
69  .dma_chan = 4
70 #endif
71  }
72 };
73 
74 #define UART_0_ISR (isr_usart2)
75 
76 #define UART_NUMOF ARRAY_SIZE(uart_config)
108 static const adc_conf_t adc_config[] = {
109  {GPIO_PIN(PORT_A, 0), 0, 5}, /*< ADC12_IN5 */
110  {GPIO_PIN(PORT_A, 5), 0, 10}, /*< ADC12_IN10 */
111  {GPIO_PIN(PORT_A, 1), 0, 6}, /*< ADC12_IN6 */
112  {GPIO_PIN(PORT_A, 2), 0, 7}, /*< ADC12_IN7 */
113  {GPIO_PIN(PORT_A, 3), 0, 8}, /*< ADC12_IN8 */
114  {GPIO_UNDEF, 0, 18}, /* VBAT */
115 };
116 
120 #define VBAT_ADC ADC_LINE(5)
121 
125 #define ADC_NUMOF ARRAY_SIZE(adc_config)
146 static const pwm_conf_t pwm_config[] = {
147  {
148  .dev = TIM2,
149  .rcc_mask = RCC_APB1ENR1_TIM2EN,
150  .chan = { { .pin = GPIO_PIN(PORT_A, 5), .cc_chan = 0},
151  { .pin = GPIO_PIN(PORT_A, 1), .cc_chan = 1},
152  { .pin = GPIO_PIN(PORT_A, 2), .cc_chan = 2},
153  { .pin = GPIO_PIN(PORT_A, 3), .cc_chan = 3} },
154  .af = GPIO_AF1,
155  .bus = APB1
156  },
157  {
158  .dev = TIM1,
159  .rcc_mask = RCC_APB2ENR_TIM1EN,
160  .chan = { { .pin = GPIO_PIN(PORT_E, 11), .cc_chan = 1},
161  { .pin = GPIO_PIN(PORT_E, 13), .cc_chan = 2},
162  { .pin = GPIO_PIN(PORT_E, 14), .cc_chan = 3},
163  { .pin = GPIO_UNDEF, .cc_chan = 0} },
164  .af = GPIO_AF1,
165  .bus = APB2
166  }
167 };
168 
169 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
172 #ifdef __cplusplus
173 }
174 #endif
175 
@ PORT_E
port E
Definition: periph_cpu.h:50
@ PORT_A
port A
Definition: periph_cpu.h:46
@ PORT_D
port D
Definition: periph_cpu.h:49
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:45
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:35
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:36
static const pwm_conf_t pwm_config[]
Actual PWM configuration.
Definition: periph_conf.h:218
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:108
Common configuration for STM32 OTG FS peripheral.
@ GPIO_AF1
use alternate function 1
Definition: cpu_gpio.h:102
@ GPIO_AF7
use alternate function 7
Definition: cpu_gpio.h:108
@ STM32_USART
STM32 USART module type.
Definition: cpu_uart.h:37
@ 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:377
PWM device configuration.
mini_timer_t * dev
Timer used.
Timer device configuration.
Definition: periph_cpu.h:263
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:264
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218