Add uptime shell command
This commit is contained in:
parent
673e651910
commit
d80ce20675
@ -5,6 +5,7 @@
|
||||
#include <digio.h>
|
||||
#include <stdlib.h>
|
||||
#include <helper-macros/helper-macros.h>
|
||||
#include <systick.h>
|
||||
|
||||
#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 <num> <state>",
|
||||
.cmdFct = shell_cmd_digio_set,
|
||||
.next = &cmd[5],
|
||||
},
|
||||
{
|
||||
.cmd = "uptime",
|
||||
.cmdAlias = "upt",
|
||||
.helpText = "Get uptime in seconds",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_uptime,
|
||||
.next = NULL,
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user