|
AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
|
ESP32 interrupt-driven button with debouncing. More...
#include <button.h>
Public Member Functions | |
| Button (uint8_t PIN) | |
| Constructs a Button for the given GPIO pin. | |
| void | setup () override |
| Configures the GPIO pin as input with pull-up. | |
| void | isr () |
| ISR entry point — call from an IRAM_ATTR interrupt handler. | |
| bool | event () override |
| Checks for a press event and clears the flag. | |
| void | reset () override |
| Clears the pressed flag. | |
| Button (uint8_t PIN) | |
| Constructs a Button for the given pin. | |
| void | setup () override |
| Configures the pin as input with pull-up. | |
| void | isr () |
| Interrupt service routine — call from a CHANGE ISR. | |
| bool | event () override |
| Consumes and returns a pending press event. | |
| void | reset () override |
| Clears any pending press event. | |
Public Member Functions inherited from IButton | |
| virtual | ~IButton ()=default |
Public Attributes | |
| volatile uint8_t | pressCount = 0 |
| Incremented by ISR, decremented by event() | |
| volatile bool | awaitingRelease = false |
| True after press, until pin goes HIGH. | |
| unsigned long | lastDebounceTime = 0 |
| Timestamp of last accepted press. | |
| unsigned long | debounceDelay = 100 |
| Debounce window in milliseconds. | |
ESP32 interrupt-driven button with debouncing.
nRF52840-specific implementation of IButton interface
Implements IButton using hardware GPIO interrupts and millis()-based debouncing. isr() must be called from an IRAM_ATTR interrupt handler attached with attachInterrupt().
Interrupt-driven button with software debouncing. Attach isr() to a CHANGE interrupt on the button pin. digitalRead() is used inside isr() to filter release edges.
Definition at line 13 of file esp32/include/button.h.
|
explicit |
Constructs a Button for the given GPIO pin.
| PIN | GPIO pin number |
Definition at line 7 of file esp32/src/button.cpp.
|
explicit |
Constructs a Button for the given pin.
| PIN | GPIO pin number |
|
overridevirtual |
Checks for a press event and clears the flag.
Implements IButton.
Definition at line 40 of file esp32/src/button.cpp.
|
overridevirtual |
Consumes and returns a pending press event.
Implements IButton.
| void Button::isr | ( | ) |
ISR entry point — call from an IRAM_ATTR interrupt handler.
Applies debouncing and sets the pressed flag if a valid press is detected.
Definition at line 20 of file esp32/src/button.cpp.
| void Button::isr | ( | ) |
Interrupt service routine — call from a CHANGE ISR.
Filters release edges via digitalRead and applies debouncing.
|
overridevirtual |
Clears the pressed flag.
Call before attachInterrupt() to discard any stale press.
Implements IButton.
Definition at line 50 of file esp32/src/button.cpp.
|
overridevirtual |
Clears any pending press event.
Implements IButton.
|
overridevirtual |
Configures the GPIO pin as input with pull-up.
Must be called before attachInterrupt().
Implements IButton.
Definition at line 9 of file esp32/src/button.cpp.
|
overridevirtual |
Configures the pin as input with pull-up.
Implements IButton.
| volatile bool Button::awaitingRelease = false |
True after press, until pin goes HIGH.
Definition at line 25 of file esp32/include/button.h.
| unsigned long Button::debounceDelay = 100 |
Debounce window in milliseconds.
Minimum ms between accepted events.
Definition at line 27 of file esp32/include/button.h.
| unsigned long Button::lastDebounceTime = 0 |
Timestamp of last accepted press.
Timestamp of last accepted ISR.
Definition at line 26 of file esp32/include/button.h.
| volatile uint8_t Button::pressCount = 0 |
Incremented by ISR, decremented by event()
Incremented by ISR; decremented by event()
Definition at line 24 of file esp32/include/button.h.