187dbd40af
Hib should be instantiate on the heap (new Hib()) because of memory overflow on the stack (c.f. https://github.com/esp8266/Arduino/issues/2667)
25 lines
517 B
C++
25 lines
517 B
C++
#pragma once
|
|
#include "Arduino.h"
|
|
extern "C" {
|
|
#include "osapi.h"
|
|
}
|
|
// Human Interface Button
|
|
class HIB {
|
|
private:
|
|
ETSTimer timer;
|
|
unsigned long previousMillis;
|
|
unsigned long longPressMsec;
|
|
|
|
public:
|
|
uint8_t pin;
|
|
uint8_t initialState;
|
|
uint8_t state;
|
|
uint8_t debouncing;
|
|
HIB(uint8_t pin, uint8_t initialState, unsigned long longPressMsec = 5000);
|
|
void IRQ_handler();
|
|
void onButtonPressed();
|
|
void onButtonReleased();
|
|
void onLongButtonPressed();
|
|
void invertState();
|
|
};
|