periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2014 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 #include "periph_cpu.h"
19 #include "clk_conf.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
29 static const timer_conf_t timer_config[] = {
30  {
31  .dev = TIM2,
32  .max = 0x0000ffff,
33  .rcc_mask = RCC_APB1ENR_TIM2EN,
34  .bus = APB1,
35  .irqn = TIM2_IRQn
36  },
37  {
38  .dev = TIM3,
39  .max = 0x0000ffff,
40  .rcc_mask = RCC_APB1ENR_TIM3EN,
41  .bus = APB1,
42  .irqn = TIM3_IRQn
43  }
44 };
45 
46 #define TIMER_0_ISR isr_tim2
47 #define TIMER_1_ISR isr_tim3
48 
49 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
56 static const uart_conf_t uart_config[] = {
57  {
58  .dev = USART2,
59  .rcc_mask = RCC_APB1ENR_USART2EN,
60  .rx_pin = GPIO_PIN(PORT_A, 3),
61  .tx_pin = GPIO_PIN(PORT_A, 2),
62  .bus = APB1,
63  .irqn = USART2_IRQn
64  }
65 };
66 
67 #define UART_0_ISR (isr_usart2)
68 
69 #define UART_NUMOF ARRAY_SIZE(uart_config)
76 static const spi_conf_t spi_config[] = {
77  {
78  .dev = SPI1,
79  .mosi_pin = GPIO_PIN(PORT_B, 17),
80  .miso_pin = GPIO_PIN(PORT_B, 16),
81  .sclk_pin = GPIO_PIN(PORT_B, 15),
82  .cs_pin = SPI_CS_UNDEF,
83  .rccmask = RCC_APB2ENR_SPI1EN,
84  .apbbus = APB2
85  }
86 };
87 
88 #define SPI_NUMOF ARRAY_SIZE(spi_config)
91 #ifdef __cplusplus
92 } /* end extern "C" */
93 #endif
94 
@ 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 spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:93
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:36
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition: periph_cpu.h:362
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:78
@ APB2
Advanced Peripheral Bus 2
Definition: periph_cpu.h:79
SPI device configuration.
Definition: periph_cpu.h:333
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:334
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