A class that represents a clickable object, like a button, and its associated logic.
More...
#include <clickable.hpp>
|
| LSH_OPTIONAL_CONSTEXPR_CTOR | Clickable (uint8_t pin) noexcept |
| | Construct a new Clickable object, conventional IO version.
|
| |
| template<uint8_t Pin> |
| LSH_OPTIONAL_CONSTEXPR_CTOR | Clickable (lsh::core::PinTag< Pin >) noexcept |
| | Construct a clickable from a compile-time pin tag on the slow-I/O path.
|
| |
| auto | getState () const -> bool |
| | Get the state of the clickable if configured as INPUT with its external pulldown resistor (PIN -> BUTTON -> +12v/+5V).
|
| |
| void | setIndex (uint8_t indexToSet) |
| | Store the dense runtime index assigned by the generated static profile.
|
| |
| auto | getIndex () const -> uint8_t |
| | Return the dense runtime index assigned by the generated static profile.
|
| |
| auto | clickDetection (uint16_t elapsed_ms, uint8_t detectionFlags, uint16_t longClick_ms, uint16_t superLongClick_ms) -> constants::ClickResult |
| | Advance the click FSM with fully generated static configuration.
|
| |
|
template<uint8_t DetectionFlags, uint16_t LongClick_ms, uint16_t SuperLongClick_ms> |
| auto | clickDetection (uint16_t elapsed_ms) -> constants::ClickResult |
| | Advance the click FSM with fully generated compile-time constants.
|
| |
A class that represents a clickable object, like a button, and its associated logic.
◆ Clickable() [1/2]
| LSH_OPTIONAL_CONSTEXPR_CTOR Clickable::Clickable |
( |
uint8_t |
pin | ) |
|
|
inlineexplicitnoexcept |
Construct a new Clickable object, conventional IO version.
- Parameters
-
◆ Clickable() [2/2]
Construct a clickable from a compile-time pin tag on the slow-I/O path.
The tag keeps the configuration DSL uniform even when the build uses the portable Arduino input path.
◆ clickDetection()
| auto Clickable::clickDetection |
( |
uint16_t |
elapsed_ms, |
|
|
uint8_t |
detectionFlags, |
|
|
uint16_t |
longClick_ms, |
|
|
uint16_t |
superLongClick_ms |
|
) |
| -> constants::ClickResult
|
|
inline |
Advance the click FSM with fully generated static configuration.
The selected TOML profile already knows which click kinds are enabled and which thresholds they use. Passing those values as constants keeps the object free from static configuration bytes and lets the generated scan path constant-fold disabled checks.
- Parameters
-
| elapsed_ms | Milliseconds elapsed since the previous clickable scan. |
| detectionFlags | Bit mask from constants::clickDetection. |
| longClick_ms | Long-click threshold for this clickable. |
| superLongClick_ms | Super-long-click threshold for this clickable. |
- Returns
- constants::ClickResult The detected click event, or
NO_CLICK.
◆ getIndex()
| auto Clickable::getIndex |
( |
| ) |
const -> uint8_t |
Return the dense runtime index assigned by the generated static profile.
- Returns
- uint8_t Clickable index.
◆ getState()
| auto Clickable::getState |
( |
| ) |
const -> bool
|
|
inline |
Get the state of the clickable if configured as INPUT with its external pulldown resistor (PIN -> BUTTON -> +12v/+5V).
- Returns
- true if clicked.
-
false if not clicked.
◆ setIndex()
| void Clickable::setIndex |
( |
uint8_t |
indexToSet | ) |
|
Store the dense runtime index assigned by the generated static profile.
- Parameters
-
| indexToSet | Dense clickable index. |
The documentation for this class was generated from the following files: