https://github.com/vpetrigo/smf
Lightweight State Machine Framework in C
https://github.com/vpetrigo/smf
c embedded-c fsm fsm-library state-machine
Last synced: 5 months ago
JSON representation
Lightweight State Machine Framework in C
- Host: GitHub
- URL: https://github.com/vpetrigo/smf
- Owner: vpetrigo
- License: apache-2.0
- Created: 2022-11-30T06:25:30.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-10T17:57:45.000Z (about 1 year ago)
- Last Synced: 2025-04-10T18:04:32.368Z (about 1 year ago)
- Topics: c, embedded-c, fsm, fsm-library, state-machine
- Language: C
- Homepage:
- Size: 80.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://github.com/vpetrigo/smf/actions/workflows/ci.yml)
# State Machine Framework
-------------------------
This project is a fork of a library from [Zephyr][zephyr] project which is great to use as a standalone library
for making state machines easier and cleaner.
The `smf` library has one of the cleanest interface and it is quite easy to use.
This repository provides an integration for the CMake build system that allows to add the `smf` library
to your project without a headache.
## Library configuration
There are two options available:
- `SMF_ANCESTOR_SUPPORT` enables/disables hierarchical state machine support
- `SMF_CONFIG_FILE` a configuration filename that will be included into `smf`
Configuration file may provide the following stuff that `smf` would use:
```c
#ifndef MY_SMF_CONFIG_H
#define MY_SMF_CONFIG_H
// enable hierarchical state machine feature
#define CONFIG_SMF_ANCESTOR_SUPPORT
// ...
// Logging macro that smf library uses
#define LOG_WARN(...)
#endif /* MY_SMF_CONFIG_H */
```
## Supported FSM types
_Flat state machine example_:

_Hierarchical state machine example (`CONFIG_SMF_ANCESTOR_SUPPORT` enabled)_:

# Documentation
---------------
You may find the full-featured documentation
on [Zephyr project](https://docs.zephyrproject.org/latest/services/smf/index.html) page
# Contribution
--------------
Contributions are always welcome! If you have an idea, it's best to float it by me before working on it to ensure no
effort is wasted. If there's already an open issue for it, knock yourself out. See the [contributing section](CONTRIBUTING.md) for
additional details
# License
---------
This project is licensed under:
- [Apache-2.0](LICENSE.md)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in time by you, as
defined in the Apache-2.0, shall be licensed as above, without any additional terms or
conditions.
[zephyr]: https://github.com/zephyrproject-rtos/zephyr