Timer for accumulating 10 ms intervals that does not overflow after ~30 min
This class simply creates a timer that accumulates 10 millisecond intervals which does not overflow after about 30 min.
RunTimer.h
- Committer:
- jebradshaw
- Date:
- 2016-05-19
- Revision:
- 0:21dc6ad1a795
- Child:
- 2:67e16d628edc
File content as of revision 0:21dc6ad1a795:
/** RunTimer class. * J. Bradshaw 20160519 * library for building a 10 millisecond running timer * * Example: * @code * #include "mbed.h" * #include "RunTimer.h" * * Serial pc(USBTX,USBRX); * RunTimer runTime; * * int main() { * while(1){ * pc.printf("Time=day=%02d hour=%02d min=%02d sec=%02d ms=%02d \r\n", runTime.day,runTime.hour,runTime.min,runTime.sec,runTime.ms) * wait(.02); * } * } * @endcode */ #ifndef MBED_RUNTIMER_H #define MBED_RUNTIMER_H #include "mbed.h" class RunTimer{ public: RunTimer(); void timeAcc(void); void Reset(void); Ticker timer_10ms; //Ticker for adding 10ms unsigned int ms; unsigned int sec; unsigned int min; unsigned int hour; unsigned int days; }; #endif