Lora4MakerFaire
Dependencies: HC_SR04_Ultrasonic_Library X_NUCLEO_IKS01A2 mbed LoRaWAN-lib SX1272Lib
Fork of LoRaWANdemo72 by
Diff: system/timer.cpp
- Revision:
- 7:5077515c163b
- Parent:
- 5:62862ef9480b
--- a/system/timer.cpp Tue Apr 04 13:36:56 2017 +0000 +++ b/system/timer.cpp Mon Apr 24 13:29:34 2017 +0000 @@ -17,11 +17,11 @@ Timer TimeCounter; Ticker LoadTimeCounter; -volatile uint64_t CurrentTime = 0; +volatile uint32_t CurrentTime = 0; void TimerResetTimeCounter( void ) { - CurrentTime = CurrentTime + TimeCounter.read_us( ); + CurrentTime = CurrentTime + TimeCounter.read_us( ) / 1e3; TimeCounter.reset( ); TimeCounter.start( ); } @@ -29,12 +29,12 @@ void TimerTimeCounterInit( void ) { TimeCounter.start( ); - LoadTimeCounter.attach( &TimerResetTimeCounter, 10 ); + LoadTimeCounter.attach( mbed::callback( &TimerResetTimeCounter ), 10 ); } TimerTime_t TimerGetCurrentTime( void ) { - CurrentTime += TimeCounter.read_us( ); + CurrentTime += TimeCounter.read_us( ) / 1e3; TimeCounter.reset( ); TimeCounter.start( ); return ( ( TimerTime_t )CurrentTime ); @@ -42,7 +42,7 @@ TimerTime_t TimerGetElapsedTime( TimerTime_t savedTime ) { - CurrentTime += TimeCounter.read_us( ); + CurrentTime += TimeCounter.read_us( ) / 1e3; TimeCounter.reset( ); TimeCounter.start( ); return ( TimerTime_t )( CurrentTime - savedTime ); @@ -50,7 +50,7 @@ TimerTime_t TimerGetFutureTime( TimerTime_t eventInFuture ) { - CurrentTime += TimeCounter.read_us( ); + CurrentTime += TimeCounter.read_us( ) / 1e3; TimeCounter.reset( ); TimeCounter.start( ); return ( TimerTime_t )( CurrentTime + eventInFuture ); @@ -64,7 +64,7 @@ void TimerStart( TimerEvent_t *obj ) { - obj->Timer.attach_us( obj->Callback, obj->value ); + obj->Timer.attach_us( mbed::callback( obj->Callback ), obj->value * 1e3 ); } void TimerStop( TimerEvent_t *obj )