Commanders
Arduino buttons/bus library
EventsSequencer Class Reference

#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

EventsSequencerItempFirst
 
EventsSequencerItempCurrent
 

Detailed Description

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.

Definition at line 45 of file EventsSequencer.hpp.

Constructor & Destructor Documentation

EventsSequencer::EventsSequencer ( )

Default constructor

Definition at line 6 of file EventsSequencer.cpp.

Member Function Documentation

void EventsSequencer::AddEvent ( unsigned long  inId,
COMMANDERS_EVENT_TYPE  inType,
int  inData,
unsigned long  inDelay 
)

Add a new event to the list.

Parameters
inIdid of the event
inTypetype
inDataassociated data
inDelaytime in milliseconds before the next event.

Definition at line 20 of file EventsSequencer.cpp.

void EventsSequencer::AddEvents ( const EventsSequencerItem apEvents)

Add an event list in program memory PROGMEM.

Parameters
apEventsList of events declared with PROGMEM

Definition at line 40 of file EventsSequencer.cpp.

void EventsSequencer::begin ( bool  inPerpetual)
inline

Begin of the EventsSequencer.

Parameters
inPerpetualif true, the sequencer will never stop, returning to the first item after the last one.

Definition at line 132 of file EventsSequencer.hpp.

void EventsSequencer::Continue ( )
inline

Continue the execution after a pause.

Definition at line 160 of file EventsSequencer.hpp.

bool EventsSequencer::IsPaused ( ) const
inline

Checks if the sequence is paused : the Pause() function has been called..

Returns
true if the sequence is paused.

Definition at line 127 of file EventsSequencer.hpp.

bool EventsSequencer::IsPerpetual ( ) const
inline

Checks if the sequence is perpetual : at the end, restart from the begginning.

Returns
true if the sequence is perpetual.

Definition at line 119 of file EventsSequencer.hpp.

bool EventsSequencer::IsPPointer ( ) const
inline

Checks if the sequence storage is in a PROGMEM container

Returns
true if the container has been declared with PROGMEM and added with AddEvents().

Definition at line 123 of file EventsSequencer.hpp.

bool EventsSequencer::loop ( )

Main loop of this sequencer

Returns
true if a new event has been raised.

Definition at line 125 of file EventsSequencer.cpp.

void EventsSequencer::loops ( )
static

Main loop of all sequencers

Definition at line 161 of file EventsSequencer.cpp.

void EventsSequencer::Pause ( )
inline

Pause the execution.

Definition at line 157 of file EventsSequencer.hpp.

void EventsSequencer::printAllSequencers ( )
static

Print all Sequencers on the console.

Remarks
Only available if COMMANDERS_PRINT_COMMANDERS is defined.

Definition at line 204 of file EventsSequencer.cpp.

void EventsSequencer::printSequencer ( )

Print this Sequencer on the console.

Remarks
Only available if COMMANDERS_PRINT_COMMANDERS is defined.

Definition at line 173 of file EventsSequencer.cpp.

void EventsSequencer::Start ( )
inline

Sets the current item to first to start the execution.

Definition at line 151 of file EventsSequencer.hpp.

void EventsSequencer::StartItem ( EventsSequencerItem inItem = NULL)

Sets the current item to first to start the execution.

Definition at line 88 of file EventsSequencer.cpp.

void EventsSequencer::Stop ( )
inline

Stops the execution by nulling the current item.

Definition at line 154 of file EventsSequencer.hpp.

Member Data Documentation

EventsSequencerItem* EventsSequencer::pCurrent

Current executed item.

Definition at line 110 of file EventsSequencer.hpp.

EventsSequencerItem* EventsSequencer::pFirst

First item of the chained list of sequences.

Definition at line 107 of file EventsSequencer.hpp.


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