[Cryptech-Commits] [sw/stm32] 04/09: Add reboot command.

git at cryptech.is git at cryptech.is
Wed May 18 19:16:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

fredrik at thulin.net pushed a commit to branch master
in repository sw/stm32.

commit bc29d48aef697544f98df5c5c9d2430e06a17ff6
Author: Fredrik Thulin <fredrik at thulin.net>
AuthorDate: Tue May 17 13:46:13 2016 +0200

    Add reboot command.
---
 projects/cli-test/cli-test.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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);
 



More information about the Commits mailing list