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 
25 #include "periph_cpu.h"
26 
27 #include "em_cmu.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 #define PERIPH_NUMOF(config) (sizeof(config) / sizeof(config[0]))
37 
42 #ifndef CLOCK_HF
43 #define CLOCK_HF cmuSelect_HFXO
44 #endif
45 #ifndef CLOCK_CORE_DIV
46 #define CLOCK_CORE_DIV cmuClkDiv_1
47 #endif
48 #ifndef CLOCK_LFA
49 #define CLOCK_LFA cmuSelect_LFXO
50 #endif
51 #ifndef CLOCK_LFB
52 #define CLOCK_LFB cmuSelect_LFXO
53 #endif
54 #ifndef CLOCK_LFE
55 #define CLOCK_LFE cmuSelect_LFXO
56 #endif
57 
63 static const adc_conf_t adc_config[] = {
64  {
65  .dev = ADC0,
66  .cmu = cmuClock_ADC0,
67  }
68 };
69 
70 static const adc_chan_conf_t adc_channel_config[] = {
71  {
72  .dev = 0,
73  .input = adcPosSelTEMP,
74  .reference = adcRef1V25,
75  .acq_time = adcAcqTime8
76  },
77  {
78  .dev = 0,
79  .input = adcPosSelAVDD,
80  .reference = adcRef5V,
81  .acq_time = adcAcqTime8
82  }
83 };
84 
85 #define ADC_DEV_NUMOF PERIPH_NUMOF(adc_config)
86 #define ADC_NUMOF PERIPH_NUMOF(adc_channel_config)
87 
93 static const i2c_conf_t i2c_config[] = {
94  {
95  .dev = I2C0,
96  .sda_pin = GPIO_PIN(PC, 10),
97  .scl_pin = GPIO_PIN(PC, 11),
98  .loc = I2C_ROUTELOC0_SDALOC_LOC15 |
99  I2C_ROUTELOC0_SCLLOC_LOC15,
100  .cmu = cmuClock_I2C0,
101  .irq = I2C0_IRQn
102 
103  }
104 };
105 
106 #define I2C_NUMOF PERIPH_NUMOF(i2c_config)
107 #define I2C_0_ISR isr_i2c0
108 
113 #define RTC_NUMOF (1U)
114 
119 #define RTT_NUMOF (1U)
120 
121 #define RTT_MAX_VALUE (0xFFFFFFFF)
122 #define RTT_FREQUENCY (1U)
123 
129 static const spi_dev_t spi_config[] = {
130  {
131  .dev = USART1,
132  .mosi_pin = GPIO_PIN(PC, 6),
133  .miso_pin = GPIO_PIN(PC, 7),
134  .clk_pin = GPIO_PIN(PC, 8),
135  .loc = USART_ROUTELOC0_RXLOC_LOC11 |
136  USART_ROUTELOC0_TXLOC_LOC11 |
137  USART_ROUTELOC0_CLKLOC_LOC11,
138  .cmu = cmuClock_USART1,
139  .irq = USART1_RX_IRQn
140  }
141 };
142 
143 #define SPI_NUMOF PERIPH_NUMOF(spi_config)
144 
152 static const timer_conf_t timer_config[] = {
153  {
154  {
155  .dev = TIMER0,
156  .cmu = cmuClock_TIMER0
157  },
158  {
159  .dev = TIMER1,
160  .cmu = cmuClock_TIMER1
161  },
162  .irq = TIMER1_IRQn
163  }
164 };
165 
166 #define TIMER_NUMOF PERIPH_NUMOF(timer_config)
167 #define TIMER_0_ISR isr_timer1
168 
174 static const uart_conf_t uart_config[] = {
175  {
176  .dev = USART0,
177  .rx_pin = GPIO_PIN(PA, 1),
178  .tx_pin = GPIO_PIN(PA, 0),
179  .loc = USART_ROUTELOC0_RXLOC_LOC0 |
180  USART_ROUTELOC0_TXLOC_LOC0,
181  .cmu = cmuClock_USART0,
182  .irq = USART0_RX_IRQn
183  },
184  {
185  .dev = USART1,
186  .rx_pin = GPIO_PIN(PC, 6),
187  .tx_pin = GPIO_PIN(PC, 7),
188  .loc = USART_ROUTELOC0_RXLOC_LOC11 |
189  USART_ROUTELOC0_TXLOC_LOC11,
190  .cmu = cmuClock_USART1,
191  .irq = USART1_RX_IRQn
192  },
193  {
194  .dev = LEUART0,
195  .rx_pin = GPIO_PIN(PD, 11),
196  .tx_pin = GPIO_PIN(PD, 10),
197  .loc = LEUART_ROUTELOC0_RXLOC_LOC18 |
198  LEUART_ROUTELOC0_TXLOC_LOC18,
199  .cmu = cmuClock_LEUART0,
200  .irq = LEUART0_IRQn
201  }
202 };
203 
204 #define UART_NUMOF PERIPH_NUMOF(uart_config)
205 #define UART_0_ISR_RX isr_usart0_rx
206 #define UART_1_ISR_RX isr_usart1_rx
207 #define UART_2_ISR_RX isr_leuart0
208 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif /* PERIPH_CONF_H */
215 
SPI device configuration.
void * dev
UART, USART or LEUART device used.
I2C configuration options.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
NRF_TIMER_Type * dev
timer device
ADC_TypeDef * dev
ADC device used.
UART device configuration.
I2C_TypeDef * dev
USART device used.
ADC channel configuration.
USART_TypeDef * dev
USART device used.
ADC device configuration.
Timer configuration.