Miosix
2.0alpha1
|
#include <sync.h>
Public Member Functions | |
Timer () | |
void | start () |
void | stop () |
bool | isRunning () const |
int | interval () const |
void | clear () |
A timer that can be used to measure time intervals.
Its resolution equals the kernel tick.
Maximum interval is 2^31-1 ticks.
miosix::Timer::Timer | ( | ) |
Constructor. Timer is initialized in stopped status.
void miosix::Timer::clear | ( | ) |
Clear the timer and set it to not running state.
int miosix::Timer::interval | ( | ) | const |
get the interval, in kernel ticks.
To read the vaue of a timer without stopping it, you can use its copy constructor to create another timer, and stop it while the first timer keeps running.
bool miosix::Timer::isRunning | ( | ) | const |
void miosix::Timer::start | ( | ) |
Start the timer
void miosix::Timer::stop | ( | ) |
Stop the timer. After stop, Timer can be started and stopped again to count non-contiguous timer intervals.