添加了一个测试指令

This commit is contained in:
hqm 2021-09-18 19:39:17 +08:00
parent c9c338a724
commit 5702637a53
1 changed files with 20 additions and 1 deletions

View File

@ -61,6 +61,24 @@ static void cmd_echo(int argc, char* argv[])
} }
} }
static void cmd_ls(int argc, char* argv[])
{
xcmd_t *p = xcmd_cmdlist_get();
uint8_t i = 0;
while(p)
{
xcmd_print("%-12s",p->name);
if(++i == 4)
{
xcmd_print("\r\n");
i = 0;
}
p = p->next;
}
xcmd_print("\r\n");
}
static void cmd_example(int argc, char* argv[]) static void cmd_example(int argc, char* argv[])
{ {
uint8_t i; uint8_t i;
@ -93,7 +111,8 @@ static void cmd_example(int argc, char* argv[])
static xcmd_t cmds[] = static xcmd_t cmds[] =
{ {
{"echo", cmd_echo, "echo anything", NULL}, {"echo", cmd_echo, "echo anything", NULL},
{"example", cmd_example, "example [-f|-i|-s] [val]", NULL}, {"ls", cmd_ls, "ls", NULL},
{"example", cmd_example, "example [str|int|float] [val]", NULL},
}; };
void test_cmd_init(void) void test_cmd_init(void)