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
51 
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)
81 
87 #define RTT_MAX_VALUE (0xFFFFFFFF)
88 #define RTT_FREQUENCY (1U)
89 
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
127 
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
147 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif /* PERIPH_CONF_H */
154 
adc_chan_conf_t
ADC channel configuration.
Definition: periph_cpu.h:82
adc_conf_t::dev
ADC_TypeDef * dev
ADC device used.
Definition: periph_cpu.h:75
timer_dev_t::dev
void * dev
TIMER_TypeDef or LETIMER_TypeDef device used.
Definition: periph_cpu.h:358
timer_conf_t::prescaler
timer_dev_t prescaler
the lower neighboring timer (not initialized for LETIMER)
Definition: periph_cpu.h:363
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
uart_conf_t::dev
cc2538_uart_t * dev
pointer to the used UART device
Definition: periph_cpu.h:167
timer_conf_t
Timer configuration.
Definition: periph_cpu.h:288
adc_conf_t
ADC device configuration.
Definition: periph_cpu.h:74
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
adc_chan_conf_t::dev
uint8_t dev
device index
Definition: periph_cpu.h:83
PA
@ PA
port A
Definition: periph_cpu_common.h:88