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
19
20#include "cpu.h"
21#include "periph_cpu.h"
22#include "em_cmu.h"
23#include "board_module.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
33#ifndef CLOCK_HF
34#define CLOCK_HF cmuSelect_HFXO
35#endif
36#ifndef CLOCK_CORE_DIV
37#define CLOCK_CORE_DIV cmuClkDiv_1
38#endif
39#ifndef CLOCK_LFA
40#define CLOCK_LFA cmuSelect_LFRCO
41#endif
42#ifndef CLOCK_LFB
43#define CLOCK_LFB cmuSelect_LFRCO
44#endif
45#ifndef CLOCK_LFE
46#define CLOCK_LFE cmuSelect_LFRCO
47#endif
49
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 = adcPosSelTEMP,
65 .reference = adcRef1V25,
66 .acq_time = adcAcqTime8
67 },
68 {
69 .dev = 0,
70 .input = adcPosSelAVDD,
71 .reference = adcRef5V,
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)
79
84static const i2c_conf_t i2c_config[] = {
85 {
86 .dev = I2C0,
87 .sda_pin = MODULE_PIN_P13,
88 .scl_pin = MODULE_PIN_P12,
89 .loc = I2C_ROUTELOC0_SDALOC_LOC16 |
90 I2C_ROUTELOC0_SCLLOC_LOC14,
91 .cmu = cmuClock_I2C0,
92 .irq = I2C0_IRQn,
93 .speed = I2C_SPEED_NORMAL
94 }
95};
96
97#define I2C_NUMOF ARRAY_SIZE(i2c_config)
98#define I2C_0_ISR isr_i2c0
100
105#ifndef RTT_FREQUENCY
106#define RTT_FREQUENCY (1U) /* in Hz */
107#endif
109
114static const spi_dev_t spi_config[] = {
115 {
116 .dev = USART1,
117 .mosi_pin = MODULE_PIN_F16,
118 .miso_pin = MODULE_PIN_P3,
119 .clk_pin = MODULE_PIN_F15,
120 .loc = USART_ROUTELOC0_RXLOC_LOC11 |
121 USART_ROUTELOC0_TXLOC_LOC11 |
122 USART_ROUTELOC0_CLKLOC_LOC11,
123 .cmu = cmuClock_USART1,
124 .irq = USART1_RX_IRQn
125 }
126};
127
128#define SPI_NUMOF ARRAY_SIZE(spi_config)
130
137static const timer_conf_t timer_config[] = {
138 {
139 .prescaler = {
140 .dev = TIMER0,
141 .cmu = cmuClock_TIMER0
142 },
143 .timer = {
144 .dev = TIMER1,
145 .cmu = cmuClock_TIMER1
146 },
147 .irq = TIMER1_IRQn,
148 .channel_numof = 3
149 },
150 {
151 .prescaler = {
152 .dev = NULL,
153 .cmu = cmuClock_LETIMER0
154 },
155 .timer = {
156 .dev = LETIMER0,
157 .cmu = cmuClock_LETIMER0
158 },
159 .irq = LETIMER0_IRQn,
160 .channel_numof = 2
161 }
162};
163
164#define TIMER_NUMOF ARRAY_SIZE(timer_config)
165#define TIMER_0_ISR isr_timer1
166#define TIMER_1_ISR isr_letimer0
168
173static const uart_conf_t uart_config[] = {
174 {
175 .dev = USART0,
176 .rx_pin = MODULE_PIN_F7,
177 .tx_pin = MODULE_PIN_F6,
178 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
179 USART_ROUTELOC0_TXLOC_LOC0,
180 .cmu = cmuClock_USART0,
181 .irq = USART0_RX_IRQn
182 }
183};
184
185#define UART_NUMOF ARRAY_SIZE(uart_config)
186#define UART_0_ISR_RX isr_usart0_rx
188
189#ifdef __cplusplus
190}
191#endif
192
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:277
ADC channel configuration.
Definition periph_cpu.h:385
ADC device configuration.
Definition periph_cpu.h:377
I2C configuration structure.
Definition periph_cpu.h:298
SPI device configuration.
Definition periph_cpu.h:516
Timer device configuration.
Definition periph_cpu.h:263
UART device configuration.
Definition periph_cpu.h:217