#include <AH/Hardware/IncrementButton.hpp>
A class for buttons that increment some counter or setting.
It behaves the same way as a computer keyboard: when you press the button, it increments the counter once. If you keep on pressing it for longer than a certain threshold, it keeps on incrementing at a faster rate, until you release it.
Definition at line 19 of file IncrementButton.hpp.
Public Types | |
enum | State { Nothing = 0 , IncrementShort , IncrementLong , IncrementHold , ReleasedShort , ReleasedLong } |
An enumeration of the different actions to be performed by the counter. More... | |
Public Member Functions | |
IncrementButton (const Button &button) | |
Create a IncrementButton. | |
void | begin () |
State | update () |
Update and return the state of the increment button. | |
State | getState () const |
Return the state of the increment button without updating it. | |
void | invert () |
Protected Member Functions | |
State | updateImplementation () |
Private Types | |
enum | { Initial , LongPress } |
Private Attributes | |
Button | button |
enum AH::IncrementButton:: { ... } | longPressState = Initial |
unsigned long | longPressRepeat |
State | state = Nothing |
An enumeration of the different actions to be performed by the counter.
Definition at line 38 of file IncrementButton.hpp.
Enumerator | |
---|---|
Initial | |
LongPress |
Definition at line 68 of file IncrementButton.hpp.
|
inline |
Create a IncrementButton.
button | The button to read from. The button is copied. |
Definition at line 28 of file IncrementButton.hpp.
|
inline |
Definition at line 31 of file IncrementButton.hpp.
|
inline |
Update and return the state of the increment button.
Definition at line 50 of file IncrementButton.hpp.
|
inline |
Return the state of the increment button without updating it.
Returns the same value as the last update call.
Definition at line 57 of file IncrementButton.hpp.
|
inline |
Definition at line 60 of file IncrementButton.hpp.
|
protected |
Definition at line 5 of file IncrementButton.cpp.
|
private |
Definition at line 66 of file IncrementButton.hpp.
enum { ... } longPressState |
Definition at line 72 of file IncrementButton.hpp.
Definition at line 74 of file IncrementButton.hpp.