Class CycleTimer

Inheritance Relationships

Derived Types

Class Documentation

class CycleTimer

Abstract interface for timers that can register with the cycle manager and be scheduled to be called at a given cycle.

Subclassed by BoundFunctionCycleTimer< ArchAVR_WDT >, ArchAVR_NVM::EE_Timer, ArchAVR_NVM::SPM_Timer, ArchXT_NVM::Timer, BoundFunctionCycleTimer< C >, PrescaledTimer, SPI, TWI::Timer, UART::RxTimer, UART::TxTimer, WatchdogTimer::WDR_Sync_Timer, WatchdogTimer::WDT_Timer

Public Functions

CycleTimer()
CycleTimer(const CycleTimer &other)
virtual ~CycleTimer()
inline bool scheduled() const

Returns true if this timer is scheduled with a manager.

bool paused() const

Returns true if this timer is scheduled and paused

cycle_count_t remaining_delay() const

Returns the remaining delay before this timer is called, or -1 if the timer isn’t scheduled.

virtual cycle_count_t next(cycle_count_t when) = 0

Callback from the cycle loop.

Note

there’s no guarantee the method will be called exactly on the required ‘when’ cycle. The only guarantee is “called ‘when’ <= ‘current cycle’”, the implementations must account for this.

Note

The next ‘when’ can be in the ‘past’ (i.e. <= ‘current cycle’). In this case, the timer will be called again within the same cycle with the given next ‘when’. The only constraint is that it must be greater than the previous ‘when’. If it’s negative or zero, the timer is removed from the queue.

Parameters:

when – current ‘when’ cycle, at which the timer was scheduled

Returns:

the next ‘when’ the timer requires to be called at.

CycleTimer &operator=(const CycleTimer &other)