From 95de84fa85147d5f8c071a5da459b311977af264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 21 Aug 2020 00:29:19 +0200 Subject: [PATCH] Fix #13: Add hang command to shell --- stm-firmware/shell.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/stm-firmware/shell.c b/stm-firmware/shell.c index 4cec537..282ad9b 100644 --- a/stm-firmware/shell.c +++ b/stm-firmware/shell.c @@ -445,6 +445,19 @@ static shellmatta_retCode_t shell_cmd_save_cal(const shellmatta_handle_t handle, return SHELLMATTA_OK; } + +static shellmatta_retCode_t shell_cmd_hang(const shellmatta_handle_t handle, const char *arguments, + uint32_t length) +{ + (void)handle; + (void)arguments; + (void)length; + + while (1337); + + return SHELLMATTA_OK; +} + //typedef struct shellmatta_cmd //{ // char *cmd; /**< command name */ @@ -454,8 +467,7 @@ static shellmatta_retCode_t shell_cmd_save_cal(const shellmatta_handle_t handle, // shellmatta_cmdFct_t cmdFct; /**< pointer to the cmd callack function */ // struct shellmatta_cmd *next; /**< pointer to next command or NULL */ //} shellmatta_cmd_t; - -static shellmatta_cmd_t cmd[14] = { +static shellmatta_cmd_t cmd[15] = { { .cmd = "version", .cmdAlias = "ver", @@ -566,8 +578,16 @@ static shellmatta_cmd_t cmd[14] = { .helpText = "", .usageText = "", .cmdFct = shell_cmd_save_cal, - .next = NULL, + .next = &cmd[14], }, + { + .cmd = "hang", + .cmdAlias = NULL, + .helpText = "", + .usageText = "", + .cmdFct = shell_cmd_hang, + .next = NULL, + } }; shellmatta_handle_t shell_init(shellmatta_write_t write_func)