![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Manages button input and state with interrupt support. More...
#include <ButtonHandler.h>
Static Public Member Functions | |
static void | Initialize (uint8_t pin, uint8_t maxValue, uint16_t holdingToggle) |
Initializes the ButtonHandler with specified parameters. | |
static bool | GetHoldingState () |
Retrieves the holding state of the button. | |
static uint8_t | GetValue () |
Retrieves the current value of the button. | |
Static Private Member Functions | |
static void | isr () |
Interrupt service routine (ISR) for handling button presses. | |
Static Private Attributes | |
static long | previousMillisISR |
Tracks the last interrupt service routine (ISR) trigger time in milliseconds. | |
static long | previousMillisHold |
Tracks the last hold event time in milliseconds. | |
static uint16_t | holdingToggle |
Time threshold for detecting holding behavior in milliseconds. | |
static uint8_t | currentValue |
The current value of the button (e.g., press count). | |
static uint8_t | maxValue |
The maximum value for the button press count. | |
static uint8_t | pin |
The pin number associated with the button. | |
static bool | holdingState |
Indicates whether the button is in a holding state. | |
Manages button input and state with interrupt support.
The ButtonHandler class provides static methods for initializing a button, handling button press and hold logic, and retrieving the current state and value.
Definition at line 23 of file ButtonHandler.h.
|
static |
Retrieves the holding state of the button.
Definition at line 29 of file ButtonHandler.cpp.
References holdingState, holdingToggle, pin, and previousMillisHold.
|
static |
Retrieves the current value of the button.
Definition at line 42 of file ButtonHandler.cpp.
References currentValue.
Referenced by ProtogenArtleckAnimation::Update(), and WaffleDaProtoAnimation::Update().
Initializes the ButtonHandler with specified parameters.
pin | The pin number associated with the button. |
maxValue | The maximum value for the button press count. |
holdingToggle | The time threshold for detecting holding behavior in milliseconds. |
Definition at line 20 of file ButtonHandler.cpp.
References holdingToggle, isr(), maxValue, and pin.
Referenced by NukudeFaceAnimation::NukudeFaceAnimation(), ProtogenArtleckAnimation::ProtogenArtleckAnimation(), and WaffleDaProtoAnimation::WaffleDaProtoAnimation().
|
staticprivate |
Interrupt service routine (ISR) for handling button presses.
Definition at line 11 of file ButtonHandler.cpp.
References currentValue, maxValue, and previousMillisISR.
Referenced by Initialize().
|
staticprivate |
The current value of the button (e.g., press count).
Definition at line 28 of file ButtonHandler.h.
Referenced by GetValue(), and isr().
|
staticprivate |
Indicates whether the button is in a holding state.
Definition at line 31 of file ButtonHandler.h.
Referenced by GetHoldingState().
|
staticprivate |
Time threshold for detecting holding behavior in milliseconds.
Definition at line 27 of file ButtonHandler.h.
Referenced by GetHoldingState(), and Initialize().
|
staticprivate |
The maximum value for the button press count.
Definition at line 29 of file ButtonHandler.h.
Referenced by Initialize(), and isr().
|
staticprivate |
The pin number associated with the button.
Definition at line 30 of file ButtonHandler.h.
Referenced by GetHoldingState(), and Initialize().
|
staticprivate |
Tracks the last hold event time in milliseconds.
Definition at line 26 of file ButtonHandler.h.
Referenced by GetHoldingState().
|
staticprivate |
Tracks the last interrupt service routine (ISR) trigger time in milliseconds.
Definition at line 25 of file ButtonHandler.h.
Referenced by isr().