boards/msbiot/include/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 #include "periph_cpu.h"
23 #include "f4/cfg_clock_168_16_0.h"
24 #include "cfg_spi_divtable.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 = 0xffffffff,
38  .rcc_mask = RCC_APB1ENR_TIM2EN,
39  .bus = APB1,
40  .irqn = TIM2_IRQn
41  },
42  {
43  .dev = TIM5,
44  .max = 0xffffffff,
45  .rcc_mask = RCC_APB1ENR_TIM5EN,
46  .bus = APB1,
47  .irqn = TIM5_IRQn
48  }
49 };
50 
51 #define TIMER_0_ISR isr_tim2
52 #define TIMER_1_ISR isr_tim5
53 
54 #define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
55 
61 static const pwm_conf_t pwm_config[] = {
62  {
63  .dev = TIM11,
64  .rcc_mask = RCC_APB2ENR_TIM11EN,
65  .chan = { { .pin = GPIO_PIN(PORT_B, 9), .cc_chan = 0 },
66  { .pin = GPIO_UNDEF, .cc_chan = 0 },
67  { .pin = GPIO_UNDEF, .cc_chan = 0 },
68  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
69  .af = GPIO_AF3,
70  .bus = APB2
71  }
72 };
73 
74 #define PWM_NUMOF (sizeof(pwm_config) / sizeof(pwm_config[0]))
75 
84 #define ADC_CONFIG { \
85  {GPIO_PIN(PORT_B, 0), 0, 8}, \
86  {GPIO_PIN(PORT_B, 1), 0, 9} \
87 }
88 
89 #define ADC_NUMOF (2)
90 
96 static const dac_conf_t dac_config[] = {
97  { .pin = GPIO_PIN(PORT_A, 4), .chan = 0 },
98  { .pin = GPIO_PIN(PORT_A, 5), .chan = 1 }
99 };
100 
101 #define DAC_NUMOF (sizeof(dac_config) / sizeof(dac_config[0]))
102 
108 static const uart_conf_t uart_config[] = {
109  {
110  .dev = USART2,
111  .rcc_mask = RCC_APB1ENR_USART2EN,
112  .rx_pin = GPIO_PIN(PORT_A, 3),
113  .tx_pin = GPIO_PIN(PORT_A, 2),
114  .rx_af = GPIO_AF7,
115  .tx_af = GPIO_AF7,
116  .bus = APB1,
117  .irqn = USART2_IRQn,
118 #ifdef UART_USE_DMA
119  .dma_stream = 6,
120  .dma_chan = 4
121 #endif
122  },
123  {
124  .dev = USART1,
125  .rcc_mask = RCC_APB2ENR_USART1EN,
126  .rx_pin = GPIO_PIN(PORT_A, 10),
127  .tx_pin = GPIO_PIN(PORT_A, 9),
128  .rx_af = GPIO_AF7,
129  .tx_af = GPIO_AF7,
130  .bus = APB2,
131  .irqn = USART1_IRQn,
132 #ifdef UART_USE_DMA
133  .dma_stream = 15,
134  .dma_chan = 4
135 #endif
136  },
137  {
138  .dev = USART3,
139  .rcc_mask = RCC_APB1ENR_USART3EN,
140  .rx_pin = GPIO_PIN(PORT_D, 9),
141  .tx_pin = GPIO_PIN(PORT_D, 8),
142  .rx_af = GPIO_AF7,
143  .tx_af = GPIO_AF7,
144  .bus = APB1,
145  .irqn = USART3_IRQn,
146 #ifdef UART_USE_DMA
147  .dma_stream = 3,
148  .dma_chan = 4
149 #endif
150  },
151 };
152 
153 /* assign ISR vector names */
154 #define UART_0_ISR (isr_usart2)
155 #define UART_0_DMA_ISR (isr_dma1_stream6)
156 #define UART_1_ISR (isr_usart1)
157 #define UART_1_DMA_ISR (isr_dma2_stream7)
158 #define UART_2_ISR (isr_usart3)
159 #define UART_2_DMA_ISR (isr_dma1_stream3)
160 
161 /* deduct number of defined UART interfaces */
162 #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
163 
169 static const spi_conf_t spi_config[] = {
170  {
171  .dev = SPI1,
172  .mosi_pin = GPIO_PIN(PORT_A, 7),
173  .miso_pin = GPIO_PIN(PORT_A, 6),
174  .sclk_pin = GPIO_PIN(PORT_A, 5),
175  .cs_pin = GPIO_PIN(PORT_A, 4),
176  .af = GPIO_AF5,
177  .rccmask = RCC_APB2ENR_SPI1EN,
178  .apbbus = APB2
179  }
180 };
181 
182 #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
183 
189 static const i2c_conf_t i2c_config[] = {
190  {
191  .dev = I2C1,
192  .speed = I2C_SPEED_NORMAL,
193  .scl_pin = GPIO_PIN(PORT_B, 6),
194  .sda_pin = GPIO_PIN(PORT_B, 7),
195  .scl_af = GPIO_AF4,
196  .sda_af = GPIO_AF4,
197  .bus = APB1,
198  .rcc_mask = RCC_APB1ENR_I2C1EN,
199  .clk = CLOCK_APB1,
200  .irqn = I2C1_EV_IRQn
201  }
202 };
203 
204 #define I2C_0_ISR isr_i2c1_ev
205 
206 #define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
207 
209 #ifdef __cplusplus
210 }
211 #endif
212 
213 #endif /* PERIPH_CONF_H */
214 
use alternate function 4
use alternate function 7
cc2538_uart_t * dev
pointer to the used UART device
I2C configuration options.
TIMER_TypeDef * dev
TIMER device used.
gpio_t pin
pin connected to the line
Configure STM32F4 clock to 168MHz using PLL.
SPI_Type * dev
SPI device to use.
use alternate function 3
PWM device configuration.
NRF_TIMER_Type * dev
timer device
Collection of pre-computed bus pre-scalers for SPI configuration.
use alternate function 5
UART device configuration.
I2C_TypeDef * dev
USART device used.
DAC line configuration data.
SPI module configuration options.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
normal mode: ~100kbit/s
Timer configuration.