AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
Loading...
Searching...
No Matches
esp32/include/button.h
Go to the documentation of this file.
1#pragma once
2#include "i_button.h"
3#include <Arduino.h>
4
13class Button : public IButton
14{
15private:
16 uint8_t PIN;
21 bool isDebounced(unsigned long now) const;
22
23public:
24 volatile uint8_t pressCount = 0;
25 volatile bool awaitingRelease = false;
26 unsigned long lastDebounceTime = 0;
27 unsigned long debounceDelay = 100;
33 explicit Button(uint8_t PIN);
34
40 void setup() override;
41
47 void isr();
48
53 bool event() override;
54
60 void reset() override;
61};
ESP32 interrupt-driven button with debouncing.
void setup() override
Configures the GPIO pin as input with pull-up.
volatile bool awaitingRelease
True after press, until pin goes HIGH.
volatile uint8_t pressCount
Incremented by ISR, decremented by event()
unsigned long lastDebounceTime
Timestamp of last accepted press.
void isr()
ISR entry point — call from an IRAM_ATTR interrupt handler.
unsigned long debounceDelay
Debounce window in milliseconds.
void reset() override
Clears the pressed flag.
bool event() override
Checks for a press event and clears the flag.
Interface for interrupt-driven button input.
Definition i_button.h:12