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