Finite State Machines
Is there a typical state machine implementation pattern?
Tutorial: State Machines with C Callbacks
A Function Pointer Based State Machine
https://www.mikrocontroller.net/articles/Statemachine