Simplified getting timerClock
[betaflight.git] / src / main / drivers / timer_stm32f30x.c
blobddc140285e85c95e5a82a7bd69bebd018dfde7aa
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #include "platform.h"
20 #include "common/utils.h"
22 #include "stm32f30x.h"
23 #include "rcc.h"
24 #include "timer.h"
26 const timerDef_t timerDefinitions[HARDWARE_TIMER_DEFINITION_COUNT] = {
27 { .TIMx = TIM1, .rcc = RCC_APB2(TIM1), .inputIrq = TIM1_CC_IRQn },
28 { .TIMx = TIM2, .rcc = RCC_APB1(TIM2), .inputIrq = TIM2_IRQn },
29 { .TIMx = TIM3, .rcc = RCC_APB1(TIM3), .inputIrq = TIM3_IRQn },
30 { .TIMx = TIM4, .rcc = RCC_APB1(TIM4), .inputIrq = TIM4_IRQn },
31 { .TIMx = TIM6, .rcc = RCC_APB1(TIM6), .inputIrq = 0 },
32 { .TIMx = TIM7, .rcc = RCC_APB1(TIM7), .inputIrq = 0 },
33 { .TIMx = TIM8, .rcc = RCC_APB2(TIM8), .inputIrq = TIM8_CC_IRQn },
34 { .TIMx = TIM15, .rcc = RCC_APB2(TIM15), .inputIrq = TIM1_BRK_TIM15_IRQn },
35 { .TIMx = TIM16, .rcc = RCC_APB2(TIM16), .inputIrq = TIM1_UP_TIM16_IRQn },
36 { .TIMx = TIM17, .rcc = RCC_APB2(TIM17), .inputIrq = TIM1_TRG_COM_TIM17_IRQn },
39 uint8_t timerClockDivisor(TIM_TypeDef *tim)
41 UNUSED(tim);
42 return 1;
45 uint32_t timerClock(TIM_TypeDef *tim)
47 UNUSED(tim);
48 return SystemCoreClock;