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
27#ifdef __cplusplus
28extern "C" {
29#endif
30
35#ifndef CLOCK_HF
36#define CLOCK_HF cmuSelect_HFXO
37#endif
38#ifndef CLOCK_CORE_DIV
39#define CLOCK_CORE_DIV cmuClkDiv_1
40#endif
41#ifndef CLOCK_LFA
42#define CLOCK_LFA cmuSelect_LFXO
43#endif
44#ifndef CLOCK_LFB
45#define CLOCK_LFB cmuSelect_LFXO
46#endif
47#ifndef CLOCK_LFE
48#define CLOCK_LFE cmuSelect_LFXO
49#endif
56static const adc_conf_t adc_config[] = {
57 {
58 .dev = ADC0,
59 .cmu = cmuClock_ADC0,
60 }
61};
62
63static const adc_chan_conf_t adc_channel_config[] = {
64 {
65 .dev = 0,
66 .input = adcPosSelTEMP,
67 .reference = adcRef1V25,
68 .acq_time = adcAcqTime8
69 },
70 {
71 .dev = 0,
72 .input = adcPosSelAVDD,
73 .reference = adcRef5V,
74 .acq_time = adcAcqTime8
75 }
76};
77
78#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
79#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
86static const i2c_conf_t i2c_config[] = {
87 {
88 .dev = I2C0,
89 .sda_pin = GPIO_PIN(PC, 10),
90 .scl_pin = GPIO_PIN(PC, 11),
91 .loc = I2C_ROUTELOC0_SDALOC_LOC15 |
92 I2C_ROUTELOC0_SCLLOC_LOC15,
93 .cmu = cmuClock_I2C0,
94 .irq = I2C0_IRQn,
95 .speed = I2C_SPEED_NORMAL
96 }
97};
98
99#define I2C_NUMOF ARRAY_SIZE(i2c_config)
100#define I2C_0_ISR isr_i2c0
107#ifndef RTT_FREQUENCY
108#define RTT_FREQUENCY (1U) /* in Hz */
109#endif
116static const spi_dev_t spi_config[] = {
117 {
118 .dev = USART2,
119 .mosi_pin = GPIO_PIN(PA, 6),
120 .miso_pin = GPIO_PIN(PA, 7),
121 .clk_pin = GPIO_PIN(PA, 8),
122 .loc = USART_ROUTELOC0_RXLOC_LOC1 |
123 USART_ROUTELOC0_TXLOC_LOC1 |
124 USART_ROUTELOC0_CLKLOC_LOC1,
125 .cmu = cmuClock_USART2,
126 .irq = USART2_RX_IRQn
127 }
128};
129
130#define SPI_NUMOF ARRAY_SIZE(spi_config)
139static const timer_conf_t timer_config[] = {
140 {
141 .prescaler = {
142 .dev = WTIMER0,
143 .cmu = cmuClock_WTIMER0
144 },
145 .timer = {
146 .dev = WTIMER1,
147 .cmu = cmuClock_WTIMER1
148 },
149 .irq = WTIMER1_IRQn,
150 .channel_numof = 3
151 },
152 {
153 .prescaler = {
154 .dev = TIMER0,
155 .cmu = cmuClock_TIMER0
156 },
157 .timer = {
158 .dev = TIMER1,
159 .cmu = cmuClock_TIMER1
160 },
161 .irq = TIMER1_IRQn,
162 .channel_numof = 3
163 },
164 {
165 .prescaler = {
166 .dev = NULL,
167 .cmu = cmuClock_LETIMER0
168 },
169 .timer = {
170 .dev = LETIMER0,
171 .cmu = cmuClock_LETIMER0
172 },
173 .irq = LETIMER0_IRQn,
174 .channel_numof = 2
175 }
176};
177
178#define TIMER_NUMOF ARRAY_SIZE(timer_config)
179#define TIMER_0_ISR isr_wtimer1
180#define TIMER_1_ISR isr_timer1
181#define TIMER_2_ISR isr_letimer0
188static const uart_conf_t uart_config[] = {
189 {
190 .dev = USART0,
191 .rx_pin = GPIO_PIN(PA, 1),
192 .tx_pin = GPIO_PIN(PA, 0),
193 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
194 USART_ROUTELOC0_TXLOC_LOC0,
195 .cmu = cmuClock_USART0,
196 .irq = USART0_RX_IRQn
197 },
198 {
199 .dev = LEUART0,
200 .rx_pin = GPIO_PIN(PD, 11),
201 .tx_pin = GPIO_PIN(PD, 10),
202 .loc = LEUART_ROUTELOC0_RXLOC_LOC18 |
203 LEUART_ROUTELOC0_TXLOC_LOC18,
204 .cmu = cmuClock_LEUART0,
205 .irq = LEUART0_IRQn
206 }
207};
208
209#define UART_NUMOF ARRAY_SIZE(uart_config)
210#define UART_0_ISR_RX isr_usart0_rx
211#define UART_1_ISR_RX isr_leuart0
214#ifdef __cplusplus
215}
216#endif
217
218#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
@ PA
port A
@ PD
port D
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
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