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