Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Inria
3 * Copyright (C) 2017 OTA keys S.A.
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
21#ifndef PERIPH_CONF_H
22#define PERIPH_CONF_H
23
24/* This board provides an LSE */
25#ifndef CONFIG_BOARD_HAS_LSE
26#define CONFIG_BOARD_HAS_LSE 1
27#endif
28
29/* This board provides an HSE */
30#ifndef CONFIG_BOARD_HAS_HSE
31#define CONFIG_BOARD_HAS_HSE 1
32#endif
33
34#include "periph_cpu.h"
35#include "clk_conf.h"
36#include "cfg_i2c1_pb8_pb9.h"
37#include "cfg_rtt_default.h"
38#include "cfg_timer_tim5.h"
39#include "cfg_usb_otg_fs.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
49static const dma_conf_t dma_config[] = {
50 { .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
51 { .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
52 { .stream = 3 }, /* DMA1 Stream 3 - UART3_TX */
53 { .stream = 15 }, /* DMA2 Stream 7 - UART6_TX */
54 { .stream = 6 }, /* DMA1 Stream 6 - UART2_TX */
55};
56
57#define DMA_0_ISR isr_dma2_stream3
58#define DMA_1_ISR isr_dma2_stream2
59#define DMA_2_ISR isr_dma1_stream3
60#define DMA_3_ISR isr_dma2_stream7
61#define DMA_4_ISR isr_dma1_stream6
62
63#define DMA_NUMOF ARRAY_SIZE(dma_config)
70static const uart_conf_t uart_config[] = {
71 {
72 .dev = USART3,
73 .rcc_mask = RCC_APB1ENR_USART3EN,
74 .rx_pin = GPIO_PIN(PORT_D, 9),
75 .tx_pin = GPIO_PIN(PORT_D, 8),
76 .rx_af = GPIO_AF7,
77 .tx_af = GPIO_AF7,
78 .bus = APB1,
79 .irqn = USART3_IRQn,
80#ifdef MODULE_PERIPH_DMA
81 .dma = 2,
82 .dma_chan = 4,
83#endif
84 },
85 {
86 .dev = USART6,
87 .rcc_mask = RCC_APB2ENR_USART6EN,
88 .rx_pin = GPIO_PIN(PORT_G, 9),
89 .tx_pin = GPIO_PIN(PORT_G, 14),
90 .rx_af = GPIO_AF8,
91 .tx_af = GPIO_AF8,
92 .bus = APB2,
93 .irqn = USART6_IRQn,
94#ifdef MODULE_PERIPH_DMA
95 .dma = 3,
96 .dma_chan = 5,
97#endif
98 },
99 {
100 .dev = USART2,
101 .rcc_mask = RCC_APB1ENR_USART2EN,
102 .rx_pin = GPIO_PIN(PORT_D, 6),
103 .tx_pin = GPIO_PIN(PORT_D, 5),
104 .rx_af = GPIO_AF7,
105 .tx_af = GPIO_AF7,
106 .bus = APB1,
107 .irqn = USART2_IRQn,
108#ifdef MODULE_PERIPH_DMA
109 .dma = 4,
110 .dma_chan = 4,
111#endif
112 },
113};
114
115#define UART_0_ISR (isr_usart3)
116#define UART_1_ISR (isr_usart6)
117#define UART_2_ISR (isr_usart2)
118
119#define UART_NUMOF ARRAY_SIZE(uart_config)
126static const pwm_conf_t pwm_config[] = {
127 {
128 .dev = TIM1,
129 .rcc_mask = RCC_APB2ENR_TIM1EN,
130 .chan = { { .pin = GPIO_PIN(PORT_E, 9) /* D6 */, .cc_chan = 0},
131 { .pin = GPIO_PIN(PORT_E, 11) /* D5 */, .cc_chan = 1},
132 { .pin = GPIO_PIN(PORT_E, 13) /* D3 */, .cc_chan = 2},
133 { .pin = GPIO_UNDEF, .cc_chan = 0} },
134 .af = GPIO_AF1,
135 .bus = APB2
136 },
137 {
138 .dev = TIM4,
139 .rcc_mask = RCC_APB1ENR_TIM4EN,
140 .chan = { { .pin = GPIO_PIN(PORT_D, 15) /* D9 */, .cc_chan = 3},
141 { .pin = GPIO_UNDEF, .cc_chan = 0},
142 { .pin = GPIO_UNDEF, .cc_chan = 0},
143 { .pin = GPIO_UNDEF, .cc_chan = 0} },
144 .af = GPIO_AF2,
145 .bus = APB1
146 },
147};
148
149#define PWM_NUMOF ARRAY_SIZE(pwm_config)
156static const spi_conf_t spi_config[] = {
157 {
158 .dev = SPI1,
159 .mosi_pin = GPIO_PIN(PORT_A, 7),
160 .miso_pin = GPIO_PIN(PORT_A, 6),
161 .sclk_pin = GPIO_PIN(PORT_A, 5),
162 .cs_pin = GPIO_PIN(PORT_A, 4),
163 .mosi_af = GPIO_AF5,
164 .miso_af = GPIO_AF5,
165 .sclk_af = GPIO_AF5,
166 .cs_af = GPIO_AF5,
167 .rccmask = RCC_APB2ENR_SPI1EN,
168 .apbbus = APB2,
169#ifdef MODULE_PERIPH_DMA
170 .tx_dma = 0,
171 .tx_dma_chan = 3,
172 .rx_dma = 1,
173 .rx_dma_chan = 3,
174#endif
175 }
176};
177
178#define SPI_NUMOF ARRAY_SIZE(spi_config)
191static const adc_conf_t adc_config[] = {
192 {GPIO_PIN(PORT_A, 3), 0, 3},
193 {GPIO_PIN(PORT_C, 0), 0, 10},
194 {GPIO_PIN(PORT_C, 3), 0, 13},
195 {GPIO_PIN(PORT_C, 1), 0, 11},
196 {GPIO_PIN(PORT_C, 4), 0, 14},
197 {GPIO_PIN(PORT_C, 5), 0, 15},
198 {GPIO_UNDEF, 0, 18}, /* VBAT */
199};
200
201#define VBAT_ADC ADC_LINE(6)
202#define ADC_NUMOF ARRAY_SIZE(adc_config)
209#ifndef RTT_FREQUENCY
210#define RTT_FREQUENCY (4096)
211#endif
214#ifdef __cplusplus
215}
216#endif
217
218#endif /* PERIPH_CONF_H */
@ PORT_G
port G
Definition periph_cpu.h:53
@ PORT_C
port C
Definition periph_cpu.h:49
@ PORT_E
port E
Definition periph_cpu.h:51
@ 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.
Common configuration for STM32 I2C.
Common configuration for STM32 Timer peripheral based on TIM5.
Common configuration for STM32 OTG FS peripheral.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:103
@ GPIO_AF2
use alternate function 2
Definition cpu_gpio.h:104
@ GPIO_AF5
use alternate function 5
Definition cpu_gpio.h:107
@ 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
DMA configuration.
Definition cpu_dma.h:32
int stream
DMA stream on stm32f2/4/7, channel on others STM32F2/4/7:
Definition cpu_dma.h:55
PWM device configuration.
mini_timer_t * dev
Timer used.
SPI device configuration.
Definition periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition periph_cpu.h:338
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219