COSA
An Object-Oriented Platform for Arduino Programming
|
#include <Periodic.hh>
Public Member Functions | |
Periodic (Job::Scheduler *scheduler, uint32_t period) | |
void | period (uint32_t time) |
uint32_t | period () const |
void | reschedule () |
void | expire_at (uint32_t time) |
uint32_t | expire_at () const |
void | expire_after (uint32_t time) |
int32_t | expire_after () const |
uint32_t | time () const |
bool | is_started () const |
bool | start () |
bool | stop () |
virtual void | on_expired () |
virtual void | run () |
void | detach () |
Linkage * | succ () const |
Linkage * | pred () const |
void | attach (Linkage *pred) |
Protected Member Functions | |
virtual void | on_event (uint8_t type, uint16_t value) |
Protected Attributes | |
uint32_t | m_period |
uint32_t | m_expires |
Scheduler * | m_scheduler |
Linkage * | m_succ |
Linkage * | m_pred |
Periodic function handler. Syntactic sugar for periodical jobs. Subclass and implement the virtual method run() as the function to be executed periodically. The scheduler defines the time base; the alarm scheduler uses seconds, the watchdog job scheduler milli-seconds and the real-time timer micro-seconds.
For details on handling of time units see Job.hh. This execution pattern is also available in the FSM (Finite State Machine) class.
Definition at line 38 of file Periodic.hh.
|
inline |
Construct a periodic function handled by the given scheduler and with the given period in the schedulers time base. The maximum period is UINT32_MAX; 1.2 hours with RTT::Scheduler, 49 days with Watchdog::Scheduler and 136 years with Alarm::Clock.
[in] | scheduler | for the periodic job. |
[in] | period | of timeout. |
Definition at line 48 of file Periodic.hh.
|
inlineinherited |
Attach given linkage as predecessor. Will check and detach if already attached.
[in] | pred | linkage to attach. |
Definition at line 71 of file Linkage.hh.
|
inlineinherited |
Detach this link. Unlink from any list.
Definition at line 125 of file Linkage.hh.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineprotectedvirtual |
Periodic event handler; dispatch the run() function on timeout events and reschedule the periodic job.
[in] | type | the type of event. |
[in] | value | the event value. |
Reimplemented from Job.
Definition at line 91 of file Periodic.hh.
|
inlinevirtualinherited |
Job member function that is called Scheduler::dispatch() when the job time has expired. This function is normally called from an interrupt service routine. The default implementation will push a timeout event with the job as target. The default event handler will call the job run() virtual member function. Override this function if the job should be executed during the interrupt service routine.
|
inline |
Set timeout period.
[in] | time | period of timeout. |
Definition at line 57 of file Periodic.hh.
|
inline |
|
inlineinherited |
Return predecessor in sequence.
Definition at line 60 of file Linkage.hh.
|
inline |
Reschedule after a new period.
Definition at line 76 of file Periodic.hh.
|
inlinevirtualinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
protectedinherited |
|
protected |
Time period. Time unit is defined by the scheduler.
Definition at line 100 of file Periodic.hh.
|
protectedinherited |
Definition at line 94 of file Linkage.hh.
|
protectedinherited |
|
protectedinherited |
Double linked list pointers.
Definition at line 93 of file Linkage.hh.