update button handling
This commit is contained in:
@ -8,8 +8,10 @@ class Buttons
|
||||
public:
|
||||
|
||||
static constexpr uint8_t PRESSED = 0;
|
||||
static constexpr uint8_t LONG_PRESSED = 1;
|
||||
static constexpr uint8_t RELEASED = 2;
|
||||
static constexpr uint8_t LONG_PRESSED = 1;
|
||||
static constexpr uint8_t LONG_RELEASED= 3;
|
||||
|
||||
|
||||
private:
|
||||
volatile uint8_t * const pinReg = &PIND;
|
||||
@ -31,7 +33,8 @@ void Buttons::tick()
|
||||
{
|
||||
if(readPin(pinReg, button[i]) == true)
|
||||
{
|
||||
if(buttonCount[i] > 2) _eventHandler(i, RELEASED, _userData);
|
||||
if(buttonCount[i] >= 100) _eventHandler(i, LONG_RELEASED, _userData);
|
||||
else if(buttonCount[i] >= 3)_eventHandler(i, RELEASED, _userData);
|
||||
buttonCount[i] = 0;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user