Commanders
Arduino buttons/bus library
|
#include "EventsSequencer.hpp"
Public Member Functions | |
EventsSequencer () | |
bool | IsPerpetual () const |
bool | IsPPointer () const |
bool | IsPaused () const |
void | begin (bool inPerpetual) |
void | AddEvent (unsigned long inId, COMMANDERS_EVENT_TYPE inType, int inData, unsigned long inDelay) |
void | AddEvents (const EventsSequencerItem *apEvents) |
void | StartItem (EventsSequencerItem *inItem = NULL) |
void | Start () |
void | Stop () |
void | Pause () |
void | Continue () |
bool | loop () |
void | printSequencer () |
Static Public Member Functions | |
static void | loops () |
static void | printAllSequencers () |
Public Attributes | |
EventsSequencerItem * | pFirst |
EventsSequencerItem * | pCurrent |
This class represents an event sequencer : a list of events raised at given intervals. This is the way to program some animations using several lights/motors and other accessories.
The sequence can be started from the beginning or from any item of the list. When started, it can be completely stopped, or just paused. When paused, the timer is stopped and restart at its previous position when unpaused.
EventsSequencer::EventsSequencer | ( | ) |
Default constructor
void EventsSequencer::AddEvent | ( | unsigned long | inId, |
COMMANDERS_EVENT_TYPE | inType, | ||
int | inData, | ||
unsigned long | inDelay | ||
) |
Add a new event to the list.
inId | id of the event |
inType | type |
inData | associated data |
inDelay | time in milliseconds before the next event. |
void EventsSequencer::AddEvents | ( | const EventsSequencerItem * | apEvents | ) |
Add an event list in program memory PROGMEM.
apEvents | List of events declared with PROGMEM |
|
inline |
Begin of the EventsSequencer.
inPerpetual | if true, the sequencer will never stop, returning to the first item after the last one. |
|
inline |
Continue the execution after a pause.
|
inline |
Checks if the sequence is paused : the Pause() function has been called..
|
inline |
Checks if the sequence is perpetual : at the end, restart from the begginning.
|
inline |
Checks if the sequence storage is in a PROGMEM container
bool EventsSequencer::loop | ( | ) |
Main loop of this sequencer
|
static |
Main loop of all sequencers
|
inline |
Pause the execution.
|
static |
Print all Sequencers on the console.
void EventsSequencer::printSequencer | ( | ) |
Print this Sequencer on the console.
|
inline |
Sets the current item to first to start the execution.
void EventsSequencer::StartItem | ( | EventsSequencerItem * | inItem = NULL | ) |
Sets the current item to first to start the execution.
|
inline |
Stops the execution by nulling the current item.
EventsSequencerItem* EventsSequencer::pCurrent |
Current executed item.
EventsSequencerItem* EventsSequencer::pFirst |
First item of the chained list of sequences.