Firmware · Program structure and state machines

Explicit state machines

Devices with several modes are easier to get right when the mode is stored in one clear variable rather than a handful of flags.