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.

Constructor & Destructor Documentation

EventsSequencer::EventsSequencer ( )

Default constructor

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.
void EventsSequencer::AddEvents ( const EventsSequencerItem apEvents)

Add an event list in program memory PROGMEM.

Parameters
apEventsList of events declared with PROGMEM
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.
void EventsSequencer::Continue ( )
inline

Continue the execution after a pause.

bool EventsSequencer::IsPaused ( ) const
inline

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

Returns
true if the sequence is paused.
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.
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().
bool EventsSequencer::loop ( )

Main loop of this sequencer

Returns
true if a new event has been raised.
void EventsSequencer::loops ( )
static

Main loop of all sequencers

void EventsSequencer::Pause ( )
inline

Pause the execution.

void EventsSequencer::printAllSequencers ( )
static

Print all Sequencers on the console.

Remarks
Only available if COMMANDERS_PRINT_COMMANDERS is defined.
void EventsSequencer::printSequencer ( )

Print this Sequencer on the console.

Remarks
Only available if COMMANDERS_PRINT_COMMANDERS is defined.
void EventsSequencer::Start ( )
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.

void EventsSequencer::Stop ( )
inline

Stops the execution by nulling the current item.

Member Data Documentation

EventsSequencerItem* EventsSequencer::pCurrent

Current executed item.

EventsSequencerItem* EventsSequencer::pFirst

First item of the chained list of sequences.


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