From 53d2b152c440b85d5fb6e55f344c335310a5642b Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Tue, 24 Feb 2015 14:18:33 +0000 Subject: [PATCH] us_ticker_set_interrupt() should set an interrupt for the given timestamp even if there's a pending interrupt. --- .../hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c index 5ec599c14f..aa6c6ad47b 100644 --- a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c @@ -174,15 +174,13 @@ void us_ticker_set_interrupt(timestamp_t timestamp) us_ticker_init(); } - if (us_ticker_callbackPending) { - return; - } - uint32_t callbackTime = MICROSECONDS_TO_RTC_UNITS(timestamp); NRF_RTC1->CC[0] = callbackTime & MAX_RTC_COUNTER_VAL; us_ticker_callbackTimestamp = callbackTime; - us_ticker_callbackPending = true; - rtc1_enableCompareInterrupt(); + if (!us_ticker_callbackPending) { + us_ticker_callbackPending = true; + rtc1_enableCompareInterrupt(); + } } void us_ticker_disable_interrupt(void)