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 .speed = I2C_SPEED_NORMAL,
99 .cmu = cmuClock_I2C0,
100 .irq = I2C0_IRQn,
101 .use_internal_pull_ups = true
102 }
103};
104
105#define I2C_NUMOF ARRAY_SIZE(i2c_config)
106#define I2C_0_ISR isr_i2c0
108
113#ifndef RTT_FREQUENCY
114#define RTT_FREQUENCY (1U) /* in Hz */
115#endif
117
122static const spi_dev_t spi_config[] = {
123 {
124 .dev = USART1,
125 .mosi_pin = GPIO_PIN(PC, 6),
126 .miso_pin = GPIO_PIN(PC, 7),
127 .clk_pin = GPIO_PIN(PC, 8),
128 .loc = USART_ROUTELOC0_RXLOC_LOC11 |
129 USART_ROUTELOC0_TXLOC_LOC11 |
130 USART_ROUTELOC0_CLKLOC_LOC11,
131 .cmu = cmuClock_USART1,
132 .irq = USART1_RX_IRQn
133 }
134};
135
136#define SPI_NUMOF ARRAY_SIZE(spi_config)
138
145static const timer_conf_t timer_config[] = {
146 {
147 .prescaler = {
148 .dev = TIMER0,
149 .cmu = cmuClock_TIMER0
150 },
151 .timer = {
152 .dev = TIMER1,
153 .cmu = cmuClock_TIMER1
154 },
155 .irq = TIMER1_IRQn,
156 .channel_numof = 3
157 },
158 {
159 .prescaler = {
160 .dev = NULL,
161 .cmu = cmuClock_LETIMER0
162 },
163 .timer = {
164 .dev = LETIMER0,
165 .cmu = cmuClock_LETIMER0
166 },
167 .irq = LETIMER0_IRQn,
168 .channel_numof = 2
169 }
170};
171
172#define TIMER_NUMOF ARRAY_SIZE(timer_config)
173#define TIMER_0_ISR isr_timer1
174#define TIMER_1_ISR isr_letimer0
176
181static const uart_conf_t uart_config[] = {
182 {
183 .dev = USART0,
184 .rx_pin = GPIO_PIN(PA, 1),
185 .tx_pin = GPIO_PIN(PA, 0),
186 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
187 USART_ROUTELOC0_TXLOC_LOC0,
188 .cmu = cmuClock_USART0,
189 .irq = USART0_RX_IRQn
190 },
191 {
192 .dev = LEUART0,
193 .rx_pin = GPIO_PIN(PD, 11),
194 .tx_pin = GPIO_PIN(PD, 10),
195 .loc = LEUART_ROUTELOC0_RXLOC_LOC18 |
196 LEUART_ROUTELOC0_TXLOC_LOC18,
197 .cmu = cmuClock_LEUART0,
198 .irq = LEUART0_IRQn
199 }
200};
201
202#define UART_NUMOF ARRAY_SIZE(uart_config)
203#define UART_0_ISR_RX isr_usart0_rx
204#define UART_1_ISR_RX isr_leuart0
206
207#ifdef __cplusplus
208}
209#endif
210
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:274
@ PC
port C
@ PA
port A
@ PD
port D
ADC channel configuration.
Definition periph_cpu.h:382
ADC device configuration.
Definition periph_cpu.h:374
I2C configuration structure.
Definition periph_cpu.h:295
SPI device configuration.
Definition periph_cpu.h:514
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214