Template Class ConditionalTimer

Class Documentation

template<class Timeout>
class ConditionalTimer

A timeout that will only run while the given Check functor is true. Resets the timer if the condition is checked and returns false.

Param Time:

A timeout object that implements the interface described in timeout.hpp

Public Functions

inline explicit ConditionalTimer(uint32_t timeout)
Parameters:

timeout[in] the timeout for this timer to use

inline void restart()

Set the timer to expire this->timeout units of time away from the time at which this function was called.

inline void restart(uint32_t newTimeout)

Similar to restart() but redefine the period of the timer.

Parameters:

period[in] the new period to use for this PeriodicTimer

inline void stop()

Stop the timer.

inline bool execute(bool condition)

Returns true if the condition is true and the timer has expired If the condition parameter is false then the timer is reset and this function returns false

Parameters:

condition[in] the condition for whether or not the timer should run. If false then the timer is reset.

Returns:

true if the timer has expired (timeout has been reached) since last restart()

inline bool isStopped()