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(PD, 6),
86 .scl_pin = GPIO_PIN(PD, 7),
87 .loc = I2C_ROUTELOC0_SDALOC_LOC1 |
88 I2C_ROUTELOC0_SCLLOC_LOC1,
89 .speed = I2C_SPEED_NORMAL,
90 .cmu = cmuClock_I2C0,
91 .irq = I2C0_IRQn,
92 .use_internal_pull_ups = true
93 }
94};
95
96#define I2C_NUMOF ARRAY_SIZE(i2c_config)
97#define I2C_0_ISR isr_i2c0
99
104#ifndef RTT_FREQUENCY
105# define RTT_FREQUENCY (1U) /* in Hz */
106#endif
108
113static const spi_dev_t spi_config[] = {
114 {
115 .dev = USART0,
116 .mosi_pin = GPIO_PIN(PC, 11),
117 .miso_pin = GPIO_PIN(PC, 10),
118 .clk_pin = GPIO_PIN(PA, 12),
119 .loc = USART_ROUTELOC0_RXLOC_LOC2 |
120 USART_ROUTELOC0_TXLOC_LOC2 |
121 USART_ROUTELOC0_CLKLOC_LOC5,
122 .cmu = cmuClock_USART0,
123 .irq = USART0_IRQn
124 }
125};
126
127#define SPI_NUMOF ARRAY_SIZE(spi_config)
129
136static const timer_conf_t timer_config[] = {
137 {
138 .prescaler = {
139 .dev = TIMER0,
140 .cmu = cmuClock_TIMER0
141 },
142 .timer = {
143 .dev = TIMER1,
144 .cmu = cmuClock_TIMER1
145 },
146 .irq = TIMER1_IRQn,
147 .channel_numof = 3
148 },
149 {
150 .prescaler = {
151 .dev = NULL,
152 .cmu = cmuClock_LETIMER0
153 },
154 .timer = {
155 .dev = LETIMER0,
156 .cmu = cmuClock_LETIMER0
157 },
158 .irq = LETIMER0_IRQn,
159 .channel_numof = 2
160 }
161};
162
163#define TIMER_NUMOF ARRAY_SIZE(timer_config)
164#define TIMER_0_ISR isr_timer1
165#define TIMER_1_ISR isr_letimer0
167
172static const uart_conf_t uart_config[] = {
173 {
174 .dev = USART1,
175 .rx_pin = GPIO_PIN(PD, 1),
176 .tx_pin = GPIO_PIN(PD, 0),
177 .loc = USART_ROUTELOC0_RXLOC_LOC1 |
178 USART_ROUTELOC0_TXLOC_LOC1,
179 .cmu = cmuClock_USART1,
180 .irq = USART1_IRQn
181 },
182 {
183 .dev = LEUART0,
184 .rx_pin = GPIO_PIN(PC, 15),
185 .tx_pin = GPIO_PIN(PC, 14),
186 .loc = LEUART_ROUTELOC0_RXLOC_LOC5 |
187 LEUART_ROUTELOC0_TXLOC_LOC5,
188 .cmu = cmuClock_LEUART0,
189 .irq = LEUART0_IRQn
190 }
191};
192
193#define UART_NUMOF ARRAY_SIZE(uart_config)
194#define UART_0_ISR_RX isr_usart1
195#define UART_1_ISR_RX isr_leuart0
197
198#ifdef __cplusplus
199}
200#endif
201
#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:383
ADC device configuration.
Definition periph_cpu.h:375
I2C configuration structure.
Definition periph_cpu.h:295
SPI device configuration.
Definition periph_cpu.h:515
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214