|
roo_control
API Documentation for roo_control
|
Represents a human-pressable momentary button. More...
#include <push_button.h>
Public Member Functions | |
| PushButton (BinarySelector &selector, BinaryLogicalState idle_state=BINARY_STATE_HIGH) | |
| bool | getState (BinaryLogicalState &result) const override |
| Retrieves the current state, or returns false when it cannot be read. | |
| void | tick () |
| Needs to be called periodically (every 5-10 ms). | |
Public Member Functions inherited from roo_control::Selector< BinaryLogicalState > | |
| virtual | ~Selector ()=default |
Protected Member Functions | |
| virtual void | onDown () |
| Hooks called from tick(). | |
| virtual void | onUp () |
| virtual void | onClick () |
| virtual void | onLongPress () |
| virtual void | onDoubleClick () |
Represents a human-pressable momentary button.
This class implements debouncing and provides a simple form of gesture detection.
Definition at line 12 of file push_button.h.
| roo_control::PushButton::PushButton | ( | BinarySelector & | selector, |
| BinaryLogicalState | idle_state = BINARY_STATE_HIGH |
||
| ) |
Definition at line 13 of file push_button.cpp.
|
inlineoverridevirtual |
Retrieves the current state, or returns false when it cannot be read.
Implements roo_control::Selector< BinaryLogicalState >.
Definition at line 17 of file push_button.h.
Definition at line 34 of file push_button.h.
Referenced by tick().
Definition at line 36 of file push_button.h.
Referenced by tick().
Hooks called from tick().
If you call tick() from a time-sensitive context, you may want to hand off the events to a queue in the implementation of these methods.
Definition at line 32 of file push_button.h.
Referenced by tick().
Definition at line 35 of file push_button.h.
Referenced by tick().
Definition at line 33 of file push_button.h.
Referenced by tick().
| void roo_control::PushButton::tick | ( | ) |
Needs to be called periodically (every 5-10 ms).
Definition at line 22 of file push_button.cpp.
References roo_control::Selector< State >::getState(), roo_control::kDebounceInterval, roo_control::kDoubleClickDeadline, roo_control::kLongPressInterval, onClick(), onDoubleClick(), onDown(), onLongPress(), and onUp().