2018-07-23 08:25:23 +02:00
|
|
|
#ifdef HAS_BUTTON
|
|
|
|
|
|
|
|
#include "globals.h"
|
2018-07-23 13:20:06 +02:00
|
|
|
#include "senddata.h"
|
2018-07-23 08:25:23 +02:00
|
|
|
|
|
|
|
// 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);
|
2018-08-03 23:50:04 +02:00
|
|
|
EnqueueSendData(BUTTONPORT, payload.getBuffer(), payload.getSize());
|
2018-07-23 08:25:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|