freertos-cls
https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/FreeRTOS_Plus_Command_Line_Interface.html
- 功能:
提供了便利的方法处理命令行输入
对于命令行输入具有退格删除功能 - 描述
对于一个新的命令,
只要定义一个函数来执行这个命令,
然后注册这个函数,绑定到命令字符串。
用户不用自己解析命令行输入的参数,不用自己判断参数个数是否正确 - 实现
把函数和字符串放在一个结构体里变量里, 这个结构体还包括参数的个数,功能描述的字符串。
把这个结构体加入链表,用户输入后,会从这个链表里找到对于的命令字符串,程序会对参数进行判断后调用相应的函数。
FreeRTOS-Plus-CLI
An Extensible Command Line Interface Framework
- provide a function that implements the command behaviour
实现用户定义的命令的函数
BaseType_t xFunctionName( char *pcWriteBuffer,
size_t xWriteBufferLen,
const char *pcCommandString );
参数
pcWriteBuffer: 生成的输出, 必须以 null 结尾
xWriteBufferLen: buffer size of pcWriteBuffer
pcCommandString: 输入字符串
-
map the command to the function