periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2020 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 
21 #ifndef PERIPH_CONF_H
22 #define PERIPH_CONF_H
23 
24 #include "cpu.h"
25 #include "periph_cpu.h"
26 #include "em_cmu.h"
27 #include "board_module.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 #ifndef CLOCK_HF
38 #define CLOCK_HF cmuSelect_HFXO
39 #endif
40 #ifndef CLOCK_CORE_DIV
41 #define CLOCK_CORE_DIV cmuClkDiv_1
42 #endif
43 #ifndef CLOCK_LFA
44 #define CLOCK_LFA cmuSelect_LFRCO
45 #endif
46 #ifndef CLOCK_LFB
47 #define CLOCK_LFB cmuSelect_LFRCO
48 #endif
49 #ifndef CLOCK_LFE
50 #define CLOCK_LFE cmuSelect_LFRCO
51 #endif
52 
58 static const adc_conf_t adc_config[] = {
59  {
60  .dev = ADC0,
61  .cmu = cmuClock_ADC0,
62  }
63 };
64 
65 static const adc_chan_conf_t adc_channel_config[] = {
66  {
67  .dev = 0,
68  .input = adcPosSelTEMP,
69  .reference = adcRef1V25,
70  .acq_time = adcAcqTime8
71  },
72  {
73  .dev = 0,
74  .input = adcPosSelAVDD,
75  .reference = adcRef5V,
76  .acq_time = adcAcqTime8
77  }
78 };
79 
80 #define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
81 #define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
82 
88 static const i2c_conf_t i2c_config[] = {
89  {
90  .dev = I2C0,
91  .sda_pin = MODULE_PIN_P13,
92  .scl_pin = MODULE_PIN_P12,
93  .loc = I2C_ROUTELOC0_SDALOC_LOC16 |
94  I2C_ROUTELOC0_SCLLOC_LOC14,
95  .cmu = cmuClock_I2C0,
96  .irq = I2C0_IRQn,
97  .speed = I2C_SPEED_NORMAL
98  }
99 };
100 
101 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
102 #define I2C_0_ISR isr_i2c0
103 
109 #define RTT_MAX_VALUE (0xFFFFFFFF)
110 #define RTT_FREQUENCY (1U)
111 
117 static const spi_dev_t spi_config[] = {
118  {
119  .dev = USART1,
120  .mosi_pin = MODULE_PIN_F16,
121  .miso_pin = MODULE_PIN_P3,
122  .clk_pin = MODULE_PIN_F15,
123  .loc = USART_ROUTELOC0_RXLOC_LOC11 |
124  USART_ROUTELOC0_TXLOC_LOC11 |
125  USART_ROUTELOC0_CLKLOC_LOC11,
126  .cmu = cmuClock_USART1,
127  .irq = USART1_RX_IRQn
128  }
129 };
130 
131 #define SPI_NUMOF ARRAY_SIZE(spi_config)
132 
140 static const timer_conf_t timer_config[] = {
141  {
142  .prescaler = {
143  .dev = TIMER0,
144  .cmu = cmuClock_TIMER0
145  },
146  .timer = {
147  .dev = TIMER1,
148  .cmu = cmuClock_TIMER1
149  },
150  .irq = TIMER1_IRQn,
151  .channel_numof = 3
152  },
153  {
154  .prescaler = {
155  .dev = NULL,
156  .cmu = cmuClock_LETIMER0
157  },
158  .timer = {
159  .dev = LETIMER0,
160  .cmu = cmuClock_LETIMER0
161  },
162  .irq = LETIMER0_IRQn,
163  .channel_numof = 2
164  }
165 };
166 
167 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
168 #define TIMER_0_ISR isr_timer1
169 #define TIMER_1_ISR isr_letimer0
170 
176 static const uart_conf_t uart_config[] = {
177  {
178  .dev = USART0,
179  .rx_pin = MODULE_PIN_F7,
180  .tx_pin = MODULE_PIN_F6,
181  .loc = USART_ROUTELOC0_RXLOC_LOC0 |
182  USART_ROUTELOC0_TXLOC_LOC0,
183  .cmu = cmuClock_USART0,
184  .irq = USART0_RX_IRQn
185  }
186 };
187 
188 #define UART_NUMOF ARRAY_SIZE(uart_config)
189 #define UART_0_ISR_RX isr_usart0_rx
190 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif /* PERIPH_CONF_H */
197 
spi_dev_t::dev
USART_TypeDef * dev
USART device used.
Definition: periph_cpu.h:331
adc_chan_conf_t
ADC channel configuration.
Definition: periph_cpu.h:82
I2C_SPEED_NORMAL
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: i2c.h:177
adc_conf_t::dev
ADC_TypeDef * dev
ADC device used.
Definition: periph_cpu.h:75
timer_dev_t::dev
void * dev
TIMER_TypeDef or LETIMER_TypeDef device used.
Definition: periph_cpu.h:358
spi_dev_t
SPI device configuration.
Definition: periph_cpu.h:330
timer_conf_t::prescaler
timer_dev_t prescaler
the lower neighboring timer (not initialized for LETIMER)
Definition: periph_cpu.h:363
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
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
adc_chan_conf_t::dev
uint8_t dev
device index
Definition: periph_cpu.h:83
i2c_conf_t
I2C configuration options.
Definition: periph_cpu.h:128
i2c_conf_t::dev
I2C_TypeDef * dev
USART device used.
Definition: periph_cpu.h:247