mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
stopwatch: Add support for timers 5-8
This fixes the OP bootloader getting stuck in the bootloader forever when USB is plugged in. This also fails hard on being passed an unsupported timer value so that this can be caught more easily in the future.
This commit is contained in:
parent
965867de7a
commit
b2b1c184de
@ -50,8 +50,21 @@ uint32_t STOPWATCH_Init(u32 resolution, TIM_TypeDef* TIM) {
|
||||
case (uint32_t)TIM4:
|
||||
STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM4;
|
||||
break;
|
||||
case (uint32_t)TIM5:
|
||||
STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM5;
|
||||
break;
|
||||
case (uint32_t)TIM6:
|
||||
STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM6;
|
||||
break;
|
||||
case (uint32_t)TIM7:
|
||||
STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM7;
|
||||
break;
|
||||
case (uint32_t)TIM8:
|
||||
STOPWATCH_TIMER_RCC = RCC_APB2Periph_TIM8;
|
||||
break;
|
||||
default:
|
||||
STOPWATCH_TIMER_RCC = RCC_APB2Periph_TIM1;
|
||||
/* Unsupported timer */
|
||||
while(1);
|
||||
}
|
||||
|
||||
// enable timer clock
|
||||
|
Loading…
Reference in New Issue
Block a user