periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 Inria
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
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_pb6_pb7.h"
26 #include "cfg_rtt_default.h"
27 #include "cfg_timer_tim2.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 static const uart_conf_t uart_config[] = {
38  {
39  .dev = USART2,
40  .rcc_mask = RCC_APB1ENR_USART2EN,
41  .rx_pin = GPIO_PIN(PORT_A, 15),
42  .tx_pin = GPIO_PIN(PORT_A, 2),
43  .rx_af = GPIO_AF4,
44  .tx_af = GPIO_AF4,
45  .bus = APB1,
46  .irqn = USART2_IRQn,
47  .type = STM32_USART,
48  .clk_src = 0, /* Use APB clock */
49  }
50 };
51 
52 #define UART_0_ISR (isr_usart2)
53 
54 #define UART_NUMOF ARRAY_SIZE(uart_config)
61 static const spi_conf_t spi_config[] = {
62  {
63  .dev = SPI1,
64  .mosi_pin = GPIO_PIN(PORT_B, 5),
65  .miso_pin = GPIO_PIN(PORT_B, 4),
66  .sclk_pin = GPIO_PIN(PORT_B, 3),
67  .cs_pin = SPI_CS_UNDEF,
68  .mosi_af = GPIO_AF0,
69  .miso_af = GPIO_AF0,
70  .sclk_af = GPIO_AF0,
71  .cs_af = GPIO_AF0,
72  .rccmask = RCC_APB2ENR_SPI1EN,
73  .apbbus = APB2
74  }
75 };
76 
77 #define SPI_NUMOF ARRAY_SIZE(spi_config)
84 static const adc_conf_t adc_config[] = {
85  { GPIO_PIN(PORT_A, 0), 0 }, /* Pin A0 */
86  { GPIO_PIN(PORT_A, 1), 1 }, /* Pin A1 */
87  { GPIO_PIN(PORT_A, 3), 3 }, /* Pin A2 */
88  { GPIO_PIN(PORT_A, 4), 4 }, /* Pin A3 */
89  { GPIO_PIN(PORT_A, 5), 5 }, /* Pin A4 */
90  { GPIO_PIN(PORT_A, 6), 6 }, /* Pin A5 */
91  { GPIO_PIN(PORT_A, 7), 7 }, /* Pin A6 */
92 };
93 
94 #define ADC_NUMOF ARRAY_SIZE(adc_config)
97 #ifdef __cplusplus
98 }
99 #endif
100 
@ PORT_B
port B
Definition: periph_cpu.h:47
@ PORT_A
port A
Definition: periph_cpu.h:46
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:45
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:35
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:93
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:247
Common configuration for STM32 I2C.
Common configuration for STM32 Timer peripheral based on TIM2.
@ GPIO_AF4
use alternate function 4
Definition: cpu_gpio.h:105
@ GPIO_AF0
use alternate function 0
Definition: cpu_gpio.h:101
@ 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:377
SPI device configuration.
Definition: periph_cpu.h:336
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:337
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218