Loading...
Searching...
No Matches
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
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#include "usbdev_cfg_otg_fs.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36#ifndef CLOCK_HF
37#define CLOCK_HF cmuSelect_HFXO
38#endif
39#ifndef CLOCK_CORE_DIV
40#define CLOCK_CORE_DIV cmuClkDiv_1
41#endif
42#ifndef CLOCK_LFA
43#define CLOCK_LFA cmuSelect_LFXO
44#endif
45#ifndef CLOCK_LFB
46#define CLOCK_LFB cmuSelect_LFXO
47#endif
48#ifndef CLOCK_LFE
49#define CLOCK_LFE cmuSelect_LFXO
50#endif
57static const adc_conf_t adc_config[] = {
58 {
59 .dev = ADC0,
60 .cmu = cmuClock_ADC0,
61 }
62};
63
64static const adc_chan_conf_t adc_channel_config[] = {
65 {
66 .dev = 0,
67 .input = adcPosSelTEMP,
68 .reference = adcRef1V25,
69 .acq_time = adcAcqTime8
70 },
71 {
72 .dev = 0,
73 .input = adcPosSelAVDD,
74 .reference = adcRef5V,
75 .acq_time = adcAcqTime8
76 }
77};
78
79#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
80#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
87static const dac_conf_t dac_config[] = {
88 {
89 .dev = VDAC0,
90 .ref = vdacRefAvdd,
91 .cmu = cmuClock_VDAC0,
92 },
93};
94
95static const dac_chan_conf_t dac_channel_config[] = {
96 {
97 .dev = 0,
98 .index = 0,
99 },
100};
101
102#define DAC_DEV_NUMOF ARRAY_SIZE(dac_config)
103#define DAC_NUMOF ARRAY_SIZE(dac_channel_config)
110static const i2c_conf_t i2c_config[] = {
111 {
112 .dev = I2C0,
113 .sda_pin = GPIO_PIN(PC, 0),
114 .scl_pin = GPIO_PIN(PC, 1),
115 .loc = I2C_ROUTELOC0_SDALOC_LOC4 |
116 I2C_ROUTELOC0_SCLLOC_LOC4,
117 .cmu = cmuClock_I2C0,
118 .irq = I2C0_IRQn,
119 .speed = I2C_SPEED_NORMAL
120 },
121 {
122 .dev = I2C1,
123 .sda_pin = GPIO_PIN(PC, 7),
124 .scl_pin = GPIO_PIN(PC, 5),
125 .loc = I2C_ROUTELOC0_SDALOC_LOC0 |
126 I2C_ROUTELOC0_SCLLOC_LOC0,
127 .cmu = cmuClock_I2C1,
128 .irq = I2C1_IRQn,
129 .speed = I2C_SPEED_NORMAL
130 },
131 {
132 .dev = I2C2,
133 .sda_pin = GPIO_PIN(PI, 4),
134 .scl_pin = GPIO_PIN(PI, 5),
135 .loc = I2C_ROUTELOC0_SDALOC_LOC7 |
136 I2C_ROUTELOC0_SCLLOC_LOC7,
137 .cmu = cmuClock_I2C2,
138 .irq = I2C2_IRQn,
139 .speed = I2C_SPEED_NORMAL
140 }
141};
142
143#define I2C_NUMOF ARRAY_SIZE(i2c_config)
144#define I2C_0_ISR isr_i2c0
145#define I2C_1_ISR isr_i2c1
146#define I2C_2_ISR isr_i2c2
153#ifndef RTT_FREQUENCY
154#define RTT_FREQUENCY (1U)
155#endif
162static const spi_dev_t spi_config[] = {
163 {
164 .dev = USART0,
165 .mosi_pin = GPIO_PIN(PE, 10),
166 .miso_pin = GPIO_PIN(PE, 11),
167 .clk_pin = GPIO_PIN(PE, 12),
168 .loc = USART_ROUTELOC0_TXLOC_LOC0 |
169 USART_ROUTELOC0_RXLOC_LOC0 |
170 USART_ROUTELOC0_CLKLOC_LOC0,
171 .cmu = cmuClock_USART0,
172 .irq = USART0_RX_IRQn
173 }
174};
175
176#define SPI_NUMOF ARRAY_SIZE(spi_config)
185static const timer_conf_t timer_config[] = {
186 {
187 .prescaler = {
188 .dev = WTIMER0,
189 .cmu = cmuClock_WTIMER0
190 },
191 .timer = {
192 .dev = WTIMER1,
193 .cmu = cmuClock_WTIMER1
194 },
195 .irq = WTIMER1_IRQn,
196 .channel_numof = 3
197 },
198 {
199 .prescaler = {
200 .dev = TIMER0,
201 .cmu = cmuClock_TIMER0
202 },
203 .timer = {
204 .dev = TIMER1,
205 .cmu = cmuClock_TIMER1
206 },
207 .irq = TIMER1_IRQn,
208 .channel_numof = 3
209 },
210 {
211 .prescaler = {
212 .dev = NULL,
213 .cmu = cmuClock_LETIMER0
214 },
215 .timer = {
216 .dev = LETIMER0,
217 .cmu = cmuClock_LETIMER0
218 },
219 .irq = LETIMER0_IRQn,
220 .channel_numof = 2
221 }
222};
223
224#define TIMER_NUMOF ARRAY_SIZE(timer_config)
225#define TIMER_0_ISR isr_wtimer1
226#define TIMER_1_ISR isr_timer1
227#define TIMER_2_ISR isr_letimer0
234static const uart_conf_t uart_config[] = {
235 {
236 .dev = USART4,
237 .rx_pin = GPIO_PIN(PH, 5),
238 .tx_pin = GPIO_PIN(PH, 4),
239 .loc = USART_ROUTELOC0_RXLOC_LOC4 |
240 USART_ROUTELOC0_TXLOC_LOC4,
241 .cmu = cmuClock_USART4,
242 .irq = USART4_RX_IRQn,
243 },
244 {
245 .dev = USART5,
246 .rx_pin = GPIO_PIN(PE, 9),
247 .tx_pin = GPIO_PIN(PE, 8),
248 .loc = USART_ROUTELOC0_RXLOC_LOC4 |
249 USART_ROUTELOC0_TXLOC_LOC4,
250 .cmu = cmuClock_USART5,
251 .irq = USART5_RX_IRQn,
252 }
253};
254
255#define UART_NUMOF ARRAY_SIZE(uart_config)
256#define UART_0_ISR_RX isr_usart4_rx
257#define UART_1_ISR_RX isr_usart5_rx
260#ifdef __cplusplus
261}
262#endif
263
264#endif /* PERIPH_CONF_H */
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:278
@ PC
port C
ADC channel configuration.
Definition periph_cpu.h:387
uint8_t dev
device index
Definition periph_cpu.h:388
ADC device configuration.
Definition periph_cpu.h:379
ADC_TypeDef * dev
ADC device used.
Definition periph_cpu.h:380
DAC line configuration data.
Definition periph_cpu.h:301
I2C configuration structure.
Definition periph_cpu.h:299
TWI_t * dev
Pointer to hardware module registers.
Definition periph_cpu.h:300
SPI device configuration.
Definition periph_cpu.h:518
USART_TypeDef * dev
USART device used.
Definition periph_cpu.h:519
Timer device configuration.
Definition periph_cpu.h:264
timer_dev_t prescaler
the lower neighboring timer (not initialized for LETIMER)
Definition periph_cpu.h:557
void * dev
TIMER_TypeDef or LETIMER_TypeDef device used.
Definition periph_cpu.h:550
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219
Common configuration for EFM32 OTG FS peripheral.