#include "ButtonsCommanderSwitch.hpp"
|
static unsigned long | loopOnePin (unsigned long inId, GPIO_pin_t inPin, unsigned long inPreviousId, unsigned long inDebounceDelay, byte *inpLastPinState, unsigned long *inpLastDebounceTime, bool inSendEvent = true) |
|
This class describes a switch with a variable number of pins/positions. The common cases are handled by ButtonsCommanderSwitchOnePin and ButtonsCommanderSwitchTwoPins, but if you have a switch with any other number of positions, this class is for you !
Events thrown:
reason | id | type | data |
event pin state to HIGH | event id | Event Type | Event Data |
event pin state to LOW | nothing | |
ButtonsCommanderSwitch::ButtonsCommanderSwitch |
( |
| ) |
|
EventPin * ButtonsCommanderSwitch::AddEvent |
( |
unsigned long |
inId, |
|
|
int |
inPin, |
|
|
COMMANDERS_EVENT_TYPE |
inEvent = COMMANDERS_EVENT_MOVEPOSITIONID , |
|
|
int |
inData = 0 |
|
) |
| |
Each position of the switch can be defined with an Arduino pin, and an event definition... In this case of switch, there is an event when one pin is activated, but there is no OFF event for the inactivated pin.
- Parameters
-
inId | id of the position. |
inPin | Arduino pin connected to the button. |
inEvent | Event type used when the pin is activated. Default COMMANDERS_EVENT_MOVEPOSITIONID. |
inData | Associated data when the pin is activated. Default 0. |
void ButtonsCommanderSwitch::beforeFirstLoop |
( |
| ) |
|
|
virtual |
This function will be called after sketch Setup(), but before the first call to loop(). It will be called only one time.
Reimplemented from ButtonsCommanderButton.
void ButtonsCommanderSwitch::begin |
( |
| ) |
|
unsigned long ButtonsCommanderSwitch::GetId |
( |
GPIO_pin_t |
inPin, |
|
|
COMMANDERS_EVENT_TYPE * |
apEvent = NULL , |
|
|
int * |
apData = NULL |
|
) |
| const |
Gets the right id according to the activated pin.
unsigned long ButtonsCommanderSwitch::loop |
( |
| ) |
|
|
virtual |
unsigned long ButtonsCommanderSwitch::loopOnePin |
( |
unsigned long |
inId, |
|
|
GPIO_pin_t |
inPin, |
|
|
unsigned long |
inPreviousId, |
|
|
unsigned long |
inDebounceDelay, |
|
|
byte * |
inpLastPinState, |
|
|
unsigned long * |
inpLastDebounceTime, |
|
|
bool |
inSendEvent = true |
|
) |
| |
|
static |
Check if a pin has changed its state, and send an event if necessary.
The documentation for this class was generated from the following files:
- D:/Mes documents/Trusty/Arduino/Libraries/Commanders/src/ButtonsCommanderSwitch.hpp
- D:/Mes documents/Trusty/Arduino/Libraries/Commanders/src/ButtonsCommanderSwitch.cpp