Simple 64-bit timer for mbed. It is a drastically simplified version of Timer64 class by Tom Doyle. It is meant to be used in single-thread applications, where timer is used frequently, while standard 32-bit Timer is not enough.
Fork of Timer64 by
Diff: Timer64.cpp
- Revision:
- 4:9ca673a83acb
- Parent:
- 3:8396d3e6eb62
- Child:
- 8:5d17ff4f9c23
--- a/Timer64.cpp Mon Mar 28 16:31:42 2016 +0000 +++ b/Timer64.cpp Mon Mar 28 20:56:40 2016 +0000 @@ -173,6 +173,10 @@ { status = TIMER64_ERROR_NOT_INITIALIZED; } + else if (timeInUsec == NULL) + { + status = TIMER64_ERROR_NULL_POINTER; + } else { if (_timerRunning) @@ -200,6 +204,10 @@ { status = TIMER64_ERROR_NOT_INITIALIZED; } + else if (timeInMsec == NULL) + { + status = TIMER64_ERROR_NULL_POINTER; + } else { if (_timerRunning) @@ -227,6 +235,10 @@ { status = TIMER64_ERROR_NOT_INITIALIZED; } + else if (timeInSec == NULL) + { + status = TIMER64_ERROR_NULL_POINTER; + } else { if (_timerRunning) @@ -244,6 +256,26 @@ return(status); } +int Timer64::isRunning(bool* running) +{ + int status = TIMER64_OK; + + _sem->wait(); + { + if (!_timerInitialized) + { + status = TIMER64_ERROR_NOT_INITIALIZED; + } + else + { + *running = _timerRunning; + } + } + _sem->release(); + + return(status); +} + void Timer64::_rollOverCheck(void const* args) { Timer64* timer = (Timer64*)args;