-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
48 lines (33 loc) · 971 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "main.h"
#define EMBEDDED_CLI_IMPL
#include "embedded_cli.h"
EmbeddedCli *cli = embeddedCliNewDefault();
void writeChar(EmbeddedCli *embeddedCli, char c)
{
// Hello !
// Handle some serial characters here
}
void onCommand(EmbeddedCli *embeddedCli, CliCommand *command)
{
// your implementation
}
void main()
{
EmbeddedCliConfig *config = embeddedCliDefaultConfig();
config->maxBindingCount = 16;
cli->onCommand = onCommand;
cli->writeChar = writeChar;
while(TRUE)
{
embeddedCliProcess(cli);
}
}
/// For eCLI Command Processing
void onLed(EmbeddedCli *cli, char *args, void *context)
{
// use args as raw null-terminated string of all arguments
// Use if args should be tokenized
// cnst char * arg = embeddedCliGetToken(args, pos); // args are counted from 1 (not from 0)
// uint8_t pos = embeddedCliFindToken(args, argument);
// uint8_t count = embeddedCliGetTokenCount(const char *tokenizedStr);
}