|
roo_control
API Documentation for roo_control
|
An abstraction of a multi-state device. More...
#include <selector.h>
Public Member Functions | |
| virtual | ~Selector ()=default |
| virtual bool | getState (State &result) const =0 |
| Retrieves the current state, or returns false when it cannot be read. | |
An abstraction of a multi-state device.
This can represent a GPIO pushbutton, port extender, or software selector.
This abstraction serves two main purposes: 1) it makes it easy to swap the implementation of a selector, without changing the code that uses it. For example, you can start by connecting a simple connector to a GPIO port, but eventually upgrade to a port extender. You will not need to update the calling code (just the setup logic). 2) it allows building higher-level abstractions that are implementation-independent. For example, the DebouncingSelector (and its materialization, DebouncingBinarySelector) can be used to add debouncing on top of any switch implementation.
Definition at line 23 of file selector.h.
|
virtualdefault |
|
pure virtual |
Retrieves the current state, or returns false when it cannot be read.
Implemented in roo_control::BoundSelector< BinaryLogicalState >, roo_control::GpioConnector, roo_control::PushButton, roo_control::BoundSelector< State >, and roo_control::BoundSwitch< State >.
Referenced by roo_control::PushButton::tick().