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 
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
37 extern "C" {
38 #endif
39 
44 static const uart_conf_t uart_config[] = {
45  {
46  .dev = USART3,
47  .rcc_mask = RCC_MC_APB1ENSETR_USART3EN,
48  .rx_pin = GPIO_PIN(PORT_B, 12),
49  .tx_pin = GPIO_PIN(PORT_B, 10),
50  .rx_af = GPIO_AF8,
51  .tx_af = GPIO_AF7,
52  .bus = APB1,
53  .irqn = USART3_IRQn,
54  .type = STM32_USART,
55 #ifdef UART_USE_DMA
56  .dma_stream = 4,
57  .dma_chan = 4,
58 #endif
59 #if IS_USED(MODULE_STM32MP1_ENG_MODE)
60  .clk_src = RCC_UART35CKSELR_UART35SRC_4, /* HSE clock source */
61 #else
62  .clk_src = RCC_UART35CKSELR_UART35SRC_2, /* HSI clock source */
63 #endif
64  },
65 };
66 
67 #define UART_0_ISR (isr_usart3)
68 #define UART_0_DMA_ISR (isr_dma1_stream4)
69 
70 #define UART_NUMOF ARRAY_SIZE(uart_config)
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition: periph_cpu.h:48
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:46
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:39
Common configuration for STM32 Timer peripheral based on TIM2.
@ GPIO_AF8
use alternate function 8
Definition: cpu_gpio.h:111
@ GPIO_AF7
use alternate function 7
Definition: cpu_gpio.h:109
@ STM32_USART
STM32 USART module type.
Definition: cpu_uart.h:38
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:79
UART device configuration.
Definition: periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:219