Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
tap::arch::ConditionalTimer< Timeout > Class Template Reference

#include <conditional_timer.hpp>

Public Member Functions

 ConditionalTimer (uint32_t timeout)
 
void restart ()
 
void restart (uint32_t newTimeout)
 
void stop ()
 
bool execute (bool condition)
 
bool isStopped ()
 

Detailed Description

template<class Timeout>
class tap::arch::ConditionalTimer< Timeout >

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

Parameters
TimeA timeout object that implements the interface described in timeout.hpp

Constructor & Destructor Documentation

◆ ConditionalTimer()

template<class Timeout >
tap::arch::ConditionalTimer< Timeout >::ConditionalTimer ( uint32_t  timeout)
inlineexplicit
Parameters
[in]timeoutthe timeout for this timer to use

Member Function Documentation

◆ execute()

template<class Timeout >
bool tap::arch::ConditionalTimer< Timeout >::execute ( bool  condition)
inline

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
[in]conditionthe 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()

◆ isStopped()

template<class Timeout >
bool tap::arch::ConditionalTimer< Timeout >::isStopped ( )
inline

◆ restart() [1/2]

template<class Timeout >
void tap::arch::ConditionalTimer< Timeout >::restart ( )
inline

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

◆ restart() [2/2]

template<class Timeout >
void tap::arch::ConditionalTimer< Timeout >::restart ( uint32_t  newTimeout)
inline

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

Parameters
[in]periodthe new period to use for this PeriodicTimer

◆ stop()

template<class Timeout >
void tap::arch::ConditionalTimer< Timeout >::stop ( )
inline

Stop the timer.


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