From a078739ec2ca969a32314bb53b097d64aee84ca7 Mon Sep 17 00:00:00 2001 From: blckmn Date: Sun, 9 Jul 2017 07:41:02 +1000 Subject: [PATCH] Removed superfluous timerClockDivisor (not used anywhere anymore). --- src/main/drivers/timer.h | 1 - src/main/drivers/timer_stm32f10x.c | 6 ------ src/main/drivers/timer_stm32f30x.c | 6 ------ src/main/drivers/timer_stm32f4xx.c | 21 ++++++++------------- src/main/drivers/timer_stm32f7xx.c | 5 ----- 5 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/main/drivers/timer.h b/src/main/drivers/timer.h index 1127a1c45e..67375f3c03 100644 --- a/src/main/drivers/timer.h +++ b/src/main/drivers/timer.h @@ -182,7 +182,6 @@ void timerInit(void); void timerStart(void); void timerForceOverflow(TIM_TypeDef *tim); -uint8_t timerClockDivisor(TIM_TypeDef *tim); uint32_t timerClock(TIM_TypeDef *tim); void configTimeBase(TIM_TypeDef *tim, uint16_t period, uint32_t hz); // TODO - just for migration diff --git a/src/main/drivers/timer_stm32f10x.c b/src/main/drivers/timer_stm32f10x.c index 5f8fd63c37..7fa5c315cf 100644 --- a/src/main/drivers/timer_stm32f10x.c +++ b/src/main/drivers/timer_stm32f10x.c @@ -44,12 +44,6 @@ const timerDef_t timerDefinitions[HARDWARE_TIMER_DEFINITION_COUNT] = { #endif }; -uint8_t timerClockDivisor(TIM_TypeDef *tim) -{ - UNUSED(tim); - return 1; -} - uint32_t timerClock(TIM_TypeDef *tim) { UNUSED(tim); diff --git a/src/main/drivers/timer_stm32f30x.c b/src/main/drivers/timer_stm32f30x.c index ddc140285e..6b44e74878 100644 --- a/src/main/drivers/timer_stm32f30x.c +++ b/src/main/drivers/timer_stm32f30x.c @@ -36,12 +36,6 @@ const timerDef_t timerDefinitions[HARDWARE_TIMER_DEFINITION_COUNT] = { { .TIMx = TIM17, .rcc = RCC_APB2(TIM17), .inputIrq = TIM1_TRG_COM_TIM17_IRQn }, }; -uint8_t timerClockDivisor(TIM_TypeDef *tim) -{ - UNUSED(tim); - return 1; -} - uint32_t timerClock(TIM_TypeDef *tim) { UNUSED(tim); diff --git a/src/main/drivers/timer_stm32f4xx.c b/src/main/drivers/timer_stm32f4xx.c index a9d6aa7bbb..7c17447c62 100644 --- a/src/main/drivers/timer_stm32f4xx.c +++ b/src/main/drivers/timer_stm32f4xx.c @@ -80,23 +80,18 @@ const timerDef_t timerDefinitions[HARDWARE_TIMER_DEFINITION_COUNT] = { 7 TIM8_CH1 TIM8_CH2 TIM8_CH3 TIM8_CH4 */ -uint8_t timerClockDivisor(TIM_TypeDef *tim) +uint32_t timerClock(TIM_TypeDef *tim) { #if defined (STM32F411xE) UNUSED(tim); - return 1; + return SystemCoreClock; #elif defined (STM32F40_41xxx) - if (tim == TIM8) return 1; -#endif - - if (tim == TIM1 || tim == TIM9 || tim == TIM10 || tim == TIM11) { - return 1; + if (tim == TIM8 || tim == TIM1 || tim == TIM9 || tim == TIM10 || tim == TIM11) { + return SystemCoreClock; } else { - return 2; + return SystemCoreClock / 2; } -} - -uint32_t timerClock(TIM_TypeDef *tim) -{ - return SystemCoreClock / timerClockDivisor(tim); +#else + #error "No timer clock defined correctly for MCU" +#endif } diff --git a/src/main/drivers/timer_stm32f7xx.c b/src/main/drivers/timer_stm32f7xx.c index 5059d1bbce..1decd01c39 100644 --- a/src/main/drivers/timer_stm32f7xx.c +++ b/src/main/drivers/timer_stm32f7xx.c @@ -75,11 +75,6 @@ const timerDef_t timerDefinitions[HARDWARE_TIMER_DEFINITION_COUNT] = { 6 TIM1_CH1 TIM1_CH2 TIM1_CH1 TIM1_CH4 TIM1_CH3 7 TIM8_CH1 TIM8_CH2 TIM8_CH3 TIM8_CH4 */ -uint8_t timerClockDivisor(TIM_TypeDef *tim) -{ - UNUSED(tim); - return 1; -} uint32_t timerClock(TIM_TypeDef *tim) {