Add command for printing option bytes

This commit is contained in:
Mario Hüttel 2021-10-17 12:30:58 +02:00
parent eb41e5e210
commit 61cb92fbe8
1 changed files with 29 additions and 0 deletions

View File

@ -45,6 +45,8 @@
#include <reflow-controller/temp-profile/temp-profile-executer.h>
#include <reflow-controller/updater/updater.h>
#include <reflow-controller/main-cycle-counter.h>
#include <stm-periph/option-bytes.h>
#include <stdio.h>
#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 <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,
}
};