8 #ifndef NO_BUTTONSCOMMANDER 9 #ifndef NO_BUTTONSCOMMANDERPUSH 13 this->buttonPin = (GPIO_pin_t)DP_INVALID;
14 this->lastButtonState = HIGH;
15 this->lastDebounceTime = 0;
16 this->debounceDelay = 50;
22 this->buttonPin = Arduino_to_GPIO_pin(inButtonPin);
24 pinMode2f(this->buttonPin, INPUT_PULLUP);
27 this->
AddEvent(inId, inEventType, inData);
36 pEvent->
Data = inData;
42 #ifdef COMMANDERS_DEBUG_MODE 43 if (this->Events.
pFirst == NULL)
44 Serial.println(F(
"This push button have no ID defined : call begin() !"));
48 if (this->buttonPin == DP_INVALID)
52 int reading = digitalRead2f(this->buttonPin);
59 if (reading != this->lastButtonState)
62 this->lastDebounceTime = millis();
65 if (this->lastDebounceTime > 0 && (millis() - this->lastDebounceTime) > this->debounceDelay)
71 if (reading == this->lastButtonState)
79 this->Events.pCurrentItem->Obj->Data);
84 this->lastDebounceTime = 0;
89 this->lastButtonState = reading;
93 #ifdef COMMANDERS_PRINT_COMMANDERS 94 void ButtonsCommanderPush::printCommander()
96 Serial.print(F(
" Push - Pin :"));
97 Serial.println(this->
GetPin());
100 while (pCurr != NULL)
102 Serial.print(F(
" Event Id: "));
103 Serial.print(pCurr->
Obj->
Id);
104 Serial.print(F(
" / Event type: "));
107 Serial.println(F(
""));
109 pCurr = pCurr->
pNext;
CMDRSCHAINEDLISTITEM * pNext
COMMANDERS_EVENT_TYPE EventType
static void printEventData(COMMANDERS_EVENT_TYPE inEventType, int inEventData)
CMDRSCHAINEDLISTITEM< T > * pCurrentItem
CMDRSCHAINEDLISTITEM< T > * pFirst
static unsigned long RaiseEvent(unsigned long inId, COMMANDERS_EVENT_TYPE inEvent = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0)
static void printEventType(COMMANDERS_EVENT_TYPE inEventType, bool inDataFollow)