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
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36#ifndef CLOCK_HF
37#define CLOCK_HF cmuSelect_HFXO
38#endif
39#ifndef CLOCK_CORE_DIV
40#define CLOCK_CORE_DIV cmuClkDiv_1
41#endif
42#ifndef CLOCK_LFA
43#define CLOCK_LFA cmuSelect_LFXO
44#endif
45#ifndef CLOCK_LFB
46#define CLOCK_LFB cmuSelect_LFXO
47#endif
54static const adc_conf_t adc_config[] = {
55 {
56 .dev = ADC0,
57 .cmu = cmuClock_ADC0,
58 }
59};
60
61static const adc_chan_conf_t adc_channel_config[] = {
62 {
63 .dev = 0,
64 .input = adcSingleInputTemp,
65 .reference = adcRef1V25,
66 .acq_time = adcAcqTime8
67 },
68 {
69 .dev = 0,
70 .input = adcSingleInputVDDDiv3,
71 .reference = adcRef1V25,
72 .acq_time = adcAcqTime8
73 }
74};
75
76#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
77#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
84static const i2c_conf_t i2c_config[] = {
85 {
86 .dev = I2C0,
87 .sda_pin = GPIO_PIN(PD, 6),
88 .scl_pin = GPIO_PIN(PD, 7),
89 .loc = I2C_ROUTE_LOCATION_LOC1,
90 .cmu = cmuClock_I2C0,
91 .irq = I2C0_IRQn,
92 .speed = I2C_SPEED_NORMAL
93 }
94};
95
96#define I2C_NUMOF ARRAY_SIZE(i2c_config)
97#define I2C_0_ISR isr_i2c0
104#ifndef RTT_FREQUENCY
105#define RTT_FREQUENCY (1U) /* in Hz */
106#endif
113static const spi_dev_t spi_config[] = {
114 {
115 .dev = USART0,
116 .mosi_pin = GPIO_PIN(PE, 10),
117 .miso_pin = GPIO_PIN(PE, 11),
118 .clk_pin = GPIO_PIN(PE, 12),
119 .loc = USART_ROUTE_LOCATION_LOC0,
120 .cmu = cmuClock_USART0,
121 .irq = USART0_RX_IRQn
122 }
123};
124
125#define SPI_NUMOF ARRAY_SIZE(spi_config)
134static const timer_conf_t timer_config[] = {
135 {
136 .prescaler = {
137 .dev = TIMER0,
138 .cmu = cmuClock_TIMER0
139 },
140 .timer = {
141 .dev = TIMER1,
142 .cmu = cmuClock_TIMER1
143 },
144 .irq = TIMER1_IRQn,
145 .channel_numof = 3
146 }
147};
148
149#define TIMER_NUMOF ARRAY_SIZE(timer_config)
150#define TIMER_0_ISR isr_timer1
157static const uart_conf_t uart_config[] = {
158 {
159 .dev = USART1,
160 .rx_pin = GPIO_PIN(PA, 0),
161 .tx_pin = GPIO_PIN(PF, 2),
162 .loc = USART_ROUTE_LOCATION_LOC4,
163 .cmu = cmuClock_USART1,
164 .irq = USART1_RX_IRQn
165 },
166 {
167 .dev = LEUART0,
168 .rx_pin = GPIO_PIN(PD, 5),
169 .tx_pin = GPIO_PIN(PD, 4),
170 .loc = LEUART_ROUTE_LOCATION_LOC0,
171 .cmu = cmuClock_LEUART0,
172 .irq = LEUART0_IRQn
173 }
174};
175
176#define UART_NUMOF ARRAY_SIZE(uart_config)
177#define UART_0_ISR_RX isr_usart1_rx
178#define UART_1_ISR_RX isr_leuart0
181#ifdef __cplusplus
182}
183#endif
184
185#endif /* PERIPH_CONF_H */
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:278
@ PA
port A
@ PD
port D
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