Loading...
Searching...
No Matches
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
38extern "C" {
39#endif
40
45static 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)
60static 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)
117static const pwm_conf_t pwm_config[] = {
118 {
119 .dev = TIM2,
120 .rcc_mask = RCC_APB1ENR_TIM2EN,
121 .chan = { { .pin = GPIO_PIN(PORT_A, 15) , .cc_chan = 0 },
122 { .pin = GPIO_PIN(PORT_B, 3) /* D3 */, .cc_chan = 1 },
123 { .pin = GPIO_PIN(PORT_B, 10) /* D6 */, .cc_chan = 2 },
124 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
125 .af = GPIO_AF1,
126 .bus = APB1
127 },
128 {
129 .dev = TIM3,
130 .rcc_mask = RCC_APB1ENR_TIM3EN,
131 .chan = { { .pin = GPIO_PIN(PORT_B, 4) /* D5 */, .cc_chan = 0 },
132 { .pin = GPIO_PIN(PORT_C, 7) /* D9 */, .cc_chan = 1 },
133 { .pin = GPIO_PIN(PORT_C, 8), .cc_chan = 2 },
134 { .pin = GPIO_PIN(PORT_C, 9), .cc_chan = 3 } },
135 .af = GPIO_AF2,
136 .bus = APB1
137 },
138};
139
140#define PWM_NUMOF ARRAY_SIZE(pwm_config)
147static const spi_conf_t spi_config[] = {
148 {
149 .dev = SPI1,
150 .mosi_pin = GPIO_PIN(PORT_A, 7),
151 .miso_pin = GPIO_PIN(PORT_A, 6),
152 .sclk_pin = GPIO_PIN(PORT_A, 5),
153 .cs_pin = GPIO_PIN(PORT_A, 4),
154 .mosi_af = GPIO_AF5,
155 .miso_af = GPIO_AF5,
156 .sclk_af = GPIO_AF5,
157 .cs_af = GPIO_AF5,
158 .rccmask = RCC_APB2ENR_SPI1EN,
159 .apbbus = APB2,
160#ifdef MODULE_PERIPH_DMA
161 .tx_dma = 0,
162 .tx_dma_chan = 3,
163 .rx_dma = 1,
164 .rx_dma_chan = 3,
165#endif
166 }
167};
168
169#define SPI_NUMOF ARRAY_SIZE(spi_config)
182static const adc_conf_t adc_config[] = {
183 {GPIO_PIN(PORT_A, 0), 0, 0},
184 {GPIO_PIN(PORT_A, 1), 0, 1},
185 {GPIO_PIN(PORT_A, 4), 0, 4},
186 {GPIO_PIN(PORT_B, 0), 0, 8},
187 {GPIO_PIN(PORT_C, 1), 0, 11},
188 {GPIO_PIN(PORT_C, 0), 0, 10},
189 {GPIO_UNDEF, 0, 18}, /* VBAT */
190};
191
192#define VBAT_ADC ADC_LINE(6)
193#define ADC_NUMOF ARRAY_SIZE(adc_config)
196#ifdef __cplusplus
197}
198#endif
199
200#endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition periph_cpu.h:48
@ PORT_C
port C
Definition periph_cpu.h:49
@ PORT_A
port A
Definition periph_cpu.h:47
#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.
@ 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