[FL-1239] CLI commands readable list #464

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-05-18 12:30:04 +03:00
committed by GitHub
parent 734820c137
commit 5000424c42
3 changed files with 31 additions and 11 deletions

12
applications/cli/cli_i.h Normal file → Executable file
View File

@@ -6,15 +6,23 @@
#include <api-hal.h>
#include <m-dict.h>
#include <m-bptree.h>
#define CLI_LINE_SIZE_MAX
#define CLI_COMMANDS_TREE_RANK 4
typedef struct {
CliCallback callback;
void* context;
} CliCommand;
DICT_DEF2(CliCommandDict, string_t, STRING_OPLIST, CliCommand, M_POD_OPLIST)
BPTREE_DEF2(
CliCommandTree,
CLI_COMMANDS_TREE_RANK,
string_t,
STRING_OPLIST,
CliCommand,
M_POD_OPLIST)
typedef enum {
CliSymbolAsciiSOH = 0x01,
@@ -31,7 +39,7 @@ typedef enum {
} CliSymbols;
struct Cli {
CliCommandDict_t commands;
CliCommandTree_t commands;
osMutexId_t mutex;
string_t line;
};