Plain c Finite State Machine Framework library for using in the host devices, and is suitable for all embedded devices(RTOS, Linux, etc.).
Flat state machine example
cFSM is licensed under the Apache license, check the LICENSE file.
Clone the repo, install dependencies, and serve:
git clone [email protected]:Junbo-Zheng/cFSM.git
sudo apt-get install -y cmake gcc ninja-build
cmake -S . -Bbuild -GNinja
cmake --build build -j20
./build/simple
➜ /home/mi/local/c_fsm git:(master) ✗ ./build/simple
turn to low_entry
initial state: low
--------------------------------------------------
processing state: 0, event: 1, state name: low
low_callback with event: 1
exiting from low_exit
turn to mid_entry
--------------------------------------------------
processing state: 1, event: 2, state name: mid
mid_callback with event: 2
exiting from mid_exit
turn to high_entry
--------------------------------------------------
processing state: 2, event: 3, state name: high
high_callback with event: 3
state out of bounds, resetting to low state and exit
Anyone is welcome to contribute. Simply fork this repository, make your changes in an own branch and create a pull-request for your change. Please do only one change per pull-request.
You found a bug? Please fill out an issue and include any data to reproduce the bug.