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:
- 1:497fba179833
- Parent:
- 0:1e0e79e82839
- Child:
- 2:e89b02820e93
--- a/Timer64.cpp Sat Mar 26 21:44:41 2016 +0000 +++ b/Timer64.cpp Sun Mar 27 20:18:44 2016 +0000 @@ -28,16 +28,9 @@ reset(); } -Timer64::Timer64(const ticker_data_t *data) : - _timerInitialized(false), - _timerRunning(false), - _tickerStartTimeUsec(0L), - _totalTimeUsec(0L), - _ticker_data(data), - _rollOverCheckTimer(NULL), - _rollOverCheckTimerPeriodInMsec(TIMER64_15MINUTE_ROLLOVER_CHECK_IN_MSECS) +Timer64::~Timer64() { - reset(); + release(); } int Timer64::init(uint32_t rolloverCheckTimeInMsec) @@ -117,6 +110,7 @@ if (_timerRunning) { + read_us(); _timerRunning = false; _rollOverCheckTimer->stop(); } @@ -174,6 +168,7 @@ } + _rollOverCheckTimer->start(_rollOverCheckTimerPeriodInMsec); _tickerStartTimeUsec = ticker_current_timeUsec; } @@ -190,23 +185,6 @@ return((double)read_us(status) / 1000000.0L); } -#ifdef MBED_OPERATORS -Timer64::operator double() -{ - return read(); -} - -Timer64::operator uint64_t() -{ - return read_us(); -} - -Timer64::operator uint32_t() -{ - return read_us(); -} -#endif - void Timer64::_rollOverCheck(void const* args) { Timer64* timer = (Timer64*)args;