From 28e42c2c2f528c4103a06e90180bad737c83b964 Mon Sep 17 00:00:00 2001 From: yezenghui <956370541@qq.com> Date: Fri, 25 Apr 2025 17:29:10 +0800 Subject: [PATCH 1/3] misc: add HSM state machine package --- misc/Kconfig | 1 + misc/hsm/Kconfig | 46 +++++++++++++++++++++++++++++++++++++++++++ misc/hsm/package.json | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 misc/hsm/Kconfig create mode 100644 misc/hsm/package.json diff --git a/misc/Kconfig b/misc/Kconfig index e0acf06a75..0fa72a2bca 100644 --- a/misc/Kconfig +++ b/misc/Kconfig @@ -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 diff --git a/misc/hsm/Kconfig b/misc/hsm/Kconfig new file mode 100644 index 0000000000..ecc4b89de3 --- /dev/null +++ b/misc/hsm/Kconfig @@ -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 \ No newline at end of file diff --git a/misc/hsm/package.json b/misc/hsm/package.json new file mode 100644 index 0000000000..837a7f658c --- /dev/null +++ b/misc/hsm/package.json @@ -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": "yezenghui", + "email": "y956370541@163.com", + "github": "https://github.com/yezenghui" + }, + "license": "MIT", + "repository": "https://github.com/yezenghui/hsm", + "icon": "unknown", + "homepage": "https://github.com/yezenghui/hsm#readme", + "doc": "https://github.com/yezenghui/hsm/blob/main/README.md", + "site": [ + { + "version": "latest", + "URL": "https://github.com/yezenghui/hsm.git", + "filename": "", + "VER_SHA": "main" + }, + { + "version": "v1.0.0", + "URL": "https://github.com/yezenghui/hsm/archive/refs/tags/v1.0.0.zip", + "filename": "hsm-1.0.0.zip", + "VER_SHA": "fill in latest version SHA" + } + ] +} \ No newline at end of file From 96e1acb79dc607121e822322713c751f3b9bb3f9 Mon Sep 17 00:00:00 2001 From: yezenghui <956370541@qq.com> Date: Fri, 25 Apr 2025 17:38:49 +0800 Subject: [PATCH 2/3] misc: add HSM state machine package --- misc/hsm/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/misc/hsm/package.json b/misc/hsm/package.json index 837a7f658c..75aca0030a 100644 --- a/misc/hsm/package.json +++ b/misc/hsm/package.json @@ -11,25 +11,25 @@ ], "category": "misc", "author": { - "name": "yezenghui", + "name": "Ye Zenghui", "email": "y956370541@163.com", - "github": "https://github.com/yezenghui" + "github": "https://github.com/Ye-Zenghui" }, "license": "MIT", - "repository": "https://github.com/yezenghui/hsm", + "repository": "https://github.com/Ye-Zenghui/hsm", "icon": "unknown", - "homepage": "https://github.com/yezenghui/hsm#readme", - "doc": "https://github.com/yezenghui/hsm/blob/main/README.md", + "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/yezenghui/hsm.git", + "URL": "https://github.com/Ye-Zenghui/hsm.git", "filename": "", - "VER_SHA": "main" + "VER_SHA": "master" }, { "version": "v1.0.0", - "URL": "https://github.com/yezenghui/hsm/archive/refs/tags/v1.0.0.zip", + "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" } From 43d94a8083f89fa9d9ce5997f06f36d80f674995 Mon Sep 17 00:00:00 2001 From: yezenghui <956370541@qq.com> Date: Sun, 27 Apr 2025 14:55:22 +0800 Subject: [PATCH 3/3] fix:hsm --- misc/hsm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/hsm/package.json b/misc/hsm/package.json index 75aca0030a..172fe06584 100644 --- a/misc/hsm/package.json +++ b/misc/hsm/package.json @@ -29,7 +29,7 @@ }, { "version": "v1.0.0", - "URL": "https://github.com/Ye-Zenghui/hsm/archive/refs/tags/v1.0.0.zip", + "URL": "https://github.com/Ye-Zenghui/hsm/archive/v1.0.0.zip", "filename": "hsm-1.0.0.zip", "VER_SHA": "fill in latest version SHA" }