5using roo_time::Duration;
14 : selector_(selector),
15 idle_state_(idle_state),
17 last_state_change_time_(Uptime::Now()),
18 prev_state_change_time_(last_state_change_time_),
19 last_click_time_(last_state_change_time_),
23 Uptime now = Uptime::Now();
26 if (!selector_.
getState(new_state))
return;
27 if (has_state_ && new_state == state_) {
36 prev_state_change_time_ = last_state_change_time_;
37 last_state_change_time_ = now;
39 if (state_ != idle_state_) {
50 last_click_time_ = now;
virtual bool getState(State &result) const =0
Retrieves the current state, or returns false when it cannot be read.
static constexpr Duration kLongPressInterval
static constexpr Duration kDebounceInterval
static constexpr Duration kDoubleClickDeadline
BinaryLogicalState
Binary logical state used by selectors and switches.