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 "f0/cfg_clock_default.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)
51 
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)
84 
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 };
101 
102 #define ADC_NUMOF ARRAY_SIZE(adc_config)
103 
109 static const spi_conf_t spi_config[] = {
110  {
111  .dev = SPI1,
112  .mosi_pin = GPIO_PIN(PORT_A, 7),
113  .miso_pin = GPIO_PIN(PORT_A, 6),
114  .sclk_pin = GPIO_PIN(PORT_A, 5),
115  .cs_pin = GPIO_UNDEF,
116  .mosi_af = GPIO_AF0,
117  .miso_af = GPIO_AF0,
118  .sclk_af = GPIO_AF0,
119  .cs_af = GPIO_AF0,
120  .rccmask = RCC_APB2ENR_SPI1EN,
121  .apbbus = APB2
122  },
123  {
124  .dev = SPI2,
125  .mosi_pin = GPIO_PIN(PORT_B, 15),
126  .miso_pin = GPIO_PIN(PORT_B, 14),
127  .sclk_pin = GPIO_PIN(PORT_B, 13),
128  .cs_pin = GPIO_UNDEF,
129  .mosi_af = GPIO_AF0,
130  .miso_af = GPIO_AF0,
131  .sclk_af = GPIO_AF0,
132  .cs_af = GPIO_AF0,
133  .rccmask = RCC_APB1ENR_SPI2EN,
134  .apbbus = APB1
135  }
136 };
137 
138 #define SPI_NUMOF ARRAY_SIZE(spi_config)
139 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif /* PERIPH_CONF_H */
PORT_C
@ PORT_C
port C
Definition: periph_cpu.h:38
PORT_A
@ PORT_A
port A
Definition: periph_cpu.h:36
GPIO_UNDEF
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Definition: periph_cpu_common.h:52
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
GPIO_AF1
@ GPIO_AF1
use alternate function 1
Definition: periph_cpu_common.h:87
uart_conf_t::dev
cc2538_uart_t * dev
pointer to the used UART device
Definition: periph_cpu.h:167
timer_conf_t
Timer configuration.
Definition: periph_cpu.h:288
adc_conf_t
ADC device configuration.
Definition: periph_cpu.h:74
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
APB2
@ APB2
APB2 bus.
Definition: periph_cpu.h:177
cfg_clock_default.h
Default clock configuration for STM32F0.
GPIO_AF0
@ GPIO_AF0
use alternate function 0
Definition: periph_cpu_common.h:86
timer_conf_t::dev
uint32_t dev
Address of timer base.
Definition: periph_cpu.h:112
PORT_B
@ PORT_B
port B
Definition: periph_cpu.h:37
spi_conf_t::dev
SPI_Type * dev
SPI device to use.
Definition: periph_cpu.h:465
spi_conf_t
SPI configuration structure type.
Definition: periph_cpu.h:273
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176