investigating UART crash
Dependencies: mbed LoRaWAN-lib_publishing_testing_UART_bug SingleFrequencyLora
Fork of simple-demo-76_revised_20171113 by
Diff: system/timer.cpp
- Revision:
- 9:ee9dcbb9708d
- Parent:
- 7:3173f0508a98
--- a/system/timer.cpp Tue Apr 04 13:43:31 2017 +0000 +++ b/system/timer.cpp Mon Apr 24 13:38:31 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 )