From 3fff2550d041757a6d96260ada678e5b729e9848 Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Thu, 14 Oct 2021 15:52:03 +0200 Subject: [PATCH] samples/subsys/shell/shell_module: add board name command This commit adds a new subcommand to the `demo` command that prints out the name of the used board. Signed-off-by: Filip Kokosinski --- samples/subsys/shell/shell_module/src/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/samples/subsys/shell/shell_module/src/main.c b/samples/subsys/shell/shell_module/src/main.c index 1555b4f5a86..cca30371af1 100644 --- a/samples/subsys/shell/shell_module/src/main.c +++ b/samples/subsys/shell/shell_module/src/main.c @@ -89,6 +89,16 @@ static int cmd_demo_ping(const struct shell *shell, size_t argc, char **argv) return 0; } +static int cmd_demo_board(const struct shell *sh, size_t argc, char **argv) +{ + ARG_UNUSED(argc); + ARG_UNUSED(argv); + + shell_print(sh, CONFIG_BOARD); + + return 0; +} + #if defined CONFIG_SHELL_GETOPT static int cmd_demo_getopt(const struct shell *shell, size_t argc, char **argv) { @@ -310,6 +320,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_demo, SHELL_CMD(hexdump, NULL, "Hexdump params command.", cmd_demo_hexdump), SHELL_CMD(params, NULL, "Print params command.", cmd_demo_params), SHELL_CMD(ping, NULL, "Ping command.", cmd_demo_ping), + SHELL_CMD(board, NULL, "Show board name command.", cmd_demo_board), #if defined CONFIG_SHELL_GETOPT SHELL_CMD(getopt, NULL, "Cammand using getopt, looking for: \"abhc:\".", cmd_demo_getopt),