Commanders
Arduino buttons/bus library
|
#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 |
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...
|
inlinestatic |
Initialize the instance.
inStatusLedPin | This pin will start to blink at each event thrown. Default -1 for no status led. |
inBlinkDelay | Blinking delay for the status led. Default is 1000ms. |
|
inlinestatic |
Initialize the instance.
func | Event handler function called when an event is thrown. |
inStatusLedPin | This pin will start to blink at each event thrown. Default -1 for no status led. |
inBlinkDelay | Blinking delay for the status led. Default is 1000ms. |
|
inlinestatic |
Get the last config address used.
|
inlinestatic |
Get the last event data thrown.
|
inlinestatic |
Get the last event type thrown.
|
static |
Main loop function. This function will call all necessary internal loop functions for each commander activated...
|
static |
Print on the console the given event in plain English.
|
static |
Print on the console the given associated data.
|
static |
Print on the console the given moving type in plain English.
|
static |
Print on the console the given type in plain English.
|
static |
Raise a new event.
inId | Id of the new event. |
inEvent | Type of the new event. Default is COMMANDERS_EVENT_MOVEPOSITIONID. |
inData | Associated data to the event type. Default is 0. |
|
inlinestatic |
Force the data associated with the last event type.
|
inlinestatic |
Force the kind of last event type.
inEvent | New event type. |
|
static |
Start blinking the status led.
|
static |
Blinking delay for the status led.
|
static |
This pin will start to blink at each event thrown.