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 #ifdef EMU_DCDCINIT_OFF
62 #error "This option will soft-brick your board. Please remove it."
63 #endif
64 
70 static const adc_conf_t adc_config[] = {
71  {
72  .dev = ADC0,
73  .cmu = cmuClock_ADC0,
74  }
75 };
76 
77 static const adc_chan_conf_t adc_channel_config[] = {
78  {
79  .dev = 0,
80  .input = adcPosSelTEMP,
81  .reference = adcRef1V25,
82  .acq_time = adcAcqTime8
83  },
84  {
85  .dev = 0,
86  .input = adcPosSelAVDD,
87  .reference = adcRef5V,
88  .acq_time = adcAcqTime8
89  }
90 };
91 
92 #define ADC_DEV_NUMOF PERIPH_NUMOF(adc_config)
93 #define ADC_NUMOF PERIPH_NUMOF(adc_channel_config)
94 
100 static const i2c_conf_t i2c_config[] = {
101  {
102  .dev = I2C0,
103  .sda_pin = GPIO_PIN(PC, 10),
104  .scl_pin = GPIO_PIN(PC, 11),
105  .loc = I2C_ROUTELOC0_SDALOC_LOC15 |
106  I2C_ROUTELOC0_SCLLOC_LOC15,
107  .cmu = cmuClock_I2C0,
108  .irq = I2C0_IRQn,
109  .speed = I2C_SPEED_NORMAL
110  }
111 };
112 
113 #define I2C_NUMOF PERIPH_NUMOF(i2c_config)
114 #define I2C_0_ISR isr_i2c0
115 
120 #define RTC_NUMOF (1U)
121 
126 #define RTT_NUMOF (1U)
127 
128 #define RTT_MAX_VALUE (0xFFFFFFFF)
129 #define RTT_FREQUENCY (1U)
130 
136 static const spi_dev_t spi_config[] = {
137  {
138  .dev = USART1,
139  .mosi_pin = GPIO_PIN(PC, 6),
140  .miso_pin = GPIO_PIN(PC, 7),
141  .clk_pin = GPIO_PIN(PC, 8),
142  .loc = USART_ROUTELOC0_RXLOC_LOC11 |
143  USART_ROUTELOC0_TXLOC_LOC11 |
144  USART_ROUTELOC0_CLKLOC_LOC11,
145  .cmu = cmuClock_USART1,
146  .irq = USART1_RX_IRQn
147  }
148 };
149 
150 #define SPI_NUMOF PERIPH_NUMOF(spi_config)
151 
159 static const timer_conf_t timer_config[] = {
160  {
161  {
162  .dev = TIMER0,
163  .cmu = cmuClock_TIMER0
164  },
165  {
166  .dev = TIMER1,
167  .cmu = cmuClock_TIMER1
168  },
169  .irq = TIMER1_IRQn
170  }
171 };
172 
173 #define TIMER_NUMOF PERIPH_NUMOF(timer_config)
174 #define TIMER_0_ISR isr_timer1
175 
181 static const uart_conf_t uart_config[] = {
182  {
183  .dev = USART0,
184  .rx_pin = GPIO_PIN(PA, 1),
185  .tx_pin = GPIO_PIN(PA, 0),
186  .loc = USART_ROUTELOC0_RXLOC_LOC0 |
187  USART_ROUTELOC0_TXLOC_LOC0,
188 #if EFM32_UART_MODES
189  .mode = UART_MODE_8N1,
190 #endif
191  .cmu = cmuClock_USART0,
192  .irq = USART0_RX_IRQn
193  },
194  {
195  .dev = USART1,
196  .rx_pin = GPIO_PIN(PC, 6),
197  .tx_pin = GPIO_PIN(PC, 7),
198  .loc = USART_ROUTELOC0_RXLOC_LOC11 |
199  USART_ROUTELOC0_TXLOC_LOC11,
200 #if EFM32_UART_MODES
201  .mode = UART_MODE_8N1,
202 #endif
203  .cmu = cmuClock_USART1,
204  .irq = USART1_RX_IRQn
205  },
206  {
207  .dev = LEUART0,
208  .rx_pin = GPIO_PIN(PD, 11),
209  .tx_pin = GPIO_PIN(PD, 10),
210  .loc = LEUART_ROUTELOC0_RXLOC_LOC18 |
211  LEUART_ROUTELOC0_TXLOC_LOC18,
212 #if EFM32_UART_MODES
213  .mode = UART_MODE_8N1,
214 #endif
215  .cmu = cmuClock_LEUART0,
216  .irq = LEUART0_IRQn
217  }
218 };
219 
220 #define UART_NUMOF PERIPH_NUMOF(uart_config)
221 #define UART_0_ISR_RX isr_usart0_rx
222 #define UART_1_ISR_RX isr_usart1_rx
223 #define UART_2_ISR_RX isr_leuart0
224 
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #endif /* PERIPH_CONF_H */
231 
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.
normal mode: ~100kbit/s
ADC channel configuration.
USART_TypeDef * dev
USART device used.
ADC device configuration.
Timer configuration.