16 bool flg_timeout = (msec - _lastClicked > _msecHold);
20 if (flg_timeout && !_press && _clickCount)
26 else { _clickCount = 0; }
38 _currentState = state;
44 bool disable_db = (msec - _lastMsec) > _msecDebounce;
45 auto oldPress = _press;
47 if (_raw_press != press)
50 _lastRawChange = msec;
52 if (disable_db || msec - _lastRawChange >= _msecDebounce)
54 if (press != (0 != oldPress))
61 std::uint32_t holdPeriod = msec - _lastChange;
62 _lastHoldPeriod = holdPeriod;
67 if (oldPress == 1 && (holdPeriod >= _msecHold))
70 state = button_state_t::state_hold;
78 state = button_state_t::state_clicked;