periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Savoir-faire Linux
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
9 #pragma once
10 
21 /* This board provides an LSE */
22 #ifndef CONFIG_BOARD_HAS_LSE
23 #define CONFIG_BOARD_HAS_LSE 1
24 #endif
25 
26 /* This board provides an HSE */
27 #ifndef CONFIG_BOARD_HAS_HSE
28 #define CONFIG_BOARD_HAS_HSE 1
29 #endif
30 
31 #include "periph_cpu.h"
32 #include "clk_conf.h"
33 #include "cfg_timer_tim2.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
43 static const uart_conf_t uart_config[] = {
44  {
45  .dev = USART3,
46  .rcc_mask = RCC_MC_APB1ENSETR_USART3EN,
47  .rx_pin = GPIO_PIN(PORT_B, 12),
48  .tx_pin = GPIO_PIN(PORT_B, 10),
49  .rx_af = GPIO_AF8,
50  .tx_af = GPIO_AF7,
51  .bus = APB1,
52  .irqn = USART3_IRQn,
53  .type = STM32_USART,
54 #ifdef UART_USE_DMA
55  .dma_stream = 4,
56  .dma_chan = 4,
57 #endif
58 #if IS_USED(MODULE_STM32MP1_ENG_MODE)
59  .clk_src = RCC_UART35CKSELR_UART35SRC_4, /* HSE clock source */
60 #else
61  .clk_src = RCC_UART35CKSELR_UART35SRC_2, /* HSI clock source */
62 #endif
63  },
64 };
65 
66 #define UART_0_ISR (isr_usart3)
67 #define UART_0_DMA_ISR (isr_dma1_stream4)
68 
69 #define UART_NUMOF ARRAY_SIZE(uart_config)
72 #ifdef __cplusplus
73 }
74 #endif
75 
@ 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:38
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