cfg_timer_default.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Inria
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 
22 #include "kernel_defines.h"
23 #include "periph_cpu.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
39 static const timer_conf_t timer_config[] = {
40  {
41  .dev = NRF_TIMER1,
42  .channels = 3,
43  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
44  .irqn = TIMER1_IRQn
45  },
46  {
47  /* BEWARE: This timer is allocated to the nRF52 IEEE 802.15.4 driver.
48  * Do not use this timer (unless you do not use IEEE 802.15.4
49  * networking)!
50  */
51  .dev = NRF_TIMER2,
52  .channels = 3,
53  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
54  .irqn = TIMER2_IRQn
55  },
56  /* The later timers are only present on the larger NRF52 CPUs like NRF52840
57  * or NRF52833, but not small ones like NRF52810. They do have 2 channels
58  * more (CC registers [0..5] instead of CC registers [0..3]). */
59 #ifdef NRF_TIMER3
60  {
61  .dev = NRF_TIMER3,
62  .channels = 5,
63  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
64  .irqn = TIMER3_IRQn
65  },
66 #endif
67 #ifdef NRF_TIMER4
68  {
69  .dev = NRF_TIMER4,
70  .channels = 5,
71  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
72  .irqn = TIMER4_IRQn
73  }
74 #endif
75 };
76 
77 #define TIMER_0_ISR isr_timer1
78 #define TIMER_1_ISR isr_timer2
79 #define TIMER_2_ISR isr_timer3
80 #define TIMER_3_ISR isr_timer4
81 
83 #define TIMER_0_MAX_VALUE 0xffffffff
85 #define TIMER_1_MAX_VALUE 0xffffffff
86 #ifdef NRF_TIMER3
88 #define TIMER_2_MAX_VALUE 0xffffffff
89 #endif
90 /* If there is no NRF_TIMER3 this should be TIMER_2 because the index shifts
91  * up, but there is only a TIMER4 if there is a TIMER3 too. */
92 #ifdef NRF_TIMER4
94 #define TIMER_3_MAX_VALUE 0xffffffff
95 #endif
96 
97 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
100 #ifdef __cplusplus
101 }
102 #endif
103 
Common macros and compiler attributes/pragmas configuration.
static const timer_conf_t timer_config[]
Configuration of the exposed timers.
Timer device configuration.
Definition: periph_cpu.h:263
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:264