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_CORELEDIV2
42#endif
44
49static const adc_conf_t adc_config[] = {
50 {
51 .dev = ADC0,
52 .cmu = cmuClock_ADC0,
53 }
54};
55
56static const adc_chan_conf_t adc_channel_config[] = {
57 {
58 .dev = 0,
59 .input = adcSingleInputTemp,
60 .reference = adcRef1V25,
61 .acq_time = adcAcqTime8
62 },
63 {
64 .dev = 0,
65 .input = adcSingleInputVDDDiv3,
66 .reference = adcRef1V25,
67 .acq_time = adcAcqTime8
68 }
69};
70
71#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
72#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
74
79static const i2c_conf_t i2c_config[] = {
80 {
81 .dev = I2C0,
82 .sda_pin = GPIO_PIN(PE, 12),
83 .scl_pin = GPIO_PIN(PE, 13),
84 .loc = I2C_ROUTE_LOCATION_LOC6,
85 .speed = I2C_SPEED_NORMAL,
86 .cmu = cmuClock_I2C0,
87 .irq = I2C0_IRQn,
88 .use_internal_pull_ups = true
89 }
90};
91
92#define I2C_NUMOF ARRAY_SIZE(i2c_config)
93#define I2C_0_ISR isr_i2c0
95
100#ifndef RTT_FREQUENCY
101#define RTT_FREQUENCY (1U) /* in Hz */
102#endif
104
110static const spi_dev_t spi_config[] = {
111 {
112 .dev = USART1,
113 .mosi_pin = GPIO_PIN(PD, 7),
114 .miso_pin = GPIO_PIN(PD, 6),
115 .clk_pin = GPIO_PIN(PC, 15),
116/* page 81 https://www.silabs.com/documents/public/data-sheets/efm32zg-datasheet.pdf */
117 .loc = USART_ROUTE_LOCATION_LOC3,
118 .cmu = cmuClock_USART1,
119 .irq = USART1_RX_IRQn
120 }
121};
122
123#define SPI_NUMOF ARRAY_SIZE(spi_config)
125
132static const timer_conf_t timer_config[] = {
133 {
134 .prescaler = {
135 .dev = TIMER0,
136 .cmu = cmuClock_TIMER0
137 },
138 .timer = {
139 .dev = TIMER1,
140 .cmu = cmuClock_TIMER1
141 },
142 .irq = TIMER1_IRQn,
143 .channel_numof = 3
144 }
145};
146
147#define TIMER_NUMOF ARRAY_SIZE(timer_config)
148#define TIMER_0_ISR isr_timer1
150
155static const uart_conf_t uart_config[] = {
156 {
157 .dev = LEUART0,
158 .rx_pin = GPIO_PIN(PD, 5),
159 .tx_pin = GPIO_PIN(PD, 4),
160 .loc = LEUART_ROUTE_LOCATION_LOC0,
161 .cmu = cmuClock_LEUART0,
162 .irq = LEUART0_IRQn
163 }
164};
165
166#define UART_NUMOF ARRAY_SIZE(uart_config)
167#define UART_0_ISR_RX isr_leuart0
169
170#ifdef __cplusplus
171}
172#endif
173
#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
@ 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