#include <AH/Hardware/MultiPurposeButton.hpp>
Class for detecting short/long button presses and double clicks.
Definition at line 15 of file MultiPurposeButton.hpp.
◆ Event
Enumerator |
---|
None | Nothing changed.
|
PressStart | The button was just pressed.
|
ShortPressRelease | The button was released after a short press.
|
LongPress | The button has been pressed for some time.
|
LongPressRelease | The button was released after a long press.
|
MultiPress | The button was pressed in quick succession of the previous release.
|
MultiPressDone | The button has been released for long enough to rule out another MultiPress.
|
Definition at line 19 of file MultiPurposeButton.hpp.
◆ MultiPurposeButton()
◆ begin()
◆ update()
◆ getMultiPressCount()
uint8_t getMultiPressCount |
( |
| ) |
const |
|
inline |
Get the number of times the button was pressed in quick succession (after MultiPressDone), this is the final count.
Definition at line 68 of file MultiPurposeButton.hpp.
◆ getCurrentMultiPressCount()
uint8_t getCurrentMultiPressCount |
( |
| ) |
const |
|
inline |
Get the number of times the button was pressed in quick succession, while the button is being pressed (before MultiPressDone).
The count could still increase if the user keeps on pressing the button.
Definition at line 72 of file MultiPurposeButton.hpp.
◆ getLongPressDelay()
unsigned long getLongPressDelay |
( |
| ) |
const |
|
inline |
Get the number of milliseconds after which a press is considered a long press.
Definition at line 76 of file MultiPurposeButton.hpp.
◆ setLongPressDelay()
void setLongPressDelay |
( |
unsigned long |
longPressDelay | ) |
|
|
inline |
Set the number of milliseconds after which a press is considered a long press.
Definition at line 79 of file MultiPurposeButton.hpp.
◆ getMultiPressDelay()
unsigned long getMultiPressDelay |
( |
| ) |
const |
|
inline |
◆ setMultiPressDelay()
void setMultiPressDelay |
( |
unsigned long |
multiPressDelay | ) |
|
|
inline |
◆ previousBounceTime()
unsigned long previousBounceTime |
( |
| ) |
const |
|
inline |
◆ stableTime() [1/2]
unsigned long stableTime |
( |
| ) |
const |
|
inline |
◆ stableTime() [2/2]
unsigned long stableTime |
( |
unsigned long |
now | ) |
const |
|
inline |
◆ getPressedTime()
unsigned long getPressedTime |
( |
| ) |
const |
|
inline |
Get the number of milliseconds the button has been pressed for.
Returns 0 if the button is not currently pressed.
Definition at line 103 of file MultiPurposeButton.hpp.
◆ getLongPressedTime()
unsigned long getLongPressedTime |
( |
| ) |
const |
|
inline |
Get the number of milliseconds the button has been pressed for.
Returns 0 if the button is not currently pressed or if the current press is not a long press (yet).
Definition at line 109 of file MultiPurposeButton.hpp.
◆ getName()
◆ getButtonState()
◆ invert()
◆ button
◆ longPressDelay
unsigned long longPressDelay = 1000 |
|
protected |
◆ multiPressDelay
unsigned long multiPressDelay = 400 |
|
protected |
◆ longPress
◆ multiPressCountNew
uint8_t multiPressCountNew = 0 |
|
protected |
◆ multiPressCount
uint8_t multiPressCount = 0 |
|
protected |
The documentation for this class was generated from the following file: