periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef PERIPH_CONF_H
20 #define PERIPH_CONF_H
21 
22 /* This board provides an LSE */
23 #ifndef CONFIG_BOARD_HAS_LSE
24 #define CONFIG_BOARD_HAS_LSE 1
25 #endif
26 
27 /* This board provides an HSE */
28 #ifndef CONFIG_BOARD_HAS_HSE
29 #define CONFIG_BOARD_HAS_HSE 1
30 #endif
31 
32 #include "periph_cpu.h"
33 #include "clk_conf.h"
34 #include "cfg_i2c1_pb8_pb9.h"
35 #include "cfg_rtt_default.h"
36 #include "cfg_timer_tim2.h"
37 #include "cfg_usb_otg_fs.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
47 static const uart_conf_t uart_config[] = {
48  {
49  .dev = USART3,
50  .rcc_mask = RCC_APB1ENR_USART3EN,
51  .rx_pin = GPIO_PIN(PORT_D, 9),
52  .tx_pin = GPIO_PIN(PORT_D, 8),
53  .rx_af = GPIO_AF7,
54  .tx_af = GPIO_AF7,
55  .bus = APB1,
56  .irqn = USART3_IRQn,
57 #ifdef UART_USE_DMA
58  .dma_stream = 6,
59  .dma_chan = 4
60 #endif
61  },
62  {
63  .dev = USART6,
64  .rcc_mask = RCC_APB2ENR_USART6EN,
65  .rx_pin = GPIO_PIN(PORT_G, 9),
66  .tx_pin = GPIO_PIN(PORT_G, 14),
67  .rx_af = GPIO_AF8,
68  .tx_af = GPIO_AF8,
69  .bus = APB2,
70  .irqn = USART6_IRQn,
71 #ifdef UART_USE_DMA
72  .dma_stream = 5,
73  .dma_chan = 4
74 #endif
75  },
76  {
77  .dev = USART2,
78  .rcc_mask = RCC_APB1ENR_USART2EN,
79  .rx_pin = GPIO_PIN(PORT_D, 6),
80  .tx_pin = GPIO_PIN(PORT_D, 5),
81  .rx_af = GPIO_AF7,
82  .tx_af = GPIO_AF7,
83  .bus = APB1,
84  .irqn = USART2_IRQn,
85 #ifdef UART_USE_DMA
86  .dma_stream = 4,
87  .dma_chan = 4
88 #endif
89  }
90 };
91 
92 #define UART_0_ISR (isr_usart3)
93 #define UART_0_DMA_ISR (isr_dma1_stream6)
94 #define UART_1_ISR (isr_usart6)
95 #define UART_1_DMA_ISR (isr_dma1_stream5)
96 #define UART_2_ISR (isr_usart2)
97 #define UART_2_DMA_ISR (isr_dma1_stream4)
98 
99 #define UART_NUMOF ARRAY_SIZE(uart_config)
102 static const adc_conf_t adc_config[] = {
103  {GPIO_PIN(PORT_A, 3), .dev = 2, .chan = 3}, /* ADC123_IN3 */
104  {GPIO_PIN(PORT_C, 0), .dev = 2, .chan = 10}, /* ADC123_IN10 */
105  {GPIO_PIN(PORT_C, 3), .dev = 2, .chan = 13}, /* ADC123_IN13 */
106  {GPIO_PIN(PORT_F, 3), .dev = 2, .chan = 9}, /* ADC3_IN9 */
107  {GPIO_PIN(PORT_F, 5), .dev = 2, .chan = 15}, /* ADC3_IN15 */
108  {GPIO_PIN(PORT_F, 10), .dev = 2, .chan = 8}, /* ADC3_IN8 */
109  {GPIO_UNDEF, .dev = 0, .chan = 18}, /* VBAT */
110 };
111 
112 #define VBAT_ADC ADC_LINE(6)
114 #define ADC_CLK_MAX MHZ(36)
116 #define ADC_NUMOF ARRAY_SIZE(adc_config)
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* PERIPH_CONF_H */
@ PORT_G
port G
Definition: periph_cpu.h:53
@ PORT_C
port C
Definition: periph_cpu.h:49
@ PORT_F
port F
Definition: periph_cpu.h:52
@ PORT_A
port A
Definition: periph_cpu.h:47
@ PORT_D
port D
Definition: periph_cpu.h:50
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:46
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:39
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:251
Common configuration for STM32 I2C.
Common configuration for STM32 Timer peripheral based on TIM2.
Common configuration for STM32 OTG FS peripheral.
@ GPIO_AF8
use alternate function 8
Definition: cpu_gpio.h:111
@ GPIO_AF7
use alternate function 7
Definition: cpu_gpio.h:109
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:79
@ APB2
Advanced Peripheral Bus 2
Definition: periph_cpu.h:80
ADC device configuration.
Definition: periph_cpu.h:379
UART device configuration.
Definition: periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:219