Introduction
Most of our systems can be described as Finite State Machines (FSMs). Given a set of states and a transition table, an FSM will consume input and move between states as defined by the transition table.
In our case, we've decided to use event-driven FSMs. Implemented properly, we could sleep during periods where no events are occurring, saving power.
Goals
We'd like to implement an FSM library that is easy to understand and debug. With our previous FSM implementation, new members found it difficult to understand how it worked and how to use it. It was also difficult to debug since it was possible to jump between different levels of FSMs and we had no serial output.
Ideally, we should be able to provide a simple interface to register new states and transitions to an FSM.
Questions
- Do we support HSMs? They provide the ability to register handlers for entire events. The alternative is running multiple FSMs in parallel which generate events that are processed by master FSMs.
Resources