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
24#ifdef __cplusplus
25extern "C" {
26#endif
27
32#ifndef CLOCK_HF
33#define CLOCK_HF cmuSelect_HFXO
34#endif
35#ifndef CLOCK_CORE_DIV
36#define CLOCK_CORE_DIV cmuClkDiv_1
37#endif
38#ifndef CLOCK_LFA
39#define CLOCK_LFA cmuSelect_LFRCO
40#endif
41#ifndef CLOCK_LFB
42#define CLOCK_LFB cmuSelect_LFRCO
43#endif
44#ifndef CLOCK_LFE
45#define CLOCK_LFE cmuSelect_LFRCO
46#endif
48
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 = adcPosSelTEMP,
64 .reference = adcRef1V25,
65 .acq_time = adcAcqTime8
66 },
67 {
68 .dev = 0,
69 .input = adcPosSelAVDD,
70 .reference = adcRef5V,
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)
78
83#ifndef RTT_FREQUENCY
84#define RTT_FREQUENCY (1U) /* in Hz */
85#endif
87
94static const timer_conf_t timer_config[] = {
95 {
96 .prescaler = {
97 .dev = TIMER0,
98 .cmu = cmuClock_TIMER0
99 },
100 .timer = {
101 .dev = TIMER1,
102 .cmu = cmuClock_TIMER1
103 },
104 .irq = TIMER1_IRQn,
105 .channel_numof = 3
106 },
107 {
108 .prescaler = {
109 .dev = NULL,
110 .cmu = cmuClock_LETIMER0
111 },
112 .timer = {
113 .dev = LETIMER0,
114 .cmu = cmuClock_LETIMER0
115 },
116 .irq = LETIMER0_IRQn,
117 .channel_numof = 2
118 }
119};
120
121#define TIMER_NUMOF ARRAY_SIZE(timer_config)
122#define TIMER_0_ISR isr_timer1
123#define TIMER_1_ISR isr_letimer0
125
130static const uart_conf_t uart_config[] = {
131 {
132 .dev = USART0,
133 .rx_pin = GPIO_PIN(PA, 1),
134 .tx_pin = GPIO_PIN(PA, 0),
135 .loc = USART_ROUTELOC0_RXLOC_LOC0 |
136 USART_ROUTELOC0_TXLOC_LOC0,
137 .cmu = cmuClock_USART0,
138 .irq = USART0_RX_IRQn
139 }
140};
141
142#define UART_NUMOF ARRAY_SIZE(uart_config)
143#define UART_0_ISR_RX isr_usart0_rx
145
146#ifdef __cplusplus
147}
148#endif
149
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
@ PA
port A
ADC channel configuration.
Definition periph_cpu.h:382
ADC device configuration.
Definition periph_cpu.h:374
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214