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
19
20#include "cpu.h"
21#include "periph_cpu.h"
22#include "em_cmu.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
32#ifndef CLOCK_HF
33#define CLOCK_HF cmuSelect_HFXO
34#endif
35#ifndef CLOCK_CORE_DIV
36#define CLOCK_CORE_DIV cmuClkDiv_1
37#endif
38#ifndef CLOCK_LFA
39#define CLOCK_LFA cmuSelect_LFXO
40#endif
41#ifndef CLOCK_LFB
42#define CLOCK_LFB cmuSelect_LFXO
43#endif
45
50static const adc_conf_t adc_config[] = {
51 {
52 .dev = ADC0,
53 .cmu = cmuClock_ADC0,
54 }
55};
56
57static const adc_chan_conf_t adc_channel_config[] = {
58 {
59 .dev = 0,
60 .input = adcSingleInputTemp,
61 .reference = adcRef1V25,
62 .acq_time = adcAcqTime8
63 },
64 {
65 .dev = 0,
66 .input = adcSingleInputVDDDiv3,
67 .reference = adcRef1V25,
68 .acq_time = adcAcqTime8
69 }
70};
71
72#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
73#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
75
80static const i2c_conf_t i2c_config[] = {
81 {
82 .dev = I2C0,
83 .sda_pin = GPIO_PIN(PD, 6),
84 .scl_pin = GPIO_PIN(PD, 7),
85 .loc = I2C_ROUTE_LOCATION_LOC1,
86 .cmu = cmuClock_I2C0,
87 .irq = I2C0_IRQn,
88 .speed = I2C_SPEED_NORMAL
89 }
90};
91
92#define I2C_NUMOF ARRAY_SIZE(i2c_config)
93#define I2C_0_ISR isr_i2c0
95
100#ifndef RTT_FREQUENCY
101#define RTT_FREQUENCY (1U) /* in Hz */
102#endif
104
109static const spi_dev_t spi_config[] = {
110 {
111 .dev = USART0,
112 .mosi_pin = GPIO_PIN(PE, 10),
113 .miso_pin = GPIO_PIN(PE, 11),
114 .clk_pin = GPIO_PIN(PE, 12),
115 .loc = USART_ROUTE_LOCATION_LOC0,
116 .cmu = cmuClock_USART0,
117 .irq = USART0_RX_IRQn
118 }
119};
120
121#define SPI_NUMOF ARRAY_SIZE(spi_config)
123
130static const timer_conf_t timer_config[] = {
131 {
132 .prescaler = {
133 .dev = TIMER0,
134 .cmu = cmuClock_TIMER0
135 },
136 .timer = {
137 .dev = TIMER1,
138 .cmu = cmuClock_TIMER1
139 },
140 .irq = TIMER1_IRQn,
141 .channel_numof = 3
142 }
143};
144
145#define TIMER_NUMOF ARRAY_SIZE(timer_config)
146#define TIMER_0_ISR isr_timer1
148
153static const uart_conf_t uart_config[] = {
154 {
155 .dev = USART1,
156 .rx_pin = GPIO_PIN(PA, 0),
157 .tx_pin = GPIO_PIN(PF, 2),
158 .loc = USART_ROUTE_LOCATION_LOC4,
159 .cmu = cmuClock_USART1,
160 .irq = USART1_RX_IRQn
161 },
162 {
163 .dev = LEUART0,
164 .rx_pin = GPIO_PIN(PD, 5),
165 .tx_pin = GPIO_PIN(PD, 4),
166 .loc = LEUART_ROUTE_LOCATION_LOC0,
167 .cmu = cmuClock_LEUART0,
168 .irq = LEUART0_IRQn
169 }
170};
171
172#define UART_NUMOF ARRAY_SIZE(uart_config)
173#define UART_0_ISR_RX isr_usart1_rx
174#define UART_1_ISR_RX isr_leuart0
176
177#ifdef __cplusplus
178}
179#endif
180
#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
@ 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