periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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 /* The HSE provides a 25MHz clock */
33 #define CLOCK_HSE MHZ(25)
34 
35 #include "periph_cpu.h"
37 #include "cfg_rtt_default.h"
38 #include "cfg_usb_otg_fs.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
48 static const timer_conf_t timer_config[] = {
49  {
50  .dev = TIM2,
51  .max = 0xffffffff,
52  .rcc_mask = RCC_APB1ENR_TIM2EN,
53  .bus = APB1,
54  .irqn = TIM2_IRQn
55  }
56 };
57 
58 #define TIMER_0_ISR isr_tim2
59 
60 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
61 
67 static const uart_conf_t uart_config[] = {
68  {
69  .dev = USART6,
70  .rcc_mask = RCC_APB2ENR_USART6EN,
71  .rx_pin = GPIO_PIN(PORT_C, 6),
72  .tx_pin = GPIO_PIN(PORT_C, 7),
73  .rx_af = GPIO_AF8,
74  .tx_af = GPIO_AF8,
75  .bus = APB2,
76  .irqn = USART6_IRQn,
77 #ifdef MODULE_PERIPH_UART_HW_FC
78  .cts_pin = GPIO_UNDEF,
79  .rts_pin = GPIO_UNDEF,
80  .cts_af = GPIO_AF8,
81  .rts_af = GPIO_AF8,
82 #endif
83  },
84  { /* Arduino connector (D0/D1) */
85  .dev = USART2,
86  .rcc_mask = RCC_APB1ENR_USART2EN,
87  .rx_pin = GPIO_PIN(PORT_A, 3),
88  .tx_pin = GPIO_PIN(PORT_A, 2),
89  .rx_af = GPIO_AF7,
90  .tx_af = GPIO_AF7,
91  .bus = APB1,
92  .irqn = USART2_IRQn,
93 #ifdef MODULE_PERIPH_UART_HW_FC
94  .cts_pin = GPIO_UNDEF,
95  .rts_pin = GPIO_UNDEF,
96  .cts_af = GPIO_AF8,
97  .rts_af = GPIO_AF8,
98 #endif
99  },
100  { /* PMOD connector */
101  .dev = UART7,
102  .rcc_mask = RCC_APB1ENR_UART7EN,
103  .rx_pin = GPIO_PIN(PORT_F, 6),
104  .tx_pin = GPIO_PIN(PORT_F, 7),
105  .rx_af = GPIO_AF8,
106  .tx_af = GPIO_AF8,
107  .bus = APB1,
108  .irqn = UART7_IRQn,
109 #ifdef MODULE_PERIPH_UART_HW_FC
110  .cts_pin = GPIO_PIN(PORT_F, 9),
111  .rts_pin = GPIO_PIN(PORT_F, 8),
112  .cts_af = GPIO_AF8,
113  .rts_af = GPIO_AF8,
114 #endif
115  },
116  { /* ESP-01 connector */
117  .dev = UART5,
118  .rcc_mask = RCC_APB1ENR_UART5EN,
119  .rx_pin = GPIO_PIN(PORT_D, 2),
120  .tx_pin = GPIO_PIN(PORT_C, 12),
121  .rx_af = GPIO_AF8,
122  .tx_af = GPIO_AF8,
123  .bus = APB1,
124  .irqn = UART5_IRQn,
125 #ifdef MODULE_PERIPH_UART_HW_FC
126  .cts_pin = GPIO_UNDEF,
127  .rts_pin = GPIO_UNDEF,
128  .cts_af = GPIO_AF8,
129  .rts_af = GPIO_AF8,
130 #endif
131  },
132 };
133 
134 #define UART_0_ISR (isr_usart6)
135 #define UART_1_ISR (isr_usart2)
136 #define UART_2_ISR (isr_uart4)
137 #define UART_3_ISR (isr_uart7)
138 #define UART_4_ISR (isr_uart5)
139 
140 #define UART_NUMOF ARRAY_SIZE(uart_config)
141 
147 static const i2c_conf_t i2c_config[] = {
148  { /* Shared between Arduino D14/D15 and STMOD+ connector */
149  .dev = I2C2,
150  .speed = I2C_SPEED_NORMAL,
151  .scl_pin = GPIO_PIN(PORT_H, 4),
152  .sda_pin = GPIO_PIN(PORT_H, 5),
153  .scl_af = GPIO_AF4,
154  .sda_af = GPIO_AF4,
155  .bus = APB1,
156  .rcc_mask = RCC_APB1ENR_I2C2EN,
157  .irqn = I2C2_ER_IRQn,
158  }
159 };
160 
161 #define I2C_0_ISR isr_i2c2_er
162 
163 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
164 
170 static const spi_conf_t spi_config[] = {
171  { /* Arduino connector */
172  .dev = SPI1,
173  .mosi_pin = GPIO_PIN(PORT_B, 5),
174  .miso_pin = GPIO_PIN(PORT_B, 4),
175  .sclk_pin = GPIO_PIN(PORT_A, 5),
176  .cs_pin = GPIO_UNDEF,
177  .mosi_af = GPIO_AF5,
178  .miso_af = GPIO_AF5,
179  .sclk_af = GPIO_AF5,
180  .cs_af = GPIO_AF5,
181  .rccmask = RCC_APB2ENR_SPI1EN,
182  .apbbus = APB2
183  },
184  { /* PMOD connector */
185  .dev = SPI2,
186  .mosi_pin = GPIO_PIN(PORT_I, 3),
187  .miso_pin = GPIO_PIN(PORT_I, 2),
188  .sclk_pin = GPIO_PIN(PORT_I, 1),
189  .cs_pin = GPIO_PIN(PORT_I, 0),
190  .mosi_af = GPIO_AF5,
191  .miso_af = GPIO_AF5,
192  .sclk_af = GPIO_AF5,
193  .cs_af = GPIO_AF5,
194  .rccmask = RCC_APB1ENR_SPI2EN,
195  .apbbus = APB1
196  },
197 };
198 
199 #define SPI_NUMOF ARRAY_SIZE(spi_config)
200 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif /* PERIPH_CONF_H */
207 
GPIO_AF8
@ GPIO_AF8
use alternate function 8
Definition: periph_cpu_common.h:94
GPIO_AF4
@ GPIO_AF4
use alternate function 4
Definition: periph_cpu_common.h:90
PORT_C
@ PORT_C
port C
Definition: periph_cpu.h:38
I2C_SPEED_NORMAL
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: i2c.h:177
GPIO_AF5
@ GPIO_AF5
use alternate function 5
Definition: periph_cpu_common.h:91
PORT_A
@ PORT_A
port A
Definition: periph_cpu.h:36
PORT_D
@ PORT_D
port D
Definition: periph_cpu.h:39
cfg_usb_otg_fs.h
Common configuration for STM32 OTG FS peripheral.
cfg_clock_default_216.h
Default STM32F7 clock configuration for 216MHz boards.
GPIO_UNDEF
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Definition: periph_cpu_common.h:52
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
PORT_F
@ PORT_F
port F
Definition: periph_cpu.h:41
uart_conf_t::dev
cc2538_uart_t * dev
pointer to the used UART device
Definition: periph_cpu.h:167
timer_conf_t
Timer configuration.
Definition: periph_cpu.h:288
GPIO_AF7
@ GPIO_AF7
use alternate function 7
Definition: periph_cpu_common.h:93
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
APB2
@ APB2
APB2 bus.
Definition: periph_cpu.h:177
PORT_H
@ PORT_H
port H
Definition: periph_cpu.h:41
i2c_conf_t
I2C configuration options.
Definition: periph_cpu.h:128
timer_conf_t::dev
uint32_t dev
Address of timer base.
Definition: periph_cpu.h:112
PORT_B
@ PORT_B
port B
Definition: periph_cpu.h:37
spi_conf_t::dev
SPI_Type * dev
SPI device to use.
Definition: periph_cpu.h:465
spi_conf_t
SPI configuration structure type.
Definition: periph_cpu.h:273
i2c_conf_t::dev
I2C_TypeDef * dev
USART device used.
Definition: periph_cpu.h:247
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176