Loading...
Searching...
No Matches
cfg_timer_default.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Koen Zandberg <koen@bergzand.net>
3 * 2023 Gunar Schorcht <gunar@schorcht.net>
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
10#pragma once
11
22
23#include "periph_cpu.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
38static const timer_conf_t timer_config[] = {
39 {
40 .dev = TIMER0,
41 .max = 0x0000ffff,
42 .rcu_mask = RCU_APB2EN_TIMER0EN_Msk,
43 .bus = APB2,
44 .irqn = TIMER0_Channel_IRQn
45 },
46 {
47 .dev = TIMER1,
48 .max = 0x0000ffff,
49 .rcu_mask = RCU_APB1EN_TIMER1EN_Msk,
50 .bus = APB1,
51 .irqn = TIMER1_IRQn
52 },
53#if !defined(MODULE_PERIPH_PM)
54 {
55 .dev = TIMER2,
56 .max = 0x0000ffff,
57 .rcu_mask = RCU_APB1EN_TIMER2EN_Msk,
58 .bus = APB1,
59 .irqn = TIMER2_IRQn
60 },
61#if defined(CPU_MODEL_GD32VF103C8T6) || defined(CPU_MODEL_GD32VF103CBT6) || \
62 defined(CPU_MODEL_GD32VF103R8T6) || defined(CPU_MODEL_GD32VF103RBT6) || \
63 defined(CPU_MODEL_GD32VF103T8U6) || defined(CPU_MODEL_GD32VF103TBU6) || \
64 defined(CPU_MODEL_GD32VF103V8T6) || defined(CPU_MODEL_GD32VF103VBT6)
65 {
66 .dev = TIMER3,
67 .max = 0x0000ffff,
68 .rcu_mask = RCU_APB1EN_TIMER3EN_Msk,
69 .bus = APB1,
70 .irqn = TIMER3_IRQn
71 },
72 {
73 .dev = TIMER4,
74 .max = 0x0000ffff,
75 .rcu_mask = RCU_APB1EN_TIMER4EN_Msk,
76 .bus = APB1,
77 .irqn = TIMER4_IRQn
78 }
79#endif
80#endif /* !defined(MODULE_PERIPH_PWM) */
81};
82
83#define TIMER_0_IRQN TIMER0_Channel_IRQn
84#define TIMER_1_IRQN TIMER1_IRQn
85
86#if !defined(MODULE_PERIPH_PWM)
87#define TIMER_2_IRQN TIMER2_IRQn
88#if defined(CPU_MODEL_GD32VF103C8T6) || defined(CPU_MODEL_GD32VF103CBT6) || \
89 defined(CPU_MODEL_GD32VF103R8T6) || defined(CPU_MODEL_GD32VF103RBT6) || \
90 defined(CPU_MODEL_GD32VF103T8U6) || defined(CPU_MODEL_GD32VF103TBU6) || \
91 defined(CPU_MODEL_GD32VF103V8T6) || defined(CPU_MODEL_GD32VF103VBT6)
92#define TIMER_3_IRQN TIMER3_IRQn
93#define TIMER_4_IRQN TIMER4_IRQn
94#endif
95#endif /* !defined(MODULE_PERIPH_PWM) */
96
97#define TIMER_NUMOF ARRAY_SIZE(timer_config)
99
100#ifdef __cplusplus
101}
102#endif
103
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:78
@ APB2
Advanced Peripheral Bus 2.
Definition periph_cpu.h:79
Timer device configuration.
Definition periph_cpu.h:263