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 .speed = I2C_SPEED_NORMAL,
87 .cmu = cmuClock_I2C0,
88 .irq = I2C0_IRQn,
89 .use_internal_pull_ups = true
90 }
91};
92
93#define I2C_NUMOF ARRAY_SIZE(i2c_config)
94#define I2C_0_ISR isr_i2c0
96
101#ifndef RTT_FREQUENCY
102#define RTT_FREQUENCY (1U) /* in Hz */
103#endif
105
110static const spi_dev_t spi_config[] = {
111 {
112 .dev = USART0,
113 .mosi_pin = GPIO_PIN(PE, 10),
114 .miso_pin = GPIO_PIN(PE, 11),
115 .clk_pin = GPIO_PIN(PE, 12),
116 .loc = USART_ROUTE_LOCATION_LOC0,
117 .cmu = cmuClock_USART0,
118 .irq = USART0_RX_IRQn
119 }
120};
121
122#define SPI_NUMOF ARRAY_SIZE(spi_config)
124
131static const timer_conf_t timer_config[] = {
132 {
133 .prescaler = {
134 .dev = TIMER0,
135 .cmu = cmuClock_TIMER0
136 },
137 .timer = {
138 .dev = TIMER1,
139 .cmu = cmuClock_TIMER1
140 },
141 .irq = TIMER1_IRQn,
142 .channel_numof = 3
143 }
144};
145
146#define TIMER_NUMOF ARRAY_SIZE(timer_config)
147#define TIMER_0_ISR isr_timer1
149
154static const uart_conf_t uart_config[] = {
155 {
156 .dev = USART1,
157 .rx_pin = GPIO_PIN(PA, 0),
158 .tx_pin = GPIO_PIN(PF, 2),
159 .loc = USART_ROUTE_LOCATION_LOC4,
160 .cmu = cmuClock_USART1,
161 .irq = USART1_RX_IRQn
162 },
163 {
164 .dev = LEUART0,
165 .rx_pin = GPIO_PIN(PD, 5),
166 .tx_pin = GPIO_PIN(PD, 4),
167 .loc = LEUART_ROUTE_LOCATION_LOC0,
168 .cmu = cmuClock_LEUART0,
169 .irq = LEUART0_IRQn
170 }
171};
172
173#define UART_NUMOF ARRAY_SIZE(uart_config)
174#define UART_0_ISR_RX isr_usart1_rx
175#define UART_1_ISR_RX isr_leuart0
177
178#ifdef __cplusplus
179}
180#endif
181
#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:514
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214