2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
25 #include "common/utils.h"
27 #include "stm32f10x.h"
31 const timerDef_t timerDefinitions
[HARDWARE_TIMER_DEFINITION_COUNT
] = {
32 { .TIMx
= TIM1
, .rcc
= RCC_APB2(TIM1
), .inputIrq
= TIM1_CC_IRQn
},
33 { .TIMx
= TIM2
, .rcc
= RCC_APB1(TIM2
), .inputIrq
= TIM2_IRQn
},
34 { .TIMx
= TIM3
, .rcc
= RCC_APB1(TIM3
), .inputIrq
= TIM3_IRQn
},
35 { .TIMx
= TIM4
, .rcc
= RCC_APB1(TIM4
), .inputIrq
= TIM4_IRQn
},
36 #if defined(STM32F10X_HD) || defined(STM32F10X_CL) || defined(STM32F10X_XL) || defined(STM32F10X_HD_VL)
37 { .TIMx
= TIM5
, .rcc
= RCC_APB1(TIM5
), .inputIrq
= TIM5_IRQn
},
38 { .TIMx
= TIM6
, .rcc
= RCC_APB1(TIM6
), .inputIrq
= 0 },
39 { .TIMx
= TIM7
, .rcc
= RCC_APB1(TIM7
), .inputIrq
= 0 },
41 #if defined(STM32F10X_XL) || defined(STM32F10X_HD_VL)
42 { .TIMx
= TIM8
, .rcc
= RCC_APB1(TIM8
), .inputIrq
= TIM8_CC_IRQn
},
43 { .TIMx
= TIM9
, .rcc
= RCC_APB2(TIM9
), .inputIrq
= TIM1_BRK_TIM9_IRQn
},
44 { .TIMx
= TIM10
, .rcc
= RCC_APB2(TIM10
), .inputIrq
= TIM1_UP_TIM10_IRQn
},
45 { .TIMx
= TIM11
, .rcc
= RCC_APB2(TIM11
), .inputIrq
= TIM1_TRG_COM_TIM11_IRQn
},
46 { .TIMx
= TIM12
, .rcc
= RCC_APB1(TIM12
), .inputIrq
= TIM12_IRQn
},
47 { .TIMx
= TIM13
, .rcc
= RCC_APB1(TIM13
), .inputIrq
= TIM13_IRQn
},
48 { .TIMx
= TIM14
, .rcc
= RCC_APB1(TIM14
), .inputIrq
= TIM14_IRQn
},
52 uint32_t timerClock(TIM_TypeDef
*tim
)
55 return SystemCoreClock
;