timer-stm32: correct some init code
clear status register first and enable the counter
This commit is contained in:
parent
6ca071804b
commit
426ffb9420
|
|
@ -74,9 +74,8 @@ void timer_init() {
|
|||
*/
|
||||
RCC->APB1ENR |= RCC_APB1ENR_TIM5EN; // Turn on TIM5 power.
|
||||
|
||||
TIM5->CCR1 = 0xFFFFFFFF; // First timer should not occur at 0
|
||||
TIM5->CR1 &= ~(0x03FF); // clear register
|
||||
TIM5->CR1 |= TIM_CR1_CEN; // Enable counter.
|
||||
TIM5->SR = 0; // clear status register
|
||||
TIM5->CR1 = TIM_CR1_CEN; // Enable counter.
|
||||
|
||||
NVIC_SetPriority(TIM5_IRQn,
|
||||
NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0)); // Also highest priority.
|
||||
|
|
|
|||
Loading…
Reference in New Issue