From 7c8fb79f9ef2acac643ed71fd7ba7e5cef537114 Mon Sep 17 00:00:00 2001 From: "const_zpc@163.com" Date: Tue, 28 Feb 2023 21:58:18 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=83=20docs:=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E4=BB=8B=E7=BB=8D=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Demo/cmd_shell/demo.c | 10 ++++++++- Param/inc/param.h | 33 +++++++++++++++++------------ Param/src/param.c | 34 +++++++++++++++--------------- README.en.md | 36 -------------------------------- README.md | 47 +++++++++++++++++++----------------------- 微信公众号.jpg | Bin 0 -> 8544 bytes 6 files changed, 67 insertions(+), 93 deletions(-) delete mode 100644 README.en.md create mode 100644 微信公众号.jpg diff --git a/Demo/cmd_shell/demo.c b/Demo/cmd_shell/demo.c index a185b65..46d7f4e 100644 --- a/Demo/cmd_shell/demo.c +++ b/Demo/cmd_shell/demo.c @@ -27,11 +27,19 @@ int main () ShowAllParam(); printf("\nModify: \n"); + + // 通过接口修改(参数范围限制) memcpy(databuf, &data, sizeof(data)); ModifyByName("test_2", databuf); memcpy(databuf, &fdata, sizeof(fdata)); - ModifyByName("test_3", databuf); + ModifyByName("test_3", databuf); + + ShowAllParam(); + + // 在模块文件中定义的参数可以选择直接修改(没有参数范围限制) + test = 5; + test_3 = 8.26; ShowAllParam(); diff --git a/Param/inc/param.h b/Param/inc/param.h index e361c63..2fd0f83 100644 --- a/Param/inc/param.h +++ b/Param/inc/param.h @@ -1,25 +1,28 @@ /** - * @file param.h - * @author pczhou (pczhou@streamax.com) - * @brief - * @version 0.1 - * @date 2023-02-07 - * - * @copyright Copyright (c) 2023 锐明技术股份有限公司 - * - * @par 修改日志: - * - *
Date Version Author Description - *
2023-02-07 1.0 pczhou 内容 - *
+ ********************************************************************************************************************** + * @file param.h + * @brief 该文件提供参数管理框架所有函数原型 + * @author const_zpc any question please send mail to const_zpc@163.com + * @version V0.1 + * @date 2023-02-07 + ********************************************************************************************************************** + * + ********************************************************************************************************************** */ +/* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ + #ifndef _PARAM_H_ #define _PARAM_H_ +/* Includes ----------------------------------------------------------------------------------------------------------*/ #include #include +#ifdef __cplusplus + extern "C" { +#endif + typedef int8_t PARAM_INT8_T; typedef int16_t PARAM_INT16_T; typedef int32_t PARAM_INT32_T; @@ -137,4 +140,8 @@ extern int Param_ModifyByName(ParamTable_t *pParamTable, const char *pszName, co extern size_t Param_Serialize(ParamTable_t *pParamTable, uint8_t *pBuf); extern void Param_Parse(ParamTable_t *pParamTable, const uint8_t *pBuf); +#ifdef __cplusplus + } +#endif + #endif // !_PARAM_H_ diff --git a/Param/src/param.c b/Param/src/param.c index 80d7314..8bcb547 100644 --- a/Param/src/param.c +++ b/Param/src/param.c @@ -1,27 +1,27 @@ /** - * @file param.c - * @author pczhou (pczhou@streamax.com) - * @brief - * @version 0.1 - * @date 2023-02-07 - * - * @copyright Copyright (c) 2023 锐明技术股份有限公司 - * - * @par 修改日志: - * - *
Date Version Author Description - *
2023-02-07 1.0 pczhou 内容 - *
+ ********************************************************************************************************************** + * @file param.c + * @brief 该文件提供参数管理框架功能 + * @author const_zpc any question please send mail to const_zpc@163.com + * @version V0.1 + * @date 2023-02-07 + * + * @details 功能详细说明: + * + 参数修改和重置管理 + * + 参数序列化和反序列化 + * + ********************************************************************************************************************** + * 源码路径:https://gitee.com/const-zpc/param.git 具体问题及建议可在该网址填写 Issue + * + * + ********************************************************************************************************************** */ - +/* Includes ----------------------------------------------------------------------------------------------------------*/ #include "param.h" #include - -// const uint32_t sg_tParamTableNum = sizeof(sg_tParamTable) / sizeof(sg_tParamTable[0]); - #define CASE_CHANGE(type) \ case type:\ {\ diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 6475f8c..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# param - -#### Description -参数管理框架 - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 68c1595..e6f2ae4 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,32 @@ -# param +# 轻量级参数管理框架(C语言) #### 介绍 -参数管理框架 +1. 采用表驱动方式统一管理所有参数,包括缺省值、最小值和最大值等 + +2. 采用宏定义快速注册和添加参数进行管理 + +3. 支持基本类型参数和字符串参数 + +4. 支持序列化和反序列化,便于保存和读取校验 + +5. 可通过串口协议或其他协议调用接口修改参数 #### 软件架构 软件架构说明 - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - #### 使用说明 +1. 通过函数 Param_ModifyById、Param_ModifyByName 限制修改参数 +2. 调用函数 Param_Serialize 对参数序列化, 保存至储存芯片中 +3. 从储存芯片读取数据后,调用 Param_Parse 反序列化得到参数,同时进行参数范围校验 -1. xxxx -2. xxxx -3. xxxx +#### demo样式 +博客: -#### 参与贡献 +[轻量级参数管理框架(C语言)](https://blog.csdn.net/qq_24130227/article/details/129233836?spm=1001.2014.3001.5501) -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +#### 关于作者 +1. CSDN 博客 [大橙子疯](https://blog.csdn.net/qq_24130227?spm=1010.2135.3001.5343) +2. 联系邮箱 const_zpc@163.com +3. 了解更多可关注微信公众号 - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +![大橙子疯嵌入式](微信公众号.jpg) \ No newline at end of file diff --git a/微信公众号.jpg b/微信公众号.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ba61c3cf75de177152ebd185db0a7d72c015a952 GIT binary patch literal 8544 zcmdUUc|4T++y6ZVV_!#yvV|-;b;2kk45tWXO-N1(g_JBUn#v4L%bBJSTAaaDhKRI` zv^m2mTOE6d5?OMPlWl~?%yZpC=iB){-{0%?`~6<8=Z|N&jeG9<{>v`{V0Gr{+PMScPk`y%{<3c0;8Lxmgo`QuNX%~6H4}fCs@M&mt=nn_Aj|Q5g9B7jE7Z3NXY!w z>oh~;f9Sxl?u6OtVQCU|6l2l;MjY48o??u5|K{BeuHfa^nE96hQ4VGSFDi%x zIB$#zcu|QhLMUF9cbz4*)jjC#6L(x);JiOsvQm402H)GRqIj4g<1VtKf+dXF0V**;&s4~SC#l#pE4+PQ>e*QUyD4Kh;@vN^n zry$bA7Gr^r|HY!xNUeBaR|Z`EbMdx+doM7&PD8#Pu3TQB57+G-Cmmg|w!D_9-sk{Q z68l)N)hVBeyV?89MqyLdl$HGSc`u)d;vqP*iGp28!2Z)NT%BU=Ow6vQlG2k+!{_qq zL$#9~!bE!EoDtmUAWQMeQHYt7;(ON&<_*|Nh`Xp(u+%lPGbvt~e_}cicR72)h2!(a zvpcNG?jnbahqDRmTuXRG7iHn=GsD7|Ju%J_1PreblWM2RRA0)^r)m$P=S=~v)_6oY zKGh-G(BJ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