application: add menu to measure voltages

This commit is contained in:
King Kévin 2021-03-10 18:31:39 +01:00
parent 2b718bfc72
commit 73b205e6c8
1 changed files with 18 additions and 1 deletions

View File

@ -124,6 +124,15 @@ static void command_swd_scan(void* argument)
}
}
static void command_voltages(void* argument)
{
(void)argument; // we won't use the argument
float* voltages = measure_voltages(); // measure voltages
puts("voltages:\n");
printf("- target: %.02f V\n", (uint32_t)(voltages[1] * 100) / 100.0);
printf("- signal: %.02f V\n", (uint32_t)(voltages[2] * 100) / 100.0);
}
/** display available commands
* @param[in] argument no argument required
*/
@ -328,7 +337,7 @@ static const struct menu_command_t menu_commands[] = {
.command_handler = &command_help,
},
{
.shortcut = 'v',
.shortcut = 'V',
.name = "version",
.command_description = "show software and hardware version",
.argument = MENU_ARGUMENT_NONE,
@ -383,6 +392,14 @@ static const struct menu_command_t menu_commands[] = {
.argument_description = NULL,
.command_handler = &command_swd_scan,
},
{
.shortcut = 'v',
.name = "voltage",
.command_description = "measure target and signal voltages",
.argument = MENU_ARGUMENT_NONE,
.argument_description = NULL,
.command_handler = &command_voltages,
},
};
static void command_help(void* argument)