All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Luo Jia (HUST IoT Security Lab)
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef PERIPH_CONF_H
20 #define PERIPH_CONF_H
21 
22 /* Add specific clock configuration (HSE, LSE) for this board here */
23 #ifndef CONFIG_BOARD_HAS_LSE
24 #define CONFIG_BOARD_HAS_LSE 1
25 #endif
26 
27 #include "periph_cpu.h"
28 #include "clk_conf.h"
29 #include "cfg_rtt_default.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
40 static const timer_conf_t timer_config[] = {
41  {
42  .dev = TIM5,
43  .max = 0xffffffff,
44  .rcc_mask = RCC_APB1ENR1_TIM5EN,
45  .bus = APB1,
46  .irqn = TIM5_IRQn
47  }
48 };
49 
50 #define TIMER_0_ISR isr_tim5
52 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
60 static const uart_conf_t uart_config[] = {
61  {
62  .dev = USART1,
63  .rcc_mask = RCC_APB2ENR_USART1EN,
64  .rx_pin = GPIO_PIN(PORT_A, 10),
65  .tx_pin = GPIO_PIN(PORT_A, 9),
66  .rx_af = GPIO_AF7,
67  .tx_af = GPIO_AF7,
68  .bus = APB2,
69  .irqn = USART1_IRQn,
70  .type = STM32_USART,
71  .clk_src = 0, /* Use APB clock */
72 #ifdef UART_USE_DMA
73  .dma_stream = 6,
74  .dma_chan = 4
75 #endif
76  }
77 };
78 
79 #define UART_0_ISR (isr_usart1)
81 #define UART_NUMOF ARRAY_SIZE(uart_config)
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* PERIPH_CONF_H */
@ PORT_A
port A
Definition: periph_cpu.h:47
#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[]
All UARTs on board.
Definition: periph_conf.h:60
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:40
@ 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
@ APB2
Advanced Peripheral Bus 2
Definition: periph_cpu.h:80
Timer device configuration.
Definition: periph_cpu.h:264
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:265
UART device configuration.
Definition: periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:219