periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin
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 HSE */
23 #ifndef CONFIG_BOARD_HAS_HSE
24 #define CONFIG_BOARD_HAS_HSE 1
25 #endif
26 
27 #include "periph_cpu.h"
28 #include "clk_conf.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
38 static const timer_conf_t timer_config[] = {
39  {
40  .dev = TIM2,
41  .max = 0xffffffff,
42  .rcc_mask = RCC_APB1ENR_TIM2EN,
43  .bus = APB1,
44  .irqn = TIM2_IRQn
45  }
46 };
47 
48 #define TIMER_0_ISR isr_tim2
49 
50 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
57 static const uart_conf_t uart_config[] = {
58  {
59  .dev = USART1,
60  .rcc_mask = RCC_APB2ENR_USART1EN,
61  .rx_pin = GPIO_PIN(PORT_B, 7),
62  .tx_pin = GPIO_PIN(PORT_B, 6),
63  .rx_af = GPIO_AF0,
64  .tx_af = GPIO_AF0,
65  .bus = APB2,
66  .irqn = USART1_IRQn,
67  },
68  {
69  .dev = USART2,
70  .rcc_mask = RCC_APB1ENR_USART2EN,
71  .rx_pin = GPIO_PIN(PORT_A, 3),
72  .tx_pin = GPIO_PIN(PORT_A, 2),
73  .rx_af = GPIO_AF1,
74  .tx_af = GPIO_AF1,
75  .bus = APB1,
76  .irqn = USART2_IRQn
77  }
78 };
79 
80 #define UART_0_ISR (isr_usart1)
81 #define UART_1_ISR (isr_usart2)
82 
83 #define UART_NUMOF ARRAY_SIZE(uart_config)
93 static const adc_conf_t adc_config[] = {
94  { GPIO_PIN(PORT_C, 0), 10 },
95  { GPIO_PIN(PORT_C, 1), 11 },
96  { GPIO_PIN(PORT_C, 2), 12 },
97  { GPIO_PIN(PORT_C, 3), 13 },
98  { GPIO_PIN(PORT_C, 4), 14 },
99  { GPIO_PIN(PORT_C, 5), 15 },
100  { GPIO_UNDEF, 18 }, /* VBAT */
101 };
102 
103 #define VBAT_ADC ADC_LINE(6)
104 #define ADC_NUMOF ARRAY_SIZE(adc_config)
111 static const spi_conf_t spi_config[] = {
112  {
113  .dev = SPI1,
114  .mosi_pin = GPIO_PIN(PORT_A, 7),
115  .miso_pin = GPIO_PIN(PORT_A, 6),
116  .sclk_pin = GPIO_PIN(PORT_A, 5),
117  .cs_pin = SPI_CS_UNDEF,
118  .mosi_af = GPIO_AF0,
119  .miso_af = GPIO_AF0,
120  .sclk_af = GPIO_AF0,
121  .cs_af = GPIO_AF0,
122  .rccmask = RCC_APB2ENR_SPI1EN,
123  .apbbus = APB2
124  },
125  {
126  .dev = SPI2,
127  .mosi_pin = GPIO_PIN(PORT_B, 15),
128  .miso_pin = GPIO_PIN(PORT_B, 14),
129  .sclk_pin = GPIO_PIN(PORT_B, 13),
130  .cs_pin = SPI_CS_UNDEF,
131  .mosi_af = GPIO_AF0,
132  .miso_af = GPIO_AF0,
133  .sclk_af = GPIO_AF0,
134  .cs_af = GPIO_AF0,
135  .rccmask = RCC_APB1ENR_SPI2EN,
136  .apbbus = APB1
137  }
138 };
139 
140 #define SPI_NUMOF ARRAY_SIZE(spi_config)
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition: periph_cpu.h:48
@ PORT_C
port C
Definition: periph_cpu.h:49
@ 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
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:39
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:97
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:40
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:251
@ GPIO_AF1
use alternate function 1
Definition: cpu_gpio.h:103
@ GPIO_AF0
use alternate function 0
Definition: cpu_gpio.h:102
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition: periph_cpu.h:363
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:79
@ APB2
Advanced Peripheral Bus 2
Definition: periph_cpu.h:80
ADC device configuration.
Definition: periph_cpu.h:379
SPI device configuration.
Definition: periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:338
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