Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 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_tim2.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
50static const adc_conf_t adc_config[] = {
51 { .pin = GPIO_PIN(PORT_A, 3), .dev = 0, .chan = 4 }, /* ADC1_IN4, fast */
52 { .pin = GPIO_PIN(PORT_C, 0), .dev = 1, .chan = 6 }, /* ADC12_IN6, slow */
53 { .pin = GPIO_PIN(PORT_C, 3), .dev = 1, .chan = 9 }, /* ADC12_IN9, slow */
54 { .pin = GPIO_PIN(PORT_D, 11), .dev = 2, .chan = 8 }, /* ADC34_IN8, slow */
55 { .pin = GPIO_PIN(PORT_D, 12), .dev = 3, .chan = 9 }, /* ADC34_IN9, slow */
56 { .pin = GPIO_PIN(PORT_D, 13), .dev = 3, .chan = 10 }, /* ADC34_IN10, slow */
57 { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 }, /* VBAT */
58};
59
60#define VBAT_ADC ADC_LINE(6)
61#define ADC_NUMOF ARRAY_SIZE(adc_config)
68static const uart_conf_t uart_config[] = {
69 {
70 .dev = USART3,
71 .rcc_mask = RCC_APB1ENR_USART3EN,
72 .rx_pin = GPIO_PIN(PORT_D, 9),
73 .tx_pin = GPIO_PIN(PORT_D, 8),
74 .rx_af = GPIO_AF7,
75 .tx_af = GPIO_AF7,
76 .bus = APB1,
77 .irqn = USART3_IRQn,
78#ifdef UART_USE_DMA
79 .dma_stream = 6,
80 .dma_chan = 4
81#endif
82 },
83 {
84 .dev = USART1,
85 .rcc_mask = RCC_APB2ENR_USART1EN,
86 .rx_pin = GPIO_PIN(PORT_C, 5),
87 .tx_pin = GPIO_PIN(PORT_C, 4),
88 .rx_af = GPIO_AF7,
89 .tx_af = GPIO_AF7,
90 .bus = APB2,
91 .irqn = USART1_IRQn,
92#ifdef UART_USE_DMA
93 .dma_stream = 5,
94 .dma_chan = 4
95#endif
96 },
97 {
98 .dev = USART2,
99 .rcc_mask = RCC_APB1ENR_USART2EN,
100 .rx_pin = GPIO_PIN(PORT_D, 6),
101 .tx_pin = GPIO_PIN(PORT_D, 5),
102 .rx_af = GPIO_AF7,
103 .tx_af = GPIO_AF7,
104 .bus = APB1,
105 .irqn = USART2_IRQn,
106#ifdef UART_USE_DMA
107 .dma_stream = 4,
108 .dma_chan = 4
109#endif
110 },
111};
112
113#define UART_0_ISR (isr_usart3)
114#define UART_0_DMA_ISR (isr_dma1_stream6)
115#define UART_1_ISR (isr_usart1)
116#define UART_1_DMA_ISR (isr_dma1_stream5)
117#define UART_2_ISR (isr_usart2)
118#define UART_2_DMA_ISR (isr_dma1_stream4)
119
120#define UART_NUMOF ARRAY_SIZE(uart_config)
127static const pwm_conf_t pwm_config[] = {
128 {
129 .dev = TIM1,
130 .rcc_mask = RCC_APB2ENR_TIM1EN,
131 .chan = { { .pin = GPIO_PIN(PORT_E, 9) /* D6 */, .cc_chan = 0},
132 { .pin = GPIO_PIN(PORT_E, 11) /* D5 */, .cc_chan = 1},
133 { .pin = GPIO_PIN(PORT_E, 13) /* D3 */, .cc_chan = 2},
134 { .pin = GPIO_UNDEF, .cc_chan = 0} },
135 .af = GPIO_AF2,
136 .bus = APB2
137 },
138 {
139 .dev = TIM4,
140 .rcc_mask = RCC_APB1ENR_TIM4EN,
141 .chan = { { .pin = GPIO_PIN(PORT_D, 15) /* D9 */, .cc_chan = 3},
142 { .pin = GPIO_UNDEF, .cc_chan = 0},
143 { .pin = GPIO_UNDEF, .cc_chan = 0},
144 { .pin = GPIO_UNDEF, .cc_chan = 0} },
145 .af = GPIO_AF2,
146 .bus = APB1
147 }
148};
149
150#define PWM_NUMOF ARRAY_SIZE(pwm_config)
157static const spi_conf_t spi_config[] = {
158 {
159 .dev = SPI1,
160 .mosi_pin = GPIO_PIN(PORT_A, 7),
161 .miso_pin = GPIO_PIN(PORT_A, 6),
162 .sclk_pin = GPIO_PIN(PORT_A, 5),
163 .cs_pin = SPI_CS_UNDEF,
164 .mosi_af = GPIO_AF5,
165 .miso_af = GPIO_AF5,
166 .sclk_af = GPIO_AF5,
167 .cs_af = GPIO_AF5,
168 .rccmask = RCC_APB2ENR_SPI1EN,
169 .apbbus = APB2
170 }
171};
172
173#define SPI_NUMOF ARRAY_SIZE(spi_config)
180 {
181 .base_addr = (uintptr_t)USB,
182 .rcc_mask = RCC_APB1ENR_USBEN,
183 .irqn = USB_LP_CAN_RX0_IRQn,
184 .apb = APB1,
185 .dm = GPIO_PIN(PORT_A, 11),
186 .dp = GPIO_PIN(PORT_A, 12),
187 .af = GPIO_AF14,
188 .disconn = GPIO_PIN(PORT_G, 6),
189 },
190};
191
195#define USBDEV_ISR isr_usb_lp_can_rx0
196
200#define USBDEV_NUMOF ARRAY_SIZE(stm32_usbdev_fs_config)
201
202#ifdef __cplusplus
203}
204#endif
205
206#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.
static const stm32_usbdev_fs_config_t stm32_usbdev_fs_config[]
USB device FS configuration.
Common configuration for STM32 Timer peripheral based on TIM2.
@ GPIO_AF2
use alternate function 2
Definition cpu_gpio.h:104
@ GPIO_AF5
use alternate function 5
Definition cpu_gpio.h:107
@ GPIO_AF14
use alternate function 14
Definition cpu_gpio.h:117
@ GPIO_AF7
use alternate function 7
Definition cpu_gpio.h:109
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition periph_cpu.h:363
@ 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
gpio_t pin
pin connected to the channel
Definition periph_cpu.h:288
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
stm32 USB device FS configuration
Definition cpu_usbdev.h:45
uintptr_t base_addr
USB peripheral base address.
Definition cpu_usbdev.h:46
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219