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
20#ifndef PERIPH_CONF_H
21#define PERIPH_CONF_H
22
23#include "cpu.h"
24#include "periph_cpu.h"
25#include "em_cmu.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
35#ifndef CLOCK_HF
36#define CLOCK_HF cmuSelect_HFXO
37#endif
38#ifndef CLOCK_CORE_DIV
39#define CLOCK_CORE_DIV cmuClkDiv_1
40#endif
41#ifndef CLOCK_LFA
42#define CLOCK_LFA cmuSelect_LFXO
43#endif
44#ifndef CLOCK_LFB
45#define CLOCK_LFB cmuSelect_CORELEDIV2
46#endif
53static const adc_conf_t adc_config[] = {
54 {
55 .dev = ADC0,
56 .cmu = cmuClock_ADC0,
57 }
58};
59
60static const adc_chan_conf_t adc_channel_config[] = {
61 {
62 .dev = 0,
63 .input = adcSingleInputTemp,
64 .reference = adcRef1V25,
65 .acq_time = adcAcqTime8
66 },
67 {
68 .dev = 0,
69 .input = adcSingleInputVDDDiv3,
70 .reference = adcRef1V25,
71 .acq_time = adcAcqTime8
72 }
73};
74
75#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
76#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
83static const i2c_conf_t i2c_config[] = {
84 {
85 .dev = I2C0,
86 .sda_pin = GPIO_PIN(PE, 12),
87 .scl_pin = GPIO_PIN(PE, 13),
88 .loc = I2C_ROUTE_LOCATION_LOC6,
89 .cmu = cmuClock_I2C0,
90 .irq = I2C0_IRQn,
91 .speed = I2C_SPEED_NORMAL
92 }
93};
94
95#define I2C_NUMOF ARRAY_SIZE(i2c_config)
96#define I2C_0_ISR isr_i2c0
103#ifndef RTT_FREQUENCY
104#define RTT_FREQUENCY (1U) /* in Hz */
105#endif
113static const spi_dev_t spi_config[] = {
114 {
115 .dev = USART1,
116 .mosi_pin = GPIO_PIN(PD, 7),
117 .miso_pin = GPIO_PIN(PD, 6),
118 .clk_pin = GPIO_PIN(PC, 15),
119/* page 81 https://www.silabs.com/documents/public/data-sheets/efm32zg-datasheet.pdf */
120 .loc = USART_ROUTE_LOCATION_LOC3,
121 .cmu = cmuClock_USART1,
122 .irq = USART1_RX_IRQn
123 }
124};
125
126#define SPI_NUMOF ARRAY_SIZE(spi_config)
135static const timer_conf_t timer_config[] = {
136 {
137 .prescaler = {
138 .dev = TIMER0,
139 .cmu = cmuClock_TIMER0
140 },
141 .timer = {
142 .dev = TIMER1,
143 .cmu = cmuClock_TIMER1
144 },
145 .irq = TIMER1_IRQn,
146 .channel_numof = 3
147 }
148};
149
150#define TIMER_NUMOF ARRAY_SIZE(timer_config)
151#define TIMER_0_ISR isr_timer1
158static const uart_conf_t uart_config[] = {
159 {
160 .dev = LEUART0,
161 .rx_pin = GPIO_PIN(PD, 5),
162 .tx_pin = GPIO_PIN(PD, 4),
163 .loc = LEUART_ROUTE_LOCATION_LOC0,
164 .cmu = cmuClock_LEUART0,
165 .irq = LEUART0_IRQn
166 }
167};
168
169#define UART_NUMOF ARRAY_SIZE(uart_config)
170#define UART_0_ISR_RX isr_leuart0
173#ifdef __cplusplus
174}
175#endif
176
177#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
@ PC
port C
@ 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