periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2017 INRIA
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 /* This board provides an HSE */
19 #ifndef CONFIG_BOARD_HAS_HSE
20 #define CONFIG_BOARD_HAS_HSE 1
21 #endif
22 
23 #include "periph_cpu.h"
24 #include "clk_conf.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 static const timer_conf_t timer_config[] = {
35  {
36  .dev = TIM2,
37  .max = 0x0000ffff,
38  .rcc_mask = RCC_APB1ENR_TIM2EN,
39  .bus = APB1,
40  .irqn = TIM2_IRQn
41  },
42  {
43  .dev = TIM3,
44  .max = 0x0000ffff,
45  .rcc_mask = RCC_APB1ENR_TIM3EN,
46  .bus = APB1,
47  .irqn = TIM3_IRQn
48  }
49 };
50 
51 #define TIMER_0_ISR isr_tim2
52 #define TIMER_1_ISR isr_tim3
53 
54 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
61 static const uart_conf_t uart_config[] = {
62  {
63  .dev = USART2,
64  .rcc_mask = RCC_APB1ENR_USART2EN,
65  .rx_pin = GPIO_PIN(PORT_A, 3),
66  .tx_pin = GPIO_PIN(PORT_A, 2),
67  .bus = APB1,
68  .irqn = USART2_IRQn
69  },
70  {
71  .dev = USART1,
72  .rcc_mask = RCC_APB2ENR_USART1EN,
73  .rx_pin = GPIO_PIN(PORT_B, 7),
74  .tx_pin = GPIO_PIN(PORT_B, 6),
75  .bus = APB2,
76  .irqn = USART1_IRQn
77  },
78  {
79  .dev = USART3,
80  .rcc_mask = RCC_APB1ENR_USART3EN,
81  .rx_pin = GPIO_PIN(PORT_B, 11),
82  .tx_pin = GPIO_PIN(PORT_B, 10),
83  .bus = APB1,
84  .irqn = USART3_IRQn
85  }
86 };
87 
88 #define UART_0_ISR isr_usart2
89 #define UART_1_ISR isr_usart1
90 #define UART_2_ISR isr_usart3
91 
92 #define UART_NUMOF ARRAY_SIZE(uart_config)
95 #ifdef __cplusplus
96 }
97 #endif
98 
@ PORT_B
port B
Definition: periph_cpu.h:44
@ PORT_A
port A
Definition: periph_cpu.h:43
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:42
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:35
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:36
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:78
@ APB2
Advanced Peripheral Bus 2
Definition: periph_cpu.h:79
Timer device configuration.
Definition: periph_cpu.h:260
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:261
UART device configuration.
Definition: periph_cpu.h:214
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:215