From 8ffca414a5c63c6c71cfc19a3ab23884b766331c Mon Sep 17 00:00:00 2001 From: Joe Turner Date: Tue, 14 May 2013 10:58:37 +0100 Subject: [PATCH] Generate update event when initializing the ticker so the new prescaler value is used straight away. --- libraries/mbed/vendor/STM/capi/us_ticker.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/mbed/vendor/STM/capi/us_ticker.c b/libraries/mbed/vendor/STM/capi/us_ticker.c index f227d4a93b..ae28f64297 100644 --- a/libraries/mbed/vendor/STM/capi/us_ticker.c +++ b/libraries/mbed/vendor/STM/capi/us_ticker.c @@ -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);