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(PE, 4),
114 .scl_pin = GPIO_PIN(PE, 5),
115 .loc = I2C_ROUTELOC0_SDALOC_LOC7 |
116 I2C_ROUTELOC0_SCLLOC_LOC7,
117 .cmu = cmuClock_I2C0,
118 .irq = I2C0_IRQn,
119 .speed = I2C_SPEED_NORMAL
120 }
121};
122
123#define I2C_NUMOF ARRAY_SIZE(i2c_config)
124#define I2C_0_ISR isr_i2c0
131#ifndef RTT_FREQUENCY
132#define RTT_FREQUENCY (1U) /* in Hz */
133#endif
140static const spi_dev_t spi_config[] = {
141 {
142 .dev = USART3,
143 .mosi_pin = GPIO_PIN(PA, 0),
144 .miso_pin = GPIO_PIN(PA, 1),
145 .clk_pin = GPIO_PIN(PA, 2),
146 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
147 USART_ROUTELOC0_TXLOC_LOC0 |
148 USART_ROUTELOC0_CLKLOC_LOC0,
149 .cmu = cmuClock_USART3,
150 .irq = USART3_RX_IRQn
151 }
152};
153
154#define SPI_NUMOF ARRAY_SIZE(spi_config)
163static const timer_conf_t timer_config[] = {
164 {
165 .prescaler = {
166 .dev = TIMER0,
167 .cmu = cmuClock_TIMER0
168 },
169 .timer = {
170 .dev = TIMER1,
171 .cmu = cmuClock_TIMER1
172 },
173 .irq = TIMER1_IRQn,
174 .channel_numof = 3
175 },
176 {
177 .prescaler = {
178 .dev = NULL,
179 .cmu = cmuClock_LETIMER0
180 },
181 .timer = {
182 .dev = LETIMER0,
183 .cmu = cmuClock_LETIMER0
184 },
185 .irq = LETIMER0_IRQn,
186 .channel_numof = 2
187 }
188};
189
190#define TIMER_NUMOF ARRAY_SIZE(timer_config)
191#define TIMER_0_ISR isr_timer1
192#define TIMER_1_ISR isr_letimer0
199static const uart_conf_t uart_config[] = {
200 {
201 .dev = USART0,
202 .rx_pin = GPIO_PIN(PE, 6),
203 .tx_pin = GPIO_PIN(PE, 7),
204 .loc = USART_ROUTELOC0_RXLOC_LOC1 |
205 USART_ROUTELOC0_TXLOC_LOC1,
206 .cmu = cmuClock_USART0,
207 .irq = USART0_RX_IRQn
208 },
209 {
210 .dev = UART0,
211 .rx_pin = GPIO_PIN(PC, 5),
212 .tx_pin = GPIO_PIN(PC, 4),
213 .loc = UART_ROUTELOC0_RXLOC_LOC4 |
214 UART_ROUTELOC0_TXLOC_LOC4,
215 .cmu = cmuClock_UART0,
216 .irq = UART0_RX_IRQn
217 }
218};
219
220#define UART_NUMOF ARRAY_SIZE(uart_config)
221#define UART_0_ISR_RX isr_usart0_rx
222#define UART_1_ISR_RX isr_uart0_rx
225#ifdef __cplusplus
226}
227#endif
228
229#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
#define UART0
UART0 register bank.
@ PC
port C
@ PA
port A
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.