LoRaWAN demo 76 bootcamp
Dependencies: mbed DigitDisplay Chainable_RGB_LED LoRaWAN-lib SX1276Lib
Diff: system/timer.cpp
- Revision:
- 1:21e3eef8200f
- Parent:
- 0:cb80564f40e1
- Child:
- 3:de1dcfbe175a
--- a/system/timer.cpp Thu Mar 17 09:32:46 2016 +0000 +++ b/system/timer.cpp Fri May 13 15:52:23 2016 +0000 @@ -40,6 +40,22 @@ return ( ( TimerTime_t )CurrentTime ); } +TimerTime_t TimerGetElapsedTime( TimerTime_t savedTime ) +{ + CurrentTime += TimeCounter.read_us( ); + TimeCounter.reset( ); + TimeCounter.start( ); + return ( TimerTime_t )( CurrentTime - savedTime ); +} + +TimerTime_t TimerGetFutureTime( TimerTime_t eventInFuture ) +{ + CurrentTime += TimeCounter.read_us( ); + TimeCounter.reset( ); + TimeCounter.start( ); + return ( TimerTime_t )( CurrentTime + eventInFuture ); +} + void TimerInit( TimerEvent_t *obj, void ( *callback )( void ) ) { obj->value = 0;