Commanders
Arduino buttons/bus library
Commanders Class Reference

#include "Commanders.hpp"

Static Public Member Functions

static void begin (int inStatusLedPin = -1, unsigned int inBlinkDelay = 1000)
 
static void begin (CommandersEventHandlerFunction func, int inStatusLedPin = -1, unsigned int inBlinkDelay = 1000)
 
static unsigned long loop ()
 
static COMMANDERS_EVENT_TYPE GetLastEventType ()
 
static int GetLastEventData ()
 
static void SetLastEventType (COMMANDERS_EVENT_TYPE inEvent)
 
static void SetLastEventData (int inData)
 
static uint8_t GetLastConfigAddress ()
 
static void StatusBlink ()
 
static unsigned long RaiseEvent (unsigned long inId, COMMANDERS_EVENT_TYPE inEvent = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0)
 
static void printEventMoveType (COMMANDERS_MOVE_TYPE inMoveType)
 
static void printEventData (COMMANDERS_EVENT_TYPE inEventType, int inEventData)
 
static void printEventType (COMMANDERS_EVENT_TYPE inEventType, bool inDataFollow)
 
static void printEvent (unsigned long inId, COMMANDERS_EVENT_TYPE inEventType, int inEventData)
 

Static Public Attributes

static GPIO_pin_t StatusLedPin = DP_INVALID
 
static unsigned int BlinkDelay = 1000
 

Detailed Description

This is the main class of the library. All data and functions are static. There is no way to instantiate this class.

To handle events from external hardware of buses, there is two ways:

An event handler can be defined. This function will be called as soon as an event is thrown by any commander. The second way is to get event id, type and data from the Commanders.loop() function inside the main loop of the sketch.

The two ways cannot be used together...

Definition at line 22 of file Commanders.hpp.

Member Function Documentation

static void Commanders::begin ( int  inStatusLedPin = -1,
unsigned int  inBlinkDelay = 1000 
)
inlinestatic

Initialize the instance.

Parameters
inStatusLedPinThis pin will start to blink at each event thrown. Default -1 for no status led.
inBlinkDelayBlinking delay for the status led. Default is 1000ms.

Definition at line 41 of file Commanders.hpp.

static void Commanders::begin ( CommandersEventHandlerFunction  func,
int  inStatusLedPin = -1,
unsigned int  inBlinkDelay = 1000 
)
inlinestatic

Initialize the instance.

Parameters
funcEvent handler function called when an event is thrown.
inStatusLedPinThis pin will start to blink at each event thrown. Default -1 for no status led.
inBlinkDelayBlinking delay for the status led. Default is 1000ms.

Definition at line 65 of file Commanders.hpp.

static uint8_t Commanders::GetLastConfigAddress ( )
inlinestatic

Get the last config address used.

Returns
last config address used.
Remarks
Not yet implemented.

Definition at line 98 of file Commanders.hpp.

static int Commanders::GetLastEventData ( )
inlinestatic

Get the last event data thrown.

Returns
Data associated with the last event.

Definition at line 84 of file Commanders.hpp.

static COMMANDERS_EVENT_TYPE Commanders::GetLastEventType ( )
inlinestatic

Get the last event type thrown.

Returns
Type of the event.

Definition at line 80 of file Commanders.hpp.

unsigned long Commanders::loop ( )
static

Main loop function. This function will call all necessary internal loop functions for each commander activated...

Returns
Id of the activated item. Use GetLastEvent* functions to get the complete event.

Definition at line 124 of file Commanders.cpp.

static void Commanders::printEvent ( unsigned long  inId,
COMMANDERS_EVENT_TYPE  inEventType,
int  inEventData 
)
static

Print on the console the given event in plain English.

Remarks
Only available if COMMANDERS_DEBUG_MODE or COMMANDERS_PRINT_COMMANDERS is defined.
static void Commanders::printEventData ( COMMANDERS_EVENT_TYPE  inEventType,
int  inEventData 
)
static

Print on the console the given associated data.

Remarks
Only available if COMMANDERS_DEBUG_MODE or COMMANDERS_PRINT_COMMANDERS is defined.
static void Commanders::printEventMoveType ( COMMANDERS_MOVE_TYPE  inMoveType)
static

Print on the console the given moving type in plain English.

Remarks
Only available if COMMANDERS_DEBUG_MODE or COMMANDERS_PRINT_COMMANDERS is defined.
static void Commanders::printEventType ( COMMANDERS_EVENT_TYPE  inEventType,
bool  inDataFollow 
)
static

Print on the console the given type in plain English.

Remarks
Only available if COMMANDERS_DEBUG_MODE or COMMANDERS_PRINT_COMMANDERS is defined.
unsigned long Commanders::RaiseEvent ( unsigned long  inId,
COMMANDERS_EVENT_TYPE  inEvent = COMMANDERS_EVENT_MOVEPOSITIONID,
int  inData = 0 
)
static

Raise a new event.

Parameters
inIdId of the new event.
inEventType of the new event. Default is COMMANDERS_EVENT_MOVEPOSITIONID.
inDataAssociated data to the event type. Default is 0.
Returns
Id of this event.

Definition at line 27 of file Commanders.cpp.

static void Commanders::SetLastEventData ( int  inData)
inlinestatic

Force the data associated with the last event type.

Remarks
Undocumented internal function.

Definition at line 93 of file Commanders.hpp.

static void Commanders::SetLastEventType ( COMMANDERS_EVENT_TYPE  inEvent)
inlinestatic

Force the kind of last event type.

Parameters
inEventNew event type.
Remarks
Undocumented internal function.

Definition at line 89 of file Commanders.hpp.

void Commanders::StatusBlink ( )
static

Start blinking the status led.

Definition at line 18 of file Commanders.cpp.

Member Data Documentation

unsigned int Commanders::BlinkDelay = 1000
static

Blinking delay for the status led.

Definition at line 35 of file Commanders.hpp.

GPIO_pin_t Commanders::StatusLedPin = DP_INVALID
static

This pin will start to blink at each event thrown.

Definition at line 33 of file Commanders.hpp.


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