Lora_with_GPS integration code - program hangs after a few transmissions
Dependencies: mbed LoRaWAN-lib SingleFrequencyLora
Fork of Lora_with_GPS by
Diff: system/timer.cpp
- Revision:
- 5:1e9f6a365854
- Parent:
- 1:352f608c3337
- Child:
- 7:3173f0508a98
--- 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;