Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015-2020 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include "cpu.h"
20#include "periph_cpu.h"
21#include "em_cmu.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
31#ifndef CLOCK_HF
32#define CLOCK_HF cmuSelect_HFXO
33#endif
34#ifndef CLOCK_CORE_DIV
35#define CLOCK_CORE_DIV cmuClkDiv_1
36#endif
37#ifndef CLOCK_LFA
38#define CLOCK_LFA cmuSelect_LFXO
39#endif
40#ifndef CLOCK_LFB
41#define CLOCK_LFB cmuSelect_LFXO
42#endif
43#ifndef CLOCK_LFE
44#define CLOCK_LFE cmuSelect_LFXO
45#endif
47
52#ifdef EMU_DCDCINIT_OFF
53#error "This option will soft-brick your board. Please remove it."
54#endif
56
61static const adc_conf_t adc_config[] = {
62 {
63 .dev = ADC0,
64 .cmu = cmuClock_ADC0,
65 }
66};
67
68static const adc_chan_conf_t adc_channel_config[] = {
69 {
70 .dev = 0,
71 .input = adcPosSelTEMP,
72 .reference = adcRef1V25,
73 .acq_time = adcAcqTime8
74 },
75 {
76 .dev = 0,
77 .input = adcPosSelAVDD,
78 .reference = adcRef5V,
79 .acq_time = adcAcqTime8
80 }
81};
82
83#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
84#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
86
91static const i2c_conf_t i2c_config[] = {
92 {
93 .dev = I2C0,
94 .sda_pin = GPIO_PIN(PC, 10),
95 .scl_pin = GPIO_PIN(PC, 11),
96 .loc = I2C_ROUTELOC0_SDALOC_LOC15 |
97 I2C_ROUTELOC0_SCLLOC_LOC15,
98 .cmu = cmuClock_I2C0,
99 .irq = I2C0_IRQn,
100 .speed = I2C_SPEED_NORMAL
101 }
102};
103
104#define I2C_NUMOF ARRAY_SIZE(i2c_config)
105#define I2C_0_ISR isr_i2c0
107
112#ifndef RTT_FREQUENCY
113#define RTT_FREQUENCY (1U) /* in Hz */
114#endif
116
121static const spi_dev_t spi_config[] = {
122 {
123 .dev = USART1,
124 .mosi_pin = GPIO_PIN(PC, 6),
125 .miso_pin = GPIO_PIN(PC, 7),
126 .clk_pin = GPIO_PIN(PC, 8),
127 .loc = USART_ROUTELOC0_RXLOC_LOC11 |
128 USART_ROUTELOC0_TXLOC_LOC11 |
129 USART_ROUTELOC0_CLKLOC_LOC11,
130 .cmu = cmuClock_USART1,
131 .irq = USART1_RX_IRQn
132 }
133};
134
135#define SPI_NUMOF ARRAY_SIZE(spi_config)
137
144static const timer_conf_t timer_config[] = {
145 {
146 .prescaler = {
147 .dev = TIMER0,
148 .cmu = cmuClock_TIMER0
149 },
150 .timer = {
151 .dev = TIMER1,
152 .cmu = cmuClock_TIMER1
153 },
154 .irq = TIMER1_IRQn,
155 .channel_numof = 3
156 },
157 {
158 .prescaler = {
159 .dev = NULL,
160 .cmu = cmuClock_LETIMER0
161 },
162 .timer = {
163 .dev = LETIMER0,
164 .cmu = cmuClock_LETIMER0
165 },
166 .irq = LETIMER0_IRQn,
167 .channel_numof = 2
168 }
169};
170
171#define TIMER_NUMOF ARRAY_SIZE(timer_config)
172#define TIMER_0_ISR isr_timer1
173#define TIMER_1_ISR isr_letimer0
175
180static const uart_conf_t uart_config[] = {
181 {
182 .dev = USART0,
183 .rx_pin = GPIO_PIN(PA, 1),
184 .tx_pin = GPIO_PIN(PA, 0),
185 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
186 USART_ROUTELOC0_TXLOC_LOC0,
187 .cmu = cmuClock_USART0,
188 .irq = USART0_RX_IRQn
189 },
190 {
191 .dev = LEUART0,
192 .rx_pin = GPIO_PIN(PD, 11),
193 .tx_pin = GPIO_PIN(PD, 10),
194 .loc = LEUART_ROUTELOC0_RXLOC_LOC18 |
195 LEUART_ROUTELOC0_TXLOC_LOC18,
196 .cmu = cmuClock_LEUART0,
197 .irq = LEUART0_IRQn
198 }
199};
200
201#define UART_NUMOF ARRAY_SIZE(uart_config)
202#define UART_0_ISR_RX isr_usart0_rx
203#define UART_1_ISR_RX isr_leuart0
205
206#ifdef __cplusplus
207}
208#endif
209
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:45
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:277
@ PC
port C
@ PA
port A
@ PD
port D
ADC channel configuration.
Definition periph_cpu.h:385
ADC device configuration.
Definition periph_cpu.h:377
I2C configuration structure.
Definition periph_cpu.h:298
SPI device configuration.
Definition periph_cpu.h:516
Timer device configuration.
Definition periph_cpu.h:263
UART device configuration.
Definition periph_cpu.h:217