periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 Savoir-faire Linux
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 /* This board provides an LSE */
19 #ifndef CONFIG_BOARD_HAS_LSE
20 #define CONFIG_BOARD_HAS_LSE 1
21 #endif
22 
23 /* This board provides an HSE */
24 #ifndef CONFIG_BOARD_HAS_HSE
25 #define CONFIG_BOARD_HAS_HSE 1
26 #endif
27 
28 #include "periph_cpu.h"
29 #include "clk_conf.h"
30 #include "cfg_timer_tim2.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
40 static const uart_conf_t uart_config[] = {
41  {
42  .dev = USART3,
43  .rcc_mask = RCC_MC_APB1ENSETR_USART3EN,
44  .rx_pin = GPIO_PIN(PORT_B, 12),
45  .tx_pin = GPIO_PIN(PORT_B, 10),
46  .rx_af = GPIO_AF8,
47  .tx_af = GPIO_AF7,
48  .bus = APB1,
49  .irqn = USART3_IRQn,
50  .type = STM32_USART,
51 #ifdef UART_USE_DMA
52  .dma_stream = 4,
53  .dma_chan = 4,
54 #endif
55 #if IS_USED(MODULE_STM32MP1_ENG_MODE)
56  .clk_src = RCC_UART35CKSELR_UART35SRC_4, /* HSE clock source */
57 #else
58  .clk_src = RCC_UART35CKSELR_UART35SRC_2, /* HSI clock source */
59 #endif
60  },
61 };
62 
63 #define UART_0_ISR (isr_usart3)
64 #define UART_0_DMA_ISR (isr_dma1_stream4)
65 
66 #define UART_NUMOF ARRAY_SIZE(uart_config)
69 #ifdef __cplusplus
70 }
71 #endif
72 
@ PORT_B
port B
Definition: periph_cpu.h:47
#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
Common configuration for STM32 Timer peripheral based on TIM2.
@ GPIO_AF8
use alternate function 8
Definition: cpu_gpio.h:110
@ GPIO_AF7
use alternate function 7
Definition: cpu_gpio.h:108
@ STM32_USART
STM32 USART module type.
Definition: cpu_uart.h:37
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:78
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218