diff --git a/stm-firmware/shell.c b/stm-firmware/shell.c index 402e00f..6d42dd3 100644 --- a/stm-firmware/shell.c +++ b/stm-firmware/shell.c @@ -45,6 +45,8 @@ #include #include #include +#include + #include #ifndef GIT_VER @@ -883,6 +885,25 @@ shellmatta_retCode_t shell_cmd_filter_alpha(const shellmatta_handle_t handle, co return SHELLMATTA_OK; } +shellmatta_retCode_t shell_cmd_print_opt_bytes(const shellmatta_handle_t handle, + const char *args, uint32_t len) +{ + (void)args; + (void)len; + struct option_bytes opts; + + stm_option_bytes_read(&opts); + + shellmatta_printf(handle, "Brown-out Level: 0x%x\r\n", opts.brown_out_level); + shellmatta_printf(handle, "nRST Standby: 0x%x\r\n", opts.nrst_standby); + shellmatta_printf(handle, "nRST Stop: 0x%x\r\n", opts.nrst_stop); + shellmatta_printf(handle, "Write Protection: 0x%x\r\n", opts.nwrpi); + shellmatta_printf(handle, "Read Protection: 0x%x\r\n", opts.read_protection); + shellmatta_printf(handle, "SW Watchdog: 0x%x\r\n", opts.wdg_sw); + + return SHELLMATTA_OK; +} + //typedef struct shellmatta_cmd //{ // char *cmd; /**< command name */ @@ -1076,6 +1097,14 @@ static shellmatta_cmd_t cmd[24] = { .helpText = "Sets the filter constant", .usageText = "filter-alpha ", .cmdFct = shell_cmd_filter_alpha, + .next = &cmd[23], + }, + { + .cmd = "print-option-bytes", + .cmdAlias = "opt-bytes", + .helpText = "Print the currently set option bytes of the STM32", + .usageText = "", + .cmdFct = shell_cmd_print_opt_bytes, .next = NULL, } };