miosix::Timer Class Reference

#include <sync.h>

List of all members.

Public Member Functions

 Timer ()
void start ()
void stop ()
bool is_running () const
int interval () const
void clear ()

Detailed Description

A timer that can be used to measure time intervals.
Its resolution equals the kernel tick.
Maximum interval is 2^31-1 ticks.

Constructor & Destructor Documentation

miosix::Timer::Timer (  ) 

Constructor. Timer is initialized in stopped status.

Member Function Documentation

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.

bool miosix::Timer::is_running (  )  const

true if timer is running

int miosix::Timer::interval (  )  const

get the interval, in kernel ticks.

the number of tick between start and stop. Returns -1 if the timer was never started, if interval is called after start but before stop, or if it overflowed.
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.

void miosix::Timer::clear (  ) 

Clear the timer and set it to not running state.

The documentation for this class was generated from the following files:

Generated on Fri Jun 19 15:19:04 2009 for Miosix by  doxygen 1.5.6