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 
9 #pragma once
10 
23 #include "cpu.h"
24 #include "periph_cpu.h"
25 #include "em_cmu.h"
26 
27 #ifdef __cplusplus
28 extern "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_LFRCO
43 #endif
44 #ifndef CLOCK_LFB
45 #define CLOCK_LFB cmuSelect_LFRCO
46 #endif
47 #ifndef CLOCK_LFE
48 #define CLOCK_LFE cmuSelect_LFRCO
49 #endif
56 static const adc_conf_t adc_config[] = {
57  {
58  .dev = ADC0,
59  .cmu = cmuClock_ADC0,
60  }
61 };
62 
63 static const adc_chan_conf_t adc_channel_config[] = {
64  {
65  .dev = 0,
66  .input = adcPosSelTEMP,
67  .reference = adcRef1V25,
68  .acq_time = adcAcqTime8
69  },
70  {
71  .dev = 0,
72  .input = adcPosSelAVDD,
73  .reference = adcRef5V,
74  .acq_time = adcAcqTime8
75  }
76 };
77 
78 #define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
79 #define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
86 #ifndef RTT_FREQUENCY
87 #define RTT_FREQUENCY (1U) /* in Hz */
88 #endif
97 static const timer_conf_t timer_config[] = {
98  {
99  .prescaler = {
100  .dev = TIMER0,
101  .cmu = cmuClock_TIMER0
102  },
103  .timer = {
104  .dev = TIMER1,
105  .cmu = cmuClock_TIMER1
106  },
107  .irq = TIMER1_IRQn,
108  .channel_numof = 3
109  },
110  {
111  .prescaler = {
112  .dev = NULL,
113  .cmu = cmuClock_LETIMER0
114  },
115  .timer = {
116  .dev = LETIMER0,
117  .cmu = cmuClock_LETIMER0
118  },
119  .irq = LETIMER0_IRQn,
120  .channel_numof = 2
121  }
122 };
123 
124 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
125 #define TIMER_0_ISR isr_timer1
126 #define TIMER_1_ISR isr_letimer0
133 static const uart_conf_t uart_config[] = {
134  {
135  .dev = USART0,
136  .rx_pin = GPIO_PIN(PA, 1),
137  .tx_pin = GPIO_PIN(PA, 0),
138  .loc = USART_ROUTELOC0_RXLOC_LOC0 |
139  USART_ROUTELOC0_TXLOC_LOC0,
140  .cmu = cmuClock_USART0,
141  .irq = USART0_RX_IRQn
142  }
143 };
144 
145 #define UART_NUMOF ARRAY_SIZE(uart_config)
146 #define UART_0_ISR_RX isr_usart0_rx
149 #ifdef __cplusplus
150 }
151 #endif
152 
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:45
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:38
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:39
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:250
@ PA
port A
ADC channel configuration.
Definition: periph_cpu.h:385
uint8_t dev
device index
Definition: periph_cpu.h:386
ADC device configuration.
Definition: periph_cpu.h:377
ADC_TypeDef * dev
ADC device used.
Definition: periph_cpu.h:378
Timer device configuration.
Definition: periph_cpu.h:263
timer_dev_t prescaler
the lower neighboring timer (not initialized for LETIMER)
Definition: periph_cpu.h:555
void * dev
TIMER_TypeDef or LETIMER_TypeDef device used.
Definition: periph_cpu.h:548
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218