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