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 .speed = I2C_SPEED_NORMAL,
92 .cmu = cmuClock_I2C0,
93 .irq = I2C0_IRQn,
94 .use_internal_pull_ups = true
95 }
96};
97
98#define I2C_NUMOF ARRAY_SIZE(i2c_config)
99#define I2C_0_ISR isr_i2c0
101
106#ifndef RTT_FREQUENCY
107#define RTT_FREQUENCY (1U) /* in Hz */
108#endif
110
115static const spi_dev_t spi_config[] = {
116 {
117 .dev = USART1,
118 .mosi_pin = MODULE_PIN_F16,
119 .miso_pin = MODULE_PIN_P3,
120 .clk_pin = MODULE_PIN_F15,
121 .loc = USART_ROUTELOC0_RXLOC_LOC11 |
122 USART_ROUTELOC0_TXLOC_LOC11 |
123 USART_ROUTELOC0_CLKLOC_LOC11,
124 .cmu = cmuClock_USART1,
125 .irq = USART1_RX_IRQn
126 }
127};
128
129#define SPI_NUMOF ARRAY_SIZE(spi_config)
131
138static const timer_conf_t timer_config[] = {
139 {
140 .prescaler = {
141 .dev = TIMER0,
142 .cmu = cmuClock_TIMER0
143 },
144 .timer = {
145 .dev = TIMER1,
146 .cmu = cmuClock_TIMER1
147 },
148 .irq = TIMER1_IRQn,
149 .channel_numof = 3
150 },
151 {
152 .prescaler = {
153 .dev = NULL,
154 .cmu = cmuClock_LETIMER0
155 },
156 .timer = {
157 .dev = LETIMER0,
158 .cmu = cmuClock_LETIMER0
159 },
160 .irq = LETIMER0_IRQn,
161 .channel_numof = 2
162 }
163};
164
165#define TIMER_NUMOF ARRAY_SIZE(timer_config)
166#define TIMER_0_ISR isr_timer1
167#define TIMER_1_ISR isr_letimer0
169
174static const uart_conf_t uart_config[] = {
175 {
176 .dev = USART0,
177 .rx_pin = MODULE_PIN_F7,
178 .tx_pin = MODULE_PIN_F6,
179 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
180 USART_ROUTELOC0_TXLOC_LOC0,
181 .cmu = cmuClock_USART0,
182 .irq = USART0_RX_IRQn
183 }
184};
185
186#define UART_NUMOF ARRAY_SIZE(uart_config)
187#define UART_0_ISR_RX isr_usart0_rx
189
190#ifdef __cplusplus
191}
192#endif
193
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:274
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