21 lines
415 B
C++
21 lines
415 B
C++
|
#ifdef HAS_BUTTON
|
||
|
|
||
|
#include "globals.h"
|
||
|
|
||
|
// Local logging tag
|
||
|
static const char TAG[] = "main";
|
||
|
|
||
|
void IRAM_ATTR ButtonIRQ() { ButtonPressedIRQ++; }
|
||
|
|
||
|
void readButton() {
|
||
|
if (ButtonPressedIRQ) {
|
||
|
portENTER_CRITICAL(&timerMux);
|
||
|
ButtonPressedIRQ = 0;
|
||
|
portEXIT_CRITICAL(&timerMux);
|
||
|
ESP_LOGI(TAG, "Button pressed");
|
||
|
payload.reset();
|
||
|
payload.addButton(0x01);
|
||
|
senddata(BUTTONPORT);
|
||
|
}
|
||
|
}
|
||
|
#endif
|