test
Fork of mbed-dev by
Diff: targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/us_ticker.c
- Revision:
- 175:b96e65c34a4d
- Parent:
- 154:37f96f9d4de2
- Child:
- 178:d650f5d4c87a
--- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/us_ticker.c Fri Sep 15 14:59:18 2017 +0100 +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/us_ticker.c Mon Oct 02 15:33:19 2017 +0100 @@ -73,16 +73,7 @@ void us_ticker_set_interrupt(timestamp_t timestamp) { - int delta = (int)(timestamp - us_ticker_read()); - if (delta <= 0) { - // This event was in the past. - // Set the interrupt as pending, but don't process it here. - // This prevents a recurive loop under heavy load - // which can lead to a stack overflow. - NVIC_SetPendingIRQ(PIT3_IRQn); - return; - } - + uint32_t delta = timestamp - us_ticker_read(); PIT_StopTimer(PIT, kPIT_Chnl_3); PIT_StopTimer(PIT, kPIT_Chnl_2); PIT_SetTimerPeriod(PIT, kPIT_Chnl_3, (uint32_t)delta); @@ -90,3 +81,8 @@ PIT_StartTimer(PIT, kPIT_Chnl_3); PIT_StartTimer(PIT, kPIT_Chnl_2); } + +void us_ticker_fire_interrupt(void) +{ + NVIC_SetPendingIRQ(PIT3_IRQn); +}