cfg_timer_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 #include "periph_cpu.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
31 static const timer_conf_t timer_config[] = {
32  {
33  .dev = TIM2,
34 #if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
35  .max = 0x0000ffff,
36 #else
37  .max = 0xffffffff,
38 #endif
39 #if defined(RCC_APB1ENR1_TIM2EN)
40  .rcc_mask = RCC_APB1ENR1_TIM2EN,
41 #elif defined(RCC_MC_APB1ENSETR_TIM2EN)
42  .rcc_mask = RCC_MC_APB1ENSETR_TIM2EN,
43 #else
44  .rcc_mask = RCC_APB1ENR_TIM2EN,
45 #endif
46  .bus = APB1,
47  .irqn = TIM2_IRQn
48  }
49 };
50 
51 #define TIMER_0_ISR isr_tim2
52 
53 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
56 #ifdef __cplusplus
57 }
58 #endif
59 
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:78
Timer device configuration.
Definition: periph_cpu.h:263
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:264