Generate update event when initializing the ticker so the new prescaler

value is used straight away.
pull/8/head
Joe Turner 2013-05-14 10:58:37 +01:00
parent e6ff45d87c
commit 8ffca414a5
1 changed files with 1 additions and 0 deletions

View File

@ -32,6 +32,7 @@ void us_ticker_init(void) {
uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
US_TICKER_TIMER->PSC = prescale - 1;
US_TICKER_TIMER->EGR |= TIM_EGR_UG;
US_TICKER_TIMER->CR1 |= TIM_CR1_CEN;
NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);