Loading...
Searching...
No Matches
cfg_timer_tim5_and_tim2.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 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_TIM5_AND_TIM2_H
21#define CFG_TIMER_TIM5_AND_TIM2_H
22
23#include "periph_cpu.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
33static const timer_conf_t timer_config[] = {
34 /* intentionally not sorted alphabetically: E.g. on STM32L1 TIM5 is
35 * 32 bit while TIM2 is only 16 bit. ztimer defaults to the first timer
36 * defined and does profit from using a 32 bit timer */
37 {
38 .dev = TIM5,
39 .max = 0xffffffff,
40#if defined(RCC_APB1ENR1_TIM5EN)
41 .rcc_mask = RCC_APB1ENR1_TIM5EN,
42#else
43 .rcc_mask = RCC_APB1ENR_TIM5EN,
44#endif
45 .bus = APB1,
46 .irqn = TIM5_IRQn
47 },
48 {
49 .dev = TIM2,
50#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
51 .max = 0x0000ffff,
52#else
53 .max = 0xffffffff,
54#endif
55#if defined(RCC_APB1ENR1_TIM2EN)
56 .rcc_mask = RCC_APB1ENR1_TIM2EN,
57#elif defined(RCC_MC_APB1ENSETR_TIM2EN)
58 .rcc_mask = RCC_MC_APB1ENSETR_TIM2EN,
59#else
60 .rcc_mask = RCC_APB1ENR_TIM2EN,
61#endif
62 .bus = APB1,
63 .irqn = TIM2_IRQn
64 },
65};
66
67#define TIMER_0_ISR isr_tim5
68#define TIMER_1_ISR isr_tim2
70#define TIMER_NUMOF ARRAY_SIZE(timer_config)
73#ifdef __cplusplus
74}
75#endif
76
77#endif /* CFG_TIMER_TIM5_AND_TIM2_H */
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79
Timer device configuration.
Definition periph_cpu.h:264
TC0_t * dev
Pointer to the used as Timer device.
Definition periph_cpu.h:265