mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/us_ticker.c
- Revision:
- 174:b96e65c34a4d
- Parent:
- 167:e84263d55307
- Child:
- 184:08ed48f1de7f
--- a/targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/us_ticker.c Fri Sep 15 14:59:18 2017 +0100 +++ b/targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/us_ticker.c Mon Oct 02 15:33:19 2017 +0100 @@ -108,22 +108,23 @@ void us_ticker_set_interrupt(timestamp_t timestamp) { - int32_t delta = 0; + uint32_t delta = 0; if (!us_ticker_drv_data.inited) { us_ticker_init(); } - delta = (int32_t)(timestamp - us_ticker_read()); + delta = timestamp - us_ticker_read(); + + /* If the event was not in the past enable interrupt */ + Timer_SetInterrupt(TIMER0, delta); - /* Check if the event was in the past */ - if (delta <= 0) { - /* This event was in the past */ - Timer_SetInterrupt(TIMER0, 0); - } else { - /* If the event was not in the past enable interrupt */ - Timer_SetInterrupt(TIMER0, delta); - } +} + +void us_ticker_fire_interrupt(void) +{ + uint32_t us_ticker_irqn1 = Timer_GetIRQn(TIMER1); + NVIC_SetPendingIRQ((IRQn_Type)us_ticker_irqn1); } void us_ticker_disable_interrupt(void)