boards/sltb001a/include/periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2017 Freie Universit├Ąt Berlin
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 
20 #ifndef PERIPH_CONF_H
21 #define PERIPH_CONF_H
22 
23 #include "cpu.h"
24 #include "periph_cpu.h"
25 #include "em_cmu.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 #define PERIPH_NUMOF(config) (sizeof(config) / sizeof(config[0]))
35 
40 #ifndef CLOCK_HF
41 #define CLOCK_HF cmuSelect_HFXO
42 #endif
43 #ifndef CLOCK_CORE_DIV
44 #define CLOCK_CORE_DIV cmuClkDiv_1
45 #endif
46 #ifndef CLOCK_LFA
47 #define CLOCK_LFA cmuSelect_LFXO
48 #endif
49 #ifndef CLOCK_LFB
50 #define CLOCK_LFB cmuSelect_LFXO
51 #endif
52 #ifndef CLOCK_LFE
53 #define CLOCK_LFE cmuSelect_LFXO
54 #endif
55 
61 static const adc_conf_t adc_config[] = {
62  {
63  .dev = ADC0,
64  .cmu = cmuClock_ADC0,
65  }
66 };
67 
68 static const adc_chan_conf_t adc_channel_config[] = {
69  {
70  .dev = 0,
71  .input = adcPosSelTEMP,
72  .reference = adcRef1V25,
73  .acq_time = adcAcqTime8
74  },
75  {
76  .dev = 0,
77  .input = adcPosSelAVDD,
78  .reference = adcRef5V,
79  .acq_time = adcAcqTime8
80  }
81 };
82 
83 #define ADC_DEV_NUMOF PERIPH_NUMOF(adc_config)
84 #define ADC_NUMOF PERIPH_NUMOF(adc_channel_config)
85 
91 static const i2c_conf_t i2c_config[] = {
92  {
93  .dev = I2C0,
94  .sda_pin = GPIO_PIN(PC, 10),
95  .scl_pin = GPIO_PIN(PC, 11),
96  .loc = I2C_ROUTELOC0_SDALOC_LOC15 |
97  I2C_ROUTELOC0_SCLLOC_LOC15,
98  .cmu = cmuClock_I2C0,
99  .irq = I2C0_IRQn
100 
101  }
102 };
103 
104 #define I2C_NUMOF PERIPH_NUMOF(i2c_config)
105 #define I2C_0_ISR isr_i2c0
106 
111 #define RTC_NUMOF (1U)
112 
117 #define RTT_NUMOF (1U)
118 
119 #define RTT_MAX_VALUE (0xFFFFFFFF)
120 #define RTT_FREQUENCY (1U)
121 
127 static const spi_dev_t spi_config[] = {
128  {
129  .dev = USART1,
130  .mosi_pin = GPIO_PIN(PC, 6),
131  .miso_pin = GPIO_PIN(PC, 7),
132  .clk_pin = GPIO_PIN(PC, 8),
133  .loc = USART_ROUTELOC0_RXLOC_LOC11 |
134  USART_ROUTELOC0_TXLOC_LOC11 |
135  USART_ROUTELOC0_CLKLOC_LOC11,
136  .cmu = cmuClock_USART1,
137  .irq = USART1_RX_IRQn
138  }
139 };
140 
141 #define SPI_NUMOF PERIPH_NUMOF(spi_config)
142 
150 static const timer_conf_t timer_config[] = {
151  {
152  {
153  .dev = TIMER0,
154  .cmu = cmuClock_TIMER0
155  },
156  {
157  .dev = TIMER1,
158  .cmu = cmuClock_TIMER1
159  },
160  .irq = TIMER1_IRQn
161  }
162 };
163 
164 #define TIMER_NUMOF PERIPH_NUMOF(timer_config)
165 #define TIMER_0_ISR isr_timer1
166 
172 static const uart_conf_t uart_config[] = {
173  {
174  .dev = USART0,
175  .rx_pin = GPIO_PIN(PA, 1),
176  .tx_pin = GPIO_PIN(PA, 0),
177  .loc = USART_ROUTELOC0_RXLOC_LOC0 |
178  USART_ROUTELOC0_TXLOC_LOC0,
179 #if EFM32_UART_MODES
180  .mode = UART_MODE_8N1,
181 #endif
182  .cmu = cmuClock_USART0,
183  .irq = USART0_RX_IRQn
184  },
185  {
186  .dev = USART1,
187  .rx_pin = GPIO_PIN(PC, 6),
188  .tx_pin = GPIO_PIN(PC, 7),
189  .loc = USART_ROUTELOC0_RXLOC_LOC11 |
190  USART_ROUTELOC0_TXLOC_LOC11,
191 #if EFM32_UART_MODES
192  .mode = UART_MODE_8N1,
193 #endif
194  .cmu = cmuClock_USART1,
195  .irq = USART1_RX_IRQn
196  },
197  {
198  .dev = LEUART0,
199  .rx_pin = GPIO_PIN(PD, 11),
200  .tx_pin = GPIO_PIN(PD, 10),
201  .loc = LEUART_ROUTELOC0_RXLOC_LOC18 |
202  LEUART_ROUTELOC0_TXLOC_LOC18,
203 #if EFM32_UART_MODES
204  .mode = UART_MODE_8N1,
205 #endif
206  .cmu = cmuClock_LEUART0,
207  .irq = LEUART0_IRQn
208  }
209 };
210 
211 #define UART_NUMOF PERIPH_NUMOF(uart_config)
212 #define UART_0_ISR_RX isr_usart0_rx
213 #define UART_1_ISR_RX isr_usart1_rx
214 #define UART_2_ISR_RX isr_leuart0
215 
217 #ifdef __cplusplus
218 }
219 #endif
220 
221 #endif /* PERIPH_CONF_H */
222 
SPI device configuration.
cc2538_uart_t * dev
pointer to the used UART device
I2C configuration options.
NRF_TIMER_Type * dev
timer device
uint8_t dev
device index
8 data bits, no parity, 1 stop bit
ADC_TypeDef * dev
ADC device used.
UART device configuration.
I2C_TypeDef * dev
USART device used.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
ADC channel configuration.
USART_TypeDef * dev
USART device used.
ADC device configuration.
Timer configuration.