Commanders
Arduino buttons/bus library
|
#include "ButtonsCommanderPush.hpp"
Public Member Functions | |
ButtonsCommanderPush () | |
void | begin (unsigned long inId, int inButtonPin, COMMANDERS_EVENT_TYPE inEventType = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0) |
void | AddEvent (unsigned long inId, COMMANDERS_EVENT_TYPE inEventType = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0) |
unsigned long | loop () |
int | GetPin () const |
GPIO_pin_t | GetDIO2Pin () const |
![]() | |
ButtonsCommanderButton (unsigned long inId) | |
unsigned long | GetId () const |
virtual ButtonsCommanderButton * | GetFromId (unsigned long inId) |
virtual int | GetPosition () const |
virtual void | beforeFirstLoop () |
virtual void | EndLoop () |
void | SetNextButton (ButtonsCommanderButton *inpButton) |
ButtonsCommanderButton * | GetNextButton () const |
Additional Inherited Members | |
![]() | |
unsigned long | Id |
A push button is a hardware device giving a time limited impulsion. It will return one id at a time, passing through the whole list of Ids.
Events thrown:
reason | id | type | data |
---|---|---|---|
pin state to LOW | button id | event type | data |
ButtonsCommanderPush::ButtonsCommanderPush | ( | ) |
Default constructor.
void ButtonsCommanderPush::AddEvent | ( | unsigned long | inId, |
COMMANDERS_EVENT_TYPE | inEventType = COMMANDERS_EVENT_MOVEPOSITIONID , |
||
int | inData = 0 |
||
) |
A push button can throw different events when it is pressed. This function add a new event in the list. When the first press on push button is done, the main id/event type/data Event defined by begin(�) function will be thrown. At the following press, the first event of the list is thrown, and so on at each new press until the end of the list. At the end, the next event is the main one defined by begin.
inId | id of the button. |
inEventType | Event type used when the button is pressed. Default COMMANDERS_EVENT_MOVEPOSITIONID. |
inData | Associated data when the push button is pressed. Default 0. |
void ButtonsCommanderPush::begin | ( | unsigned long | inId, |
int | inButtonPin, | ||
COMMANDERS_EVENT_TYPE | inEventType = COMMANDERS_EVENT_MOVEPOSITIONID , |
||
int | inData = 0 |
||
) |
Initialize the instance.
inId | id of the button. |
inButtonPin | Arduino pin connected to the push button. |
inEventType | Event type used when the button is pressed. Default COMMANDERS_EVENT_MOVEPOSITIONID. |
inData | Associated data when the push button is pressed. Default 0. |
|
inline |
Gets the pin number connected to the push button, in DIO2 library format.
|
inline |
Gets the pin number connected to the push button.
|
virtual |
Main loop function.
Reimplemented from ButtonsCommanderButton.