AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
Loading...
Searching...
No Matches
nrf52840/include/button.h
Go to the documentation of this file.
1
#pragma once
2
#include "
i_button.h
"
3
#include <cstdint>
4
13
class
Button
:
public
IButton
14
{
15
private
:
16
uint8_t PIN;
17
bool
isDebounced(
unsigned
long
now)
const
;
18
19
public
:
20
volatile
uint8_t
pressCount
= 0;
21
volatile
bool
awaitingRelease
=
false
;
22
unsigned
long
lastDebounceTime
= 0;
23
unsigned
long
debounceDelay
= 100;
29
explicit
Button
(uint8_t PIN);
30
32
void
setup
()
override
;
33
39
void
isr
();
40
45
bool
event
()
override
;
46
48
void
reset
()
override
;
49
};
Button
ESP32 interrupt-driven button with debouncing.
Definition
esp32/include/button.h:14
Button::setup
void setup() override
Configures the pin as input with pull-up.
Button::awaitingRelease
volatile bool awaitingRelease
True after press, until pin goes HIGH.
Definition
esp32/include/button.h:25
Button::pressCount
volatile uint8_t pressCount
Incremented by ISR, decremented by event()
Definition
esp32/include/button.h:24
Button::Button
Button(uint8_t PIN)
Constructs a Button for the given pin.
Button::lastDebounceTime
unsigned long lastDebounceTime
Timestamp of last accepted press.
Definition
esp32/include/button.h:26
Button::isr
void isr()
Interrupt service routine — call from a CHANGE ISR.
Button::debounceDelay
unsigned long debounceDelay
Debounce window in milliseconds.
Definition
esp32/include/button.h:27
Button::reset
void reset() override
Clears any pending press event.
Button::event
bool event() override
Consumes and returns a pending press event.
IButton
Interface for interrupt-driven button input.
Definition
i_button.h:12
i_button.h
lib
hardware
nrf52840
include
button.h
Generated by
1.9.8