diff --git a/stm-firmware/shell.c b/stm-firmware/shell.c index a023ac6..1e05803 100644 --- a/stm-firmware/shell.c +++ b/stm-firmware/shell.c @@ -5,6 +5,7 @@ #include #include #include +#include #ifndef GIT_VER #define GIT_VER "VERSION NOT SET" @@ -123,6 +124,16 @@ static shellmatta_retCode_t shell_cmd_clear_error_status(const shellmatta_handle return SHELLMATTA_OK; } + +static shellmatta_retCode_t shell_cmd_uptime(const shellmatta_handle_t handle, + const char *arguments, + uint32_t length) +{ + (void)arguments; + (void)length; + shellmatta_printf(handle, "Uptime: %llu secs", global_tick_ms/1000); + return SHELLMATTA_OK; +} //typedef struct shellmatta_cmd //{ // char *cmd; /**< command name */ @@ -133,7 +144,7 @@ static shellmatta_retCode_t shell_cmd_clear_error_status(const shellmatta_handle // struct shellmatta_cmd *next; /**< pointer to next command or NULL */ //} shellmatta_cmd_t; -static shellmatta_cmd_t cmd[5] = { +static shellmatta_cmd_t cmd[6] = { { .cmd = "version", .cmdAlias = "ver", @@ -172,6 +183,14 @@ static shellmatta_cmd_t cmd[5] = { .helpText = "Set DIGIO Port", .usageText = "digio-set ", .cmdFct = shell_cmd_digio_set, + .next = &cmd[5], + }, + { + .cmd = "uptime", + .cmdAlias = "upt", + .helpText = "Get uptime in seconds", + .usageText = "", + .cmdFct = shell_cmd_uptime, .next = NULL, }, };