64 bit Timer Class.
Diff: Timer64.h
- Revision:
- 1:497fba179833
- Parent:
- 0:1e0e79e82839
- Child:
- 2:e89b02820e93
diff -r 1e0e79e82839 -r 497fba179833 Timer64.h --- a/Timer64.h Sat Mar 26 21:44:41 2016 +0000 +++ b/Timer64.h Sun Mar 27 20:18:44 2016 +0000 @@ -6,13 +6,13 @@ #include <stdint.h> #include "rtos.h" -#define TIMER64_OK 0 +#define TIMER64_OK 0 -#define TIMER64_ERROR_NOT_INITIALIZED -1 +#define TIMER64_ERROR_NOT_INITIALIZED -1 -#define TIMER64_WARNING_ALREADY_INITIALIZED 1 -#define TIMER64_WARNING_ALREADY_RUNNING 2 -#define TIMER64_WARNING_ALREADY_STOPPED 3 +#define TIMER64_WARNING_ALREADY_INITIALIZED 1 +#define TIMER64_WARNING_ALREADY_RUNNING 2 +#define TIMER64_WARNING_ALREADY_STOPPED 3 #define TIMER64_15MINUTE_ROLLOVER_CHECK_IN_MSECS 900000 #define TIMER64_MIN_ROLLOVER_CHECK_IN_MSECS 60000 // 0:01:00.000 @@ -23,9 +23,9 @@ public: Timer64(); - Timer64(const ticker_data_t *data); + ~Timer64(); - /** Initialize the timer + /** Initialize the timer - this must be called before the timer can be used */ int init(uint32_t rolloverCheckTimeInMsecc = TIMER64_15MINUTE_ROLLOVER_CHECK_IN_MSECS); @@ -51,7 +51,7 @@ */ double read(int* status = NULL); - /** Get the time passed in mili-seconds + /** Get the time passed in milli-seconds */ uint64_t read_ms(int* status = NULL); @@ -59,15 +59,9 @@ */ uint64_t read_us(int* status = NULL); -#ifdef MBED_OPERATORS - operator double(); - operator uint64_t(); - operator uint32_t(); -#endif - private: bool _timerInitialized; - bool _timerRunning; // whether the timer is running + bool _timerRunning; // whether the timer is running timestamp_t _tickerStartTimeUsec; // the start time of the latest slice uint64_t _totalTimeUsec; // any accumulated time from previous slices const ticker_data_t *_ticker_data;