FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Abstract class holding some action to be executed at given periods of time. More...
#include <fastarduino/scheduler.h>
Public Member Functions | |
bool | is_periodic () const INLINE |
Tell if this job is periodic or not. More... | |
uint32_t | next_time () const INLINE |
Tell next time (in ms) when this job shall be executed. More... | |
uint32_t | period () const INLINE |
Return the period of this job, or 0 if this is a one-shot job. More... | |
void | reschedule (uint32_t when) INLINE |
Reschedule this job for a later time (in ms). More... | |
Protected Member Functions | |
virtual void | on_schedule (uint32_t millis)=0 |
This method is called by Scheduler whenever current clock time is greater or equal to next_time() . More... | |
Job (uint32_t next=0, uint32_t period=0) INLINE | |
Construct a new Job . More... | |
Friends | |
template<typename CLOCK , typename T > | |
class | Scheduler |
Additional Inherited Members | |
Public Types inherited from containers::Link< Job > | |
using | T = Job |
The type of item wrapped by this class. More... | |
Abstract class holding some action to be executed at given periods of time.
You should subclass Job
and implement virtual method on_schedule()
. A Job
may be "one-shot" (executed exactly once) or "periodic" (executed at regular time intervals). Every job must be added to a Scheduler
in order to be executed at specified time.
Definition at line 160 of file scheduler.h.
|
inlineprotected |
Construct a new Job
.
next | next time (in ms) at which this job shall be executed the first time |
period | the period (in ms) at which this job shall be periodically executed, or 0 if this must be a one-shot job. |
Definition at line 224 of file scheduler.h.
|
inline |
Tell if this job is periodic or not.
Definition at line 166 of file scheduler.h.
|
inline |
Tell next time (in ms) when this job shall be executed.
Time reference for this value is provided by the Scheduler
clock.
Definition at line 175 of file scheduler.h.
|
inline |
Return the period of this job, or 0
if this is a one-shot job.
Definition at line 183 of file scheduler.h.
|
inline |
Reschedule this job for a later time (in ms).
Time reference for when
is provided by the Scheduler
clock. This gets automatically called by Scheduler
after every execution of a periodic job.
when | next time (in ms) at which this job shall be executed; note that actual execution time accuracy depends a lot on how busy your main event loop is. |
Definition at line 197 of file scheduler.h.
|
protectedpure virtual |
This method is called by Scheduler
whenever current clock time is greater or equal to next_time()
.
You must override this method to make it perform what you need.
millis | the current time at which this method is called, as provided by Scheduler clock |
Definition at line 230 of file scheduler.h.