periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_timer_tim5.h"
35 #include "cfg_usb_otg_hs_fs.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
45 static const dma_conf_t dma_config[] = {
46  { .stream = 14 }, /* DMA2 Stream 6 - SPI5_TX */
47  { .stream = 13 }, /* DMA2 Stream 5 - SPI5_RX */
48 };
49 
50 #define DMA_0_ISR isr_dma2_stream6
51 #define DMA_1_ISR isr_dma2_stream5
52 
53 #define DMA_NUMOF ARRAY_SIZE(dma_config)
54 
60 static const uart_conf_t uart_config[] = {
61  {
62  .dev = USART1,
63  .rcc_mask = RCC_APB2ENR_USART1EN,
64  .rx_pin = GPIO_PIN(PORT_A, 10),
65  .tx_pin = GPIO_PIN(PORT_A, 9),
66  .rx_af = GPIO_AF7,
67  .tx_af = GPIO_AF7,
68  .bus = APB2,
69  .irqn = USART1_IRQn,
70 #ifdef MODULE_PERIPH_DMA
71  .dma = DMA_STREAM_UNDEF,
72  .dma_chan = UINT8_MAX,
73 #endif
74  }
75 };
76 
77 #define UART_0_ISR (isr_usart1)
78 
79 #define UART_NUMOF ARRAY_SIZE(uart_config)
80 
86 static const spi_conf_t spi_config[] = {
87  {
88  .dev = SPI5,
89  .mosi_pin = GPIO_PIN(PORT_F, 9),
90  .miso_pin = GPIO_PIN(PORT_F, 8),
91  .sclk_pin = GPIO_PIN(PORT_F, 7),
92  .cs_pin = GPIO_UNDEF,
93  .mosi_af = GPIO_AF5,
94  .miso_af = GPIO_AF5,
95  .sclk_af = GPIO_AF5,
96  .cs_af = GPIO_AF5,
97  .rccmask = RCC_APB2ENR_SPI5EN,
98  .apbbus = APB2,
99 #ifdef MODULE_PERIPH_DMA
100  .tx_dma = 0,
101  .tx_dma_chan = 7,
102  .rx_dma = 1,
103  .rx_dma_chan = 7,
104 #endif
105  }
106 };
107 
108 #define SPI_NUMOF ARRAY_SIZE(spi_config)
109 
115 static const i2c_conf_t i2c_config[] = {
116  {
117  .dev = I2C3,
118  .speed = I2C_SPEED_NORMAL,
119  .scl_pin = GPIO_PIN(PORT_A, 8),
120  .sda_pin = GPIO_PIN(PORT_C, 9),
121  .scl_af = GPIO_AF4,
122  .sda_af = GPIO_AF4,
123  .bus = APB1,
124  .rcc_mask = RCC_APB1ENR_I2C3EN,
125  .clk = CLOCK_APB1,
126  .irqn = I2C3_EV_IRQn,
127  }
128 };
129 
130 #define I2C_0_ISR isr_i2c3_ev
131 
132 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
133 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /* PERIPH_CONF_H */
140 
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
dma_conf_t::stream
int stream
DMA stream on stm32f2/4/7, channel on others STM32F2/4/7:
Definition: periph_cpu.h:443
cfg_timer_tim5.h
Common configuration for STM32 Timer peripheral based on TIM5.
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
cfg_usb_otg_hs_fs.h
Common configuration for STM32 OTG HS peripheral with FS phy.
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
dma_conf_t
DMA configuration.
Definition: periph_cpu.h:420
i2c_conf_t
I2C configuration options.
Definition: periph_cpu.h:128
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