#include "ButtonsCommanderSwitchTwoPins.hpp"
Public Member Functions | |
ButtonsCommanderSwitchTwoPins () | |
void | begin (unsigned long inId1, int inPin1, unsigned long inId2, int inPin2) |
void | beforeFirstLoop () |
unsigned long | loop () |
unsigned long | GetId (GPIO_pin_t inPin) const |
![]() | |
ButtonsCommanderButton (unsigned long inId) | |
unsigned long | GetId () const |
virtual ButtonsCommanderButton * | GetFromId (unsigned long inId) |
virtual int | GetPosition () const |
virtual void | EndLoop () |
void | SetNextButton (ButtonsCommanderButton *inpButton) |
ButtonsCommanderButton * | GetNextButton () const |
Additional Inherited Members | |
![]() | |
unsigned long | Id |
A switch can be used in a A/B way, or A/Neutral/B. In this case only two Arduino pins are connected to the switch. The event raised is always of type COMMANDERS_EVENT_MOVE and data is COMMANDERS_MOVE_ON or COMMANDERS_MOVE_OFF, but the id used depends on the activated pin. The pins are independant, but probably when one is activated, the other is disactivated. In a case of a central/neutral position is available on the switch, none of the pins will be activated !
Events thrown:
reason | id | type | data |
---|---|---|---|
event pin1 state to HIGH | event id1 | COMMANDERS_EVENT_MOVE | COMMANDERS_MOVE_ON |
event pin1 state to LOW | event id1 | COMMANDERS_EVENT_MOVE | COMMANDERS_MOVE_OFF |
event pin2 state to HIGH | event id2 | COMMANDERS_EVENT_MOVE | COMMANDERS_MOVE_ON |
event pin2 state to LOW | event id2 | COMMANDERS_EVENT_MOVE | COMMANDERS_MOVE_OFF |
Definition at line 25 of file ButtonsCommanderSwitchTwoPins.hpp.
ButtonsCommanderSwitchTwoPins::ButtonsCommanderSwitchTwoPins | ( | ) |
Default constructor.
Definition at line 11 of file ButtonsCommanderSwitchTwoPins.cpp.
|
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.
Definition at line 31 of file ButtonsCommanderSwitchTwoPins.cpp.
void ButtonsCommanderSwitchTwoPins::begin | ( | unsigned long | inId1, |
int | inPin1, | ||
unsigned long | inId2, | ||
int | inPin2 | ||
) |
Initialize the instance.
inId1 | id of the first position. |
inPin1 | Arduino pin connected to the switch button for the first position. |
inId2 | id of the second position. |
inPin2 | Arduino pin connected to the switch button for the second position. |
Definition at line 16 of file ButtonsCommanderSwitchTwoPins.cpp.
|
inline |
Gets the right id according to the activated pin.
Definition at line 57 of file ButtonsCommanderSwitchTwoPins.hpp.
|
virtual |
Main loop function.
Reimplemented from ButtonsCommanderButton.
Definition at line 53 of file ButtonsCommanderSwitchTwoPins.cpp.