#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 22 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. More... | |
void | begin () |
State | update () |
Update and return the state of the increment button. More... | |
State | getState () const |
Return the state of the increment button without updating it. More... | |
void | invert () |
Protected Member Functions | |
State | updateImplementation () |
Private Types | |
enum | { Initial , LongPress } |
Private Attributes | |
Button | button |
enum IncrementButton:: { ... } | longPressState = Initial |
unsigned long | longPressRepeat |
State | state = Nothing |
enum State |
An enumeration of the different actions to be performed by the counter.
Definition at line 41 of file IncrementButton.hpp.
|
private |
Enumerator | |
---|---|
Initial | |
LongPress |
Definition at line 71 of file IncrementButton.hpp.
|
inline |
Create a IncrementButton.
button | The button to read from. The button is copied. |
Definition at line 31 of file IncrementButton.hpp.
|
inline |
Definition at line 34 of file IncrementButton.hpp.
|
inline |
Update and return the state of the increment button.
Definition at line 53 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 60 of file IncrementButton.hpp.
|
inline |
Definition at line 63 of file IncrementButton.hpp.
|
protected |
Definition at line 7 of file IncrementButton.cpp.
|
private |
Definition at line 69 of file IncrementButton.hpp.
enum { ... } longPressState |
|
private |
Definition at line 75 of file IncrementButton.hpp.
Definition at line 77 of file IncrementButton.hpp.