Skip to content

misc: add HSM state machine package #1885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions misc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ source "$PKGS_DIR/packages/misc/qparam/Kconfig"
source "$PKGS_DIR/packages/misc/CorevMCU_CLI/Kconfig"
source "$PKGS_DIR/packages/misc/get_irq_priority/Kconfig"
source "$PKGS_DIR/packages/misc/drmp/Kconfig"
source "$PKGS_DIR/packages/misc/hsm/Kconfig"
endmenu
46 changes: 46 additions & 0 deletions misc/hsm/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
menuconfig PKG_USING_HSM
bool "HSM: Hierarchical state machines for embedded systems"
default n
help
HSM is a minimal, event-driven hierarchical state machine framework designed for embedded systems.
It supports nested states, entry/exit actions, state transitions, and provides a simple C API for event handling.

if PKG_USING_HSM

config PKG_HSM_PATH
string
default "/packages/misc/hsm"

config PKG_HSM_MAX_LEVEL
int "Maximum nesting level for state hierarchy"
range 5 20
default 10
help
The maximum nesting level supported for hierarchical states.
Increase this value for deeply nested state machines.

config PKG_HSM_USING_EXAMPLE
bool "Enable HSM examples"
default n
help
Enable the HSM LED example code

choice
prompt "Version"
default PKG_USING_HSM_LATEST_VERSION
help
Select the package version

config PKG_USING_HSM_V100
bool "v1.0.0"

config PKG_USING_HSM_LATEST_VERSION
bool "latest"
endchoice

config PKG_HSM_VER
string
default "v1.0.0" if PKG_USING_HSM_V100
default "latest" if PKG_USING_HSM_LATEST_VERSION

endif
37 changes: 37 additions & 0 deletions misc/hsm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "hsm",
"description": "Hierarchical state machines for designing event-driven systems",
"description_zh": "一种用于设计事件驱动系统的层次化状态机库",
"enable": "PKG_USING_HSM",
"keywords": [
"hsm",
"state-machine",
"state",
"embedded"
],
"category": "misc",
"author": {
"name": "Ye Zenghui",
"email": "[email protected]",
"github": "https://github.com/Ye-Zenghui"
},
"license": "MIT",
"repository": "https://github.com/Ye-Zenghui/hsm",
"icon": "unknown",
"homepage": "https://github.com/Ye-Zenghui/hsm#readme",
"doc": "https://github.com/Ye-Zenghui/hsm/blob/master/README.md",
"site": [
{
"version": "latest",
"URL": "https://github.com/Ye-Zenghui/hsm.git",
"filename": "",
"VER_SHA": "master"
},
{
"version": "v1.0.0",
"URL": "https://github.com/Ye-Zenghui/hsm/archive/refs/tags/v1.0.0.zip",
"filename": "hsm-1.0.0.zip",
"VER_SHA": "fill in latest version SHA"
}
]
}