mbed
Fork of mbed-dev by
Diff: targets/TARGET_NUVOTON/TARGET_M480/lp_ticker.c
- Revision:
- 180:b0033dcd6934
- Parent:
- 173:7d866c31b3c5
diff -r 79309dc6340a -r b0033dcd6934 targets/TARGET_NUVOTON/TARGET_M480/lp_ticker.c --- a/targets/TARGET_NUVOTON/TARGET_M480/lp_ticker.c Thu Nov 23 11:57:25 2017 +0000 +++ b/targets/TARGET_NUVOTON/TARGET_M480/lp_ticker.c Thu Dec 07 14:01:42 2017 +0000 @@ -103,8 +103,6 @@ // Schedule wakeup to match semantics of lp_ticker_get_compare_match() lp_ticker_set_interrupt(wakeup_tick); - - } timestamp_t lp_ticker_read() @@ -144,21 +142,13 @@ void lp_ticker_set_interrupt(timestamp_t timestamp) { - uint32_t now = lp_ticker_read(); + uint32_t delta = timestamp - lp_ticker_read(); wakeup_tick = timestamp; TIMER_Stop((TIMER_T *) NU_MODBASE(timer3_modinit.modname)); - int delta = (int) (timestamp - now); - if (delta > 0) { - cd_major_minor_clks = (uint64_t) delta * US_PER_TICK * TMR3_CLK_PER_SEC / US_PER_SEC; - lp_ticker_arm_cd(); - } else { - // NOTE: With lp_ticker_fire_interrupt() introduced, upper layer would handle past event case. - // This code fragment gets redundant, but it is still kept here for backward-compatible. - void lp_ticker_fire_interrupt(void); - lp_ticker_fire_interrupt(); - } + cd_major_minor_clks = (uint64_t) delta * US_PER_TICK * TMR3_CLK_PER_SEC / US_PER_SEC; + lp_ticker_arm_cd(); } void lp_ticker_fire_interrupt(void)