Entry states: IS_UP, IS_DOWN

Assumption: state is stored per-button, and OTHER BUTTON events are always processed before the actual button. Stored state per button is a single bit (up/down), a single state for the state machine across the device is sufficient.

Start the state machine with IS_UP or IS_DOWN based on the button's bit, any OTHER BUTTON event will reset it to that state anyway, so the state can be re-used for the new button.

Entry states: IS_UP, IS_DOWN...

Entry state: DISABLED

Only set on devices that have button debouncing disabled. This state is effectively a noop, it just forwards the events as they come in and returns back to the same state.
Entry state: DISABLED...
button
press
button...
button
release
button...
DISABLED
DISABLED
button
press
button...
notify
button
press
notify...
button
release
button...
notify
button
release
notify...
other
button
other...
IS_UP
IS_UP
button
press
button...
IS_DOWN_WAITING
IS_DOWN_WAITING
IS_UP_DELAYING
IS_UP_DELAYING
notify
button
release
notify...
notify
button
press
notify...
IS_UP
IS_UP
notify
button
release
notify...
IS_DOWN_DETECTING_SPURIOUS
IS_DOWN_DETECTING_SPURIOUS
spurious
enabled?
spurious...
no
no
yes
yes
set
timer
set...
notify
button
press
notify...
other
button
other...
enable
spurious
enable...
IS_DOWN
IS_DOWN
IS_DOWN
IS_DOWN
button
release
button...
set
timer
set...
set short
timer
set short...
other
button
other...
IS_UP_DELAYING_SPURIOUS
IS_UP_DELAYING_SPURIOUS
IS_UP_DETECTING_SPURIOUS
IS_UP_DETECTING_SPURIOUS
button
press
button...
timeout
short
timeout...
other
button
other...
timeout
timeout
button
release
button...
timeout
short
timeout...
other
button
other...
timeout
timeout
timeout
timeout
other
button
other...
timeout
timeout
other
button
other...
IS_DOWN_DELAYING
IS_DOWN_DELAYING
notify
button
press
notify...
timeout
timeout
button
press
button...
other
button
other...
notify
button
release
notify...
notify
button
release
notify...
timeout
short
timeout...
button
press
button...
other
button
other...
IS_UP_WAITING
IS_UP_WAITING
button
release
button...
timeout
timeout
other
button
other...
set
timer
set...
set
timer
set...
set
timer
set...
set
timer
set...
set
timer
set...
set short
timer
set short...
set
timer
set...
set short
timer
set short...
Viewer does not support full SVG 1.1