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
52static const adc_conf_t adc_config[] = {
53 {
54 .dev = ADC0,
55 .cmu = cmuClock_ADC0,
56 }
57};
58
59static const adc_chan_conf_t adc_channel_config[] = {
60 {
61 .dev = 0,
62 .input = adcPosSelTEMP,
63 .reference = adcRef1V25,
64 .acq_time = adcAcqTime8
65 },
66 {
67 .dev = 0,
68 .input = adcPosSelAVDD,
69 .reference = adcRef5V,
70 .acq_time = adcAcqTime8
71 }
72};
73
74#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
75#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
77
82static const i2c_conf_t i2c_config[] = {
83 {
84 .dev = I2C0,
85 .sda_pin = GPIO_PIN(PC, 10),
86 .scl_pin = GPIO_PIN(PC, 11),
87 .loc = I2C_ROUTELOC0_SDALOC_LOC15 |
88 I2C_ROUTELOC0_SCLLOC_LOC15,
89 .cmu = cmuClock_I2C0,
90 .irq = I2C0_IRQn,
91 .speed = I2C_SPEED_NORMAL
92 }
93};
94
95#define I2C_NUMOF ARRAY_SIZE(i2c_config)
96#define I2C_0_ISR isr_i2c0
98
103#ifndef RTT_FREQUENCY
104#define RTT_FREQUENCY (1U) /* in Hz */
105#endif
107
112static const spi_dev_t spi_config[] = {
113 {
114 .dev = USART2,
115 .mosi_pin = GPIO_PIN(PA, 6),
116 .miso_pin = GPIO_PIN(PA, 7),
117 .clk_pin = GPIO_PIN(PA, 8),
118 .loc = USART_ROUTELOC0_RXLOC_LOC1 |
119 USART_ROUTELOC0_TXLOC_LOC1 |
120 USART_ROUTELOC0_CLKLOC_LOC1,
121 .cmu = cmuClock_USART2,
122 .irq = USART2_RX_IRQn
123 }
124};
125
126#define SPI_NUMOF ARRAY_SIZE(spi_config)
128
135static const timer_conf_t timer_config[] = {
136 {
137 .prescaler = {
138 .dev = WTIMER0,
139 .cmu = cmuClock_WTIMER0
140 },
141 .timer = {
142 .dev = WTIMER1,
143 .cmu = cmuClock_WTIMER1
144 },
145 .irq = WTIMER1_IRQn,
146 .channel_numof = 3
147 },
148 {
149 .prescaler = {
150 .dev = TIMER0,
151 .cmu = cmuClock_TIMER0
152 },
153 .timer = {
154 .dev = TIMER1,
155 .cmu = cmuClock_TIMER1
156 },
157 .irq = TIMER1_IRQn,
158 .channel_numof = 3
159 },
160 {
161 .prescaler = {
162 .dev = NULL,
163 .cmu = cmuClock_LETIMER0
164 },
165 .timer = {
166 .dev = LETIMER0,
167 .cmu = cmuClock_LETIMER0
168 },
169 .irq = LETIMER0_IRQn,
170 .channel_numof = 2
171 }
172};
173
174#define TIMER_NUMOF ARRAY_SIZE(timer_config)
175#define TIMER_0_ISR isr_wtimer1
176#define TIMER_1_ISR isr_timer1
177#define TIMER_2_ISR isr_letimer0
179
184static const uart_conf_t uart_config[] = {
185 {
186 .dev = USART0,
187 .rx_pin = GPIO_PIN(PA, 1),
188 .tx_pin = GPIO_PIN(PA, 0),
189 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
190 USART_ROUTELOC0_TXLOC_LOC0,
191 .cmu = cmuClock_USART0,
192 .irq = USART0_RX_IRQn
193 },
194 {
195 .dev = LEUART0,
196 .rx_pin = GPIO_PIN(PD, 11),
197 .tx_pin = GPIO_PIN(PD, 10),
198 .loc = LEUART_ROUTELOC0_RXLOC_LOC18 |
199 LEUART_ROUTELOC0_TXLOC_LOC18,
200 .cmu = cmuClock_LEUART0,
201 .irq = LEUART0_IRQn
202 }
203};
204
205#define UART_NUMOF ARRAY_SIZE(uart_config)
206#define UART_0_ISR_RX isr_usart0_rx
207#define UART_1_ISR_RX isr_leuart0
209
210#ifdef __cplusplus
211}
212#endif
213
#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:513
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214