periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 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_timer_tim5.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
45 static const dma_conf_t dma_config[] = {
46  { .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
47  { .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
48 };
49 
50 #define DMA_0_ISR isr_dma2_stream3
51 #define DMA_1_ISR isr_dma2_stream2
52 
53 #define DMA_NUMOF ARRAY_SIZE(dma_config)
54 
60 static const uart_conf_t uart_config[] = {
61  {
62  .dev = USART2,
63  .rcc_mask = RCC_APB1ENR_USART2EN,
64  .rx_pin = GPIO_PIN(PORT_A, 3),
65  .tx_pin = GPIO_PIN(PORT_A, 2),
66  .rx_af = GPIO_AF7,
67  .tx_af = GPIO_AF7,
68  .bus = APB1,
69  .irqn = USART2_IRQn,
70 #ifdef MODULE_PERIPH_DMA
71  .dma = DMA_STREAM_UNDEF,
72  .dma_chan = UINT8_MAX,
73 #endif
74  },
75  {
76  .dev = USART1,
77  .rcc_mask = RCC_APB2ENR_USART1EN,
78  .rx_pin = GPIO_PIN(PORT_A, 10),
79  .tx_pin = GPIO_PIN(PORT_A, 9),
80  .rx_af = GPIO_AF7,
81  .tx_af = GPIO_AF7,
82  .bus = APB2,
83  .irqn = USART1_IRQn,
84 #ifdef MODULE_PERIPH_DMA
85  .dma = DMA_STREAM_UNDEF,
86  .dma_chan = UINT8_MAX,
87 #endif
88  },
89  {
90  .dev = USART6,
91  .rcc_mask = RCC_APB2ENR_USART6EN,
92  .rx_pin = GPIO_PIN(PORT_A, 12),
93  .tx_pin = GPIO_PIN(PORT_A, 11),
94  .rx_af = GPIO_AF8,
95  .tx_af = GPIO_AF8,
96  .bus = APB2,
97  .irqn = USART6_IRQn,
98 #ifdef MODULE_PERIPH_DMA
99  .dma = DMA_STREAM_UNDEF,
100  .dma_chan = UINT8_MAX,
101 #endif
102  }
103 };
104 
105 /* assign ISR vector names */
106 #define UART_0_ISR (isr_usart2)
107 #define UART_1_ISR (isr_usart1)
108 #define UART_2_ISR (isr_usart6)
109 
110 /* deduct number of defined UART interfaces */
111 #define UART_NUMOF ARRAY_SIZE(uart_config)
112 
118 static const spi_conf_t spi_config[] = {
119  {
120  .dev = SPI1,
121  .mosi_pin = GPIO_PIN(PORT_A, 7),
122  .miso_pin = GPIO_PIN(PORT_A, 6),
123  .sclk_pin = GPIO_PIN(PORT_A, 5),
124  .cs_pin = GPIO_PIN(PORT_A, 4),
125  .mosi_af = GPIO_AF5,
126  .miso_af = GPIO_AF5,
127  .sclk_af = GPIO_AF5,
128  .cs_af = GPIO_AF5,
129  .rccmask = RCC_APB2ENR_SPI1EN,
130  .apbbus = APB2,
131 #ifdef MODULE_PERIPH_DMA
132  .tx_dma = 0,
133  .tx_dma_chan = 3,
134  .rx_dma = 1,
135  .rx_dma_chan = 3,
136 #endif
137  }
138 };
139 
140 #define SPI_NUMOF ARRAY_SIZE(spi_config)
141 
153 static const adc_conf_t adc_config[] = {
154  {GPIO_PIN(PORT_A, 0), 0, 0},
155  {GPIO_PIN(PORT_A, 1), 0, 1},
156  {GPIO_PIN(PORT_A, 4), 0, 4},
157  {GPIO_PIN(PORT_B, 0), 0, 8},
158  {GPIO_PIN(PORT_C, 1), 0, 11},
159  {GPIO_PIN(PORT_C, 0), 0, 10},
160 };
161 
162 #define ADC_NUMOF ARRAY_SIZE(adc_config)
163 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* PERIPH_CONF_H */
170 
GPIO_AF8
@ GPIO_AF8
use alternate function 8
Definition: periph_cpu_common.h:94
PORT_C
@ PORT_C
port C
Definition: periph_cpu.h:38
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.
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
uart_conf_t::dev
cc2538_uart_t * dev
pointer to the used UART device
Definition: periph_cpu.h:167
GPIO_AF7
@ GPIO_AF7
use alternate function 7
Definition: periph_cpu_common.h:93
adc_conf_t
ADC device configuration.
Definition: periph_cpu.h:74
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
cfg_i2c1_pb8_pb9.h
Common configuration for STM32 I2C.
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
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176