periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 INRIA
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 
9 #pragma once
10 
21 /* This board provides an HSE */
22 #ifndef CONFIG_BOARD_HAS_HSE
23 #define CONFIG_BOARD_HAS_HSE 1
24 #endif
25 
26 #include "periph_cpu.h"
27 #include "clk_conf.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 static const timer_conf_t timer_config[] = {
38  {
39  .dev = TIM2,
40  .max = 0x0000ffff,
41  .rcc_mask = RCC_APB1ENR_TIM2EN,
42  .bus = APB1,
43  .irqn = TIM2_IRQn
44  },
45  {
46  .dev = TIM3,
47  .max = 0x0000ffff,
48  .rcc_mask = RCC_APB1ENR_TIM3EN,
49  .bus = APB1,
50  .irqn = TIM3_IRQn
51  }
52 };
53 
54 #define TIMER_0_ISR isr_tim2
55 #define TIMER_1_ISR isr_tim3
56 
57 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
64 static const uart_conf_t uart_config[] = {
65  {
66  .dev = USART2,
67  .rcc_mask = RCC_APB1ENR_USART2EN,
68  .rx_pin = GPIO_PIN(PORT_A, 3),
69  .tx_pin = GPIO_PIN(PORT_A, 2),
70  .bus = APB1,
71  .irqn = USART2_IRQn
72  },
73  {
74  .dev = USART1,
75  .rcc_mask = RCC_APB2ENR_USART1EN,
76  .rx_pin = GPIO_PIN(PORT_B, 7),
77  .tx_pin = GPIO_PIN(PORT_B, 6),
78  .bus = APB2,
79  .irqn = USART1_IRQn
80  },
81  {
82  .dev = USART3,
83  .rcc_mask = RCC_APB1ENR_USART3EN,
84  .rx_pin = GPIO_PIN(PORT_B, 11),
85  .tx_pin = GPIO_PIN(PORT_B, 10),
86  .bus = APB1,
87  .irqn = USART3_IRQn
88  }
89 };
90 
91 #define UART_0_ISR isr_usart2
92 #define UART_1_ISR isr_usart1
93 #define UART_2_ISR isr_usart3
94 
95 #define UART_NUMOF ARRAY_SIZE(uart_config)
98 #ifdef __cplusplus
99 }
100 #endif
101 
@ PORT_B
port B
Definition: periph_cpu.h:47
@ PORT_A
port A
Definition: periph_cpu.h:46
#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
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:39
@ 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:263
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:264
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218