BV: clear pinout when switching mode
This commit is contained in:
parent
220b3b8880
commit
36e78dbfb6
|
@ -77,6 +77,14 @@ static void switch_mode(struct busvoodoo_mode_t* mode)
|
|||
if (busvoodoo_mode) {
|
||||
(*busvoodoo_mode->exit)(); // exit current mode
|
||||
}
|
||||
// reset pinout
|
||||
for (uint8_t i=0; i<LENGTH(busvoodoo_global_pinout_rscan); i++) {
|
||||
busvoodoo_global_pinout_rscan[i] = NULL;
|
||||
}
|
||||
for (uint8_t i=0; i<LENGTH(busvoodoo_global_pinout_io); i++) {
|
||||
busvoodoo_global_pinout_io[i] = NULL;
|
||||
}
|
||||
// reset OLED
|
||||
busvoodoo_safe_state(); // return to safe state
|
||||
busvoodoo_oled_clear(); // clear OLED display buffer
|
||||
busvoodoo_oled_update(); // update OLED display
|
||||
|
@ -101,10 +109,6 @@ static void command_mode(void* argument);
|
|||
* @param[in] argument no argument required
|
||||
*/
|
||||
static void command_quit(void* argument);
|
||||
/** command to switch LED
|
||||
* @param[in] argument on, off, toggle to switch LED, or NULL to display LED status
|
||||
*/
|
||||
static void command_led(void* argument);
|
||||
/** command to reset board
|
||||
* @param[in] argument no argument required
|
||||
*/
|
||||
|
@ -136,14 +140,6 @@ static const struct menu_command_t menu_commands[] = {
|
|||
NULL,
|
||||
&command_quit,
|
||||
},
|
||||
{
|
||||
'l',
|
||||
"led",
|
||||
"switch LED",
|
||||
MENU_ARGUMENT_STRING,
|
||||
"[on|off|toggle]",
|
||||
&command_led,
|
||||
},
|
||||
{
|
||||
'r',
|
||||
"reset",
|
||||
|
@ -161,7 +157,7 @@ static const struct menu_command_t menu_commands[] = {
|
|||
&command_bootloader,
|
||||
},
|
||||
{
|
||||
'V',
|
||||
'v',
|
||||
"version",
|
||||
"show hardware and firmware version",
|
||||
MENU_ARGUMENT_NONE,
|
||||
|
@ -219,29 +215,6 @@ static void command_quit(void* argument)
|
|||
switch_mode(NULL); // switch do default mode
|
||||
}
|
||||
|
||||
static void command_led(void* argument)
|
||||
{
|
||||
if (NULL==argument || 0==strlen(argument)) {
|
||||
printf("LED is ");
|
||||
if (gpio_get(GPIO(LED_PORT), GPIO(LED_PIN))) {
|
||||
printf("on\n");
|
||||
} else {
|
||||
printf("off\n");
|
||||
}
|
||||
} else if (0==strcmp(argument, "on")) {
|
||||
led_on(); // switch LED on
|
||||
printf("LED switched on\n"); // notify user
|
||||
} else if (0==strcmp(argument, "off")) {
|
||||
led_off(); // switch LED off
|
||||
printf("LED switched off\n"); // notify user
|
||||
} else if (0==strcmp(argument, "toggle")) {
|
||||
led_toggle(); // toggle LED
|
||||
printf("LED toggled\n"); // notify user
|
||||
} else {
|
||||
printf("option malformed: %s\n", argument);
|
||||
}
|
||||
}
|
||||
|
||||
static void command_reset(void* argument)
|
||||
{
|
||||
(void)argument; // we won't use the argument
|
||||
|
|
Loading…
Reference in New Issue