Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18/* Add specific clock configuration (HSE, LSE) for this board here */
19#ifndef CONFIG_BOARD_HAS_LSE
20#define CONFIG_BOARD_HAS_LSE 1
21#endif
22
23#include "periph_cpu.h"
24#include "clk_conf.h"
25#include "cfg_i2c1_pb8_pb9.h"
26#include "cfg_rtt_default.h"
27#include "cfg_usb_otg_fs.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
37static const timer_conf_t timer_config[] = {
38 {
39 .dev = TIM5,
40 .max = 0xffffffff,
41 .rcc_mask = RCC_APB1ENR1_TIM5EN,
42 .bus = APB1,
43 .irqn = TIM5_IRQn
44 }
45};
46
47#define TIMER_0_ISR isr_tim5
48
49#define TIMER_NUMOF ARRAY_SIZE(timer_config)
51
56static const uart_conf_t uart_config[] = {
57 {
58 .dev = LPUART1,
59 .rcc_mask = RCC_APB1ENR2_LPUART1EN,
60 .rx_pin = GPIO_PIN(PORT_G, 8),
61 .tx_pin = GPIO_PIN(PORT_G, 7),
62 .rx_af = GPIO_AF8,
63 .tx_af = GPIO_AF8,
64 .bus = APB12,
65 .irqn = LPUART1_IRQn,
66 .type = STM32_LPUART,
67 .clk_src = 0,
68 },
69 {
70 .dev = USART3,
71 .rcc_mask = RCC_APB1ENR1_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 .type = STM32_USART,
79 .clk_src = 0, /* Use APB clock */
80#ifdef UART_USE_DMA
81 .dma_stream = 6,
82 .dma_chan = 4
83#endif
84 }
85};
86
87#define UART_0_ISR (isr_lpuart1)
88#define UART_1_ISR (isr_usart3)
89
90#define UART_NUMOF ARRAY_SIZE(uart_config)
92
97static const spi_conf_t spi_config[] = {
98 {
99 .dev = SPI1,
100 .mosi_pin = GPIO_PIN(PORT_A, 7),
101 .miso_pin = GPIO_PIN(PORT_A, 6),
102 .sclk_pin = GPIO_PIN(PORT_A, 5),
103 .cs_pin = SPI_CS_UNDEF,
104 .mosi_af = GPIO_AF5,
105 .miso_af = GPIO_AF5,
106 .sclk_af = GPIO_AF5,
107 .cs_af = GPIO_AF5,
108 .rccmask = RCC_APB2ENR_SPI1EN,
109 .apbbus = APB2
110 }
111};
112
113#define SPI_NUMOF ARRAY_SIZE(spi_config)
115
144static const adc_conf_t adc_config[] = {
145 { .pin = GPIO_PIN(PORT_A, 3), .dev = 0, .chan = 8 }, /* ADC12_IN8 */
146 { .pin = GPIO_PIN(PORT_C, 0), .dev = 0, .chan = 1 }, /* ADC123_IN1 */
147 { .pin = GPIO_PIN(PORT_C, 3), .dev = 0, .chan = 4 }, /* ADC123_IN4 */
148 { .pin = GPIO_PIN(PORT_C, 1), .dev = 0, .chan = 2 }, /* ADC123_IN2 */
149 { .pin = GPIO_PIN(PORT_C, 4), .dev = 0, .chan = 13 }, /* ADC12_IN13 */
150 { .pin = GPIO_PIN(PORT_C, 5), .dev = 0, .chan = 14 }, /* ADC12_IN14 */
151 { .pin = GPIO_UNDEF, .dev = 0, .chan = 18 }, /* VBAT */
152};
153
157#define ADC_NUMOF ARRAY_SIZE(adc_config)
158
162#define VBAT_ADC ADC_LINE(6)
163
165
183static const pwm_conf_t pwm_config[] = {
184 {
185 .dev = TIM2,
186 .rcc_mask = RCC_APB1ENR1_TIM2EN,
187 .chan = { { .pin = GPIO_PIN(PORT_A, 0) /* CN10 D32 */, .cc_chan = 0},
188 { .pin = GPIO_PIN(PORT_A, 1) /* CN10 A8 */, .cc_chan = 1},
189 { .pin = GPIO_PIN(PORT_A, 2) /* CN10 D26 */, .cc_chan = 2},
190 { .pin = GPIO_PIN(PORT_A, 3) /* CN9 A0 */, .cc_chan = 3} },
191 .af = GPIO_AF1,
192 .bus = APB1
193 },
194 {
195 .dev = TIM3,
196 .rcc_mask = RCC_APB1ENR1_TIM3EN,
197 .chan = { { .pin = GPIO_PIN(PORT_B, 4) /* CN7 D25 */, .cc_chan = 0},
198 { .pin = GPIO_PIN(PORT_E, 4) /* CN9 D57 */, .cc_chan = 1},
199 { .pin = GPIO_PIN(PORT_B, 0) /* CN10 D33 */, .cc_chan = 2},
200 { .pin = GPIO_PIN(PORT_B, 1) /* CN10 A6 */, .cc_chan = 3} },
201 .af = GPIO_AF2,
202 .bus = APB1
203 },
204};
205
206#define PWM_NUMOF ARRAY_SIZE(pwm_config)
207
209
210#ifdef __cplusplus
211}
212#endif
213
@ PORT_B
port B
Definition periph_cpu.h:44
@ PORT_G
port G
Definition periph_cpu.h:49
@ PORT_C
port C
Definition periph_cpu.h:45
@ PORT_E
port E
Definition periph_cpu.h:47
@ PORT_A
port A
Definition periph_cpu.h:43
@ PORT_D
port D
Definition periph_cpu.h:46
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Common configuration for STM32 I2C.
Common configuration for STM32 OTG FS peripheral.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:102
@ GPIO_AF2
use alternate function 2
Definition cpu_gpio.h:103
@ GPIO_AF5
use alternate function 5
Definition cpu_gpio.h:106
@ GPIO_AF8
use alternate function 8
Definition cpu_gpio.h:110
@ GPIO_AF7
use alternate function 7
Definition cpu_gpio.h:108
@ STM32_LPUART
STM32 Low-power UART (LPUART) module type.
Definition cpu_uart.h:38
@ STM32_USART
STM32 USART module type.
Definition cpu_uart.h:37
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition periph_cpu.h:362
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:78
@ APB2
Advanced Peripheral Bus 2.
Definition periph_cpu.h:79
ADC device configuration.
Definition periph_cpu.h:374
PWM device configuration.
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214