From 5702637a53aafc39db0afceb67ec3e4312cd65b7 Mon Sep 17 00:00:00 2001 From: hqm <13720409820@163.com> Date: Sat, 18 Sep 2021 19:39:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/arduino/test_cmds.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/example/arduino/test_cmds.cpp b/example/arduino/test_cmds.cpp index a8947a8..99a7e41 100755 --- a/example/arduino/test_cmds.cpp +++ b/example/arduino/test_cmds.cpp @@ -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[]) { uint8_t i; @@ -93,7 +111,8 @@ static void cmd_example(int argc, char* argv[]) static xcmd_t cmds[] = { {"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)