Analog values current readings
Dependencies: mbed LoRaWAN-lib SX1276Lib
Diff: system/timer.cpp
- Revision:
- 5:1e9f6a365854
- Parent:
- 1:352f608c3337
- Child:
- 7:3173f0508a98
diff -r 00cf2370c99d -r 1e9f6a365854 system/timer.cpp --- a/system/timer.cpp Mon Mar 14 09:20:40 2016 +0000 +++ b/system/timer.cpp Fri May 13 15:15:13 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;