aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Thulin <fredrik@thulin.net>2016-05-17 13:46:13 +0200
committerFredrik Thulin <fredrik@thulin.net>2016-05-18 14:12:14 +0200
commitbc29d48aef697544f98df5c5c9d2430e06a17ff6 (patch)
treec9c5df37906de34bc654f7f26f4ac73019218639
parent18b11939bf24b2f75ea54eb93d7d29273262c476 (diff)
Add reboot command.
-rw-r--r--projects/cli-test/cli-test.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/projects/cli-test/cli-test.c b/projects/cli-test/cli-test.c
index 5d33b27..edbc056 100644
--- a/projects/cli-test/cli-test.c
+++ b/projects/cli-test/cli-test.c
@@ -80,6 +80,11 @@ int cmd_filetransfer(struct cli_def *cli, const char *command, char *argv[], int
return CLI_OK;
}
+int cmd_reboot(struct cli_def *cli, const char *command, char *argv[], int argc)
+{
+ HAL_NVIC_SystemReset();
+}
+
int embedded_cli_loop(struct cli_def *cli)
{
unsigned char c;
@@ -150,6 +155,9 @@ main()
struct cli_command cmd_filetransfer_s = {(char *) "filetransfer", cmd_filetransfer, 0,
(char *) "Test file transfering",
PRIVILEGE_UNPRIVILEGED, MODE_EXEC, NULL, NULL, NULL};
+ struct cli_command cmd_reboot_s = {(char *) "reboot", cmd_reboot, 0,
+ (char *) "Reboot the STM32",
+ PRIVILEGE_UNPRIVILEGED, MODE_EXEC, NULL, NULL, NULL};
char crlf[] = "\r\n";
uint8_t tx = 'A';
@@ -177,6 +185,8 @@ main()
cli_register_command2(&cli, &cmd_filetransfer_s, NULL);
+ cli_register_command2(&cli, &cmd_reboot_s, NULL);
+
HAL_GPIO_WritePin(LED_PORT, LED_RED, GPIO_PIN_RESET);
HAL_GPIO_WritePin(LED_PORT, LED_GREEN, GPIO_PIN_SET);