versionepudee2018
Dependencies: mbed LoRaWAN-lib SX1272Lib
Fork of LoRaWAN-demo-72 by
Diff: system/timer.cpp
- Revision:
- 3:3152aa75c58d
- Parent:
- 0:45496a70a8a5
- Child:
- 5:62862ef9480b
--- a/system/timer.cpp Mon Mar 14 09:17:05 2016 +0000 +++ b/system/timer.cpp Fri May 13 15:14:44 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;