Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015-2020 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
21#ifndef PERIPH_CONF_H
22#define PERIPH_CONF_H
23
24#include "cpu.h"
25#include "periph_cpu.h"
26#include "em_cmu.h"
27#include "board_module.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
37#ifndef CLOCK_HF
38#define CLOCK_HF cmuSelect_HFXO
39#endif
40#ifndef CLOCK_CORE_DIV
41#define CLOCK_CORE_DIV cmuClkDiv_1
42#endif
43#ifndef CLOCK_LFA
44#define CLOCK_LFA cmuSelect_LFRCO
45#endif
46#ifndef CLOCK_LFB
47#define CLOCK_LFB cmuSelect_LFRCO
48#endif
49#ifndef CLOCK_LFE
50#define CLOCK_LFE cmuSelect_LFRCO
51#endif
58static const adc_conf_t adc_config[] = {
59 {
60 .dev = ADC0,
61 .cmu = cmuClock_ADC0,
62 }
63};
64
65static const adc_chan_conf_t adc_channel_config[] = {
66 {
67 .dev = 0,
68 .input = adcPosSelTEMP,
69 .reference = adcRef1V25,
70 .acq_time = adcAcqTime8
71 },
72 {
73 .dev = 0,
74 .input = adcPosSelAVDD,
75 .reference = adcRef5V,
76 .acq_time = adcAcqTime8
77 }
78};
79
80#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
81#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
88static const i2c_conf_t i2c_config[] = {
89 {
90 .dev = I2C0,
91 .sda_pin = MODULE_PIN_P13,
92 .scl_pin = MODULE_PIN_P12,
93 .loc = I2C_ROUTELOC0_SDALOC_LOC16 |
94 I2C_ROUTELOC0_SCLLOC_LOC14,
95 .cmu = cmuClock_I2C0,
96 .irq = I2C0_IRQn,
97 .speed = I2C_SPEED_NORMAL
98 }
99};
100
101#define I2C_NUMOF ARRAY_SIZE(i2c_config)
102#define I2C_0_ISR isr_i2c0
109#ifndef RTT_FREQUENCY
110#define RTT_FREQUENCY (1U) /* in Hz */
111#endif
118static const spi_dev_t spi_config[] = {
119 {
120 .dev = USART1,
121 .mosi_pin = MODULE_PIN_F16,
122 .miso_pin = MODULE_PIN_P3,
123 .clk_pin = MODULE_PIN_F15,
124 .loc = USART_ROUTELOC0_RXLOC_LOC11 |
125 USART_ROUTELOC0_TXLOC_LOC11 |
126 USART_ROUTELOC0_CLKLOC_LOC11,
127 .cmu = cmuClock_USART1,
128 .irq = USART1_RX_IRQn
129 }
130};
131
132#define SPI_NUMOF ARRAY_SIZE(spi_config)
141static const timer_conf_t timer_config[] = {
142 {
143 .prescaler = {
144 .dev = TIMER0,
145 .cmu = cmuClock_TIMER0
146 },
147 .timer = {
148 .dev = TIMER1,
149 .cmu = cmuClock_TIMER1
150 },
151 .irq = TIMER1_IRQn,
152 .channel_numof = 3
153 },
154 {
155 .prescaler = {
156 .dev = NULL,
157 .cmu = cmuClock_LETIMER0
158 },
159 .timer = {
160 .dev = LETIMER0,
161 .cmu = cmuClock_LETIMER0
162 },
163 .irq = LETIMER0_IRQn,
164 .channel_numof = 2
165 }
166};
167
168#define TIMER_NUMOF ARRAY_SIZE(timer_config)
169#define TIMER_0_ISR isr_timer1
170#define TIMER_1_ISR isr_letimer0
177static const uart_conf_t uart_config[] = {
178 {
179 .dev = USART0,
180 .rx_pin = MODULE_PIN_F7,
181 .tx_pin = MODULE_PIN_F6,
182 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
183 USART_ROUTELOC0_TXLOC_LOC0,
184 .cmu = cmuClock_USART0,
185 .irq = USART0_RX_IRQn
186 }
187};
188
189#define UART_NUMOF ARRAY_SIZE(uart_config)
190#define UART_0_ISR_RX isr_usart0_rx
193#ifdef __cplusplus
194}
195#endif
196
197#endif /* PERIPH_CONF_H */
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:278
ADC channel configuration.
Definition periph_cpu.h:387
uint8_t dev
device index
Definition periph_cpu.h:388
ADC device configuration.
Definition periph_cpu.h:379
ADC_TypeDef * dev
ADC device used.
Definition periph_cpu.h:380
I2C configuration structure.
Definition periph_cpu.h:299
TWI_t * dev
Pointer to hardware module registers.
Definition periph_cpu.h:300
SPI device configuration.
Definition periph_cpu.h:518
USART_TypeDef * dev
USART device used.
Definition periph_cpu.h:519
Timer device configuration.
Definition periph_cpu.h:264
timer_dev_t prescaler
the lower neighboring timer (not initialized for LETIMER)
Definition periph_cpu.h:557
void * dev
TIMER_TypeDef or LETIMER_TypeDef device used.
Definition periph_cpu.h:550
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219