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 
9 #pragma once
10 
21 /* This board provides an LSE */
22 #ifndef CONFIG_BOARD_HAS_LSE
23 #define CONFIG_BOARD_HAS_LSE 1
24 #endif
25 
26 /* This board provides an HSE */
27 #ifndef CONFIG_BOARD_HAS_HSE
28 #define CONFIG_BOARD_HAS_HSE 1
29 #endif
30 
31 #include "periph_cpu.h"
32 #include "clk_conf.h"
33 #include "cfg_i2c1_pb8_pb9.h"
34 #include "cfg_rtt_default.h"
35 #include "cfg_timer_tim2.h"
36 #include "cfg_usb_otg_fs.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
46 static const uart_conf_t uart_config[] = {
47  {
48  .dev = USART3,
49  .rcc_mask = RCC_APB1ENR_USART3EN,
50  .rx_pin = GPIO_PIN(PORT_D, 9),
51  .tx_pin = GPIO_PIN(PORT_D, 8),
52  .rx_af = GPIO_AF7,
53  .tx_af = GPIO_AF7,
54  .bus = APB1,
55  .irqn = USART3_IRQn,
56 #ifdef UART_USE_DMA
57  .dma_stream = 6,
58  .dma_chan = 4
59 #endif
60  },
61  {
62  .dev = USART6,
63  .rcc_mask = RCC_APB2ENR_USART6EN,
64  .rx_pin = GPIO_PIN(PORT_G, 9),
65  .tx_pin = GPIO_PIN(PORT_G, 14),
66  .rx_af = GPIO_AF8,
67  .tx_af = GPIO_AF8,
68  .bus = APB2,
69  .irqn = USART6_IRQn,
70 #ifdef UART_USE_DMA
71  .dma_stream = 5,
72  .dma_chan = 4
73 #endif
74  },
75  {
76  .dev = USART2,
77  .rcc_mask = RCC_APB1ENR_USART2EN,
78  .rx_pin = GPIO_PIN(PORT_D, 6),
79  .tx_pin = GPIO_PIN(PORT_D, 5),
80  .rx_af = GPIO_AF7,
81  .tx_af = GPIO_AF7,
82  .bus = APB1,
83  .irqn = USART2_IRQn,
84 #ifdef UART_USE_DMA
85  .dma_stream = 4,
86  .dma_chan = 4
87 #endif
88  }
89 };
90 
91 #define UART_0_ISR (isr_usart3)
92 #define UART_0_DMA_ISR (isr_dma1_stream6)
93 #define UART_1_ISR (isr_usart6)
94 #define UART_1_DMA_ISR (isr_dma1_stream5)
95 #define UART_2_ISR (isr_usart2)
96 #define UART_2_DMA_ISR (isr_dma1_stream4)
97 
98 #define UART_NUMOF ARRAY_SIZE(uart_config)
101 static const adc_conf_t adc_config[] = {
102  {GPIO_PIN(PORT_A, 3), .dev = 2, .chan = 3}, /* ADC123_IN3 */
103  {GPIO_PIN(PORT_C, 0), .dev = 2, .chan = 10}, /* ADC123_IN10 */
104  {GPIO_PIN(PORT_C, 3), .dev = 2, .chan = 13}, /* ADC123_IN13 */
105  {GPIO_PIN(PORT_F, 3), .dev = 2, .chan = 9}, /* ADC3_IN9 */
106  {GPIO_PIN(PORT_F, 5), .dev = 2, .chan = 15}, /* ADC3_IN15 */
107  {GPIO_PIN(PORT_F, 10), .dev = 2, .chan = 8}, /* ADC3_IN8 */
108  {GPIO_UNDEF, .dev = 0, .chan = 18}, /* VBAT */
109 };
110 
111 #define VBAT_ADC ADC_LINE(6)
113 #define ADC_CLK_MAX MHZ(36)
115 #define ADC_NUMOF ARRAY_SIZE(adc_config)
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
@ PORT_G
port G
Definition: periph_cpu.h:52
@ PORT_C
port C
Definition: periph_cpu.h:48
@ PORT_F
port F
Definition: periph_cpu.h:51
@ 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:38
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:250
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:110
@ GPIO_AF7
use alternate function 7
Definition: cpu_gpio.h:108
@ 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
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218