commit e46b446065a66bbf106edfef476b4225f75a1d75
parent 49d27afb4d1c598cd480d963c35247c675996c65
Author: Lukas F. Hartmann <lukas@mntre.com>
Date: Sun, 9 Jan 2022 20:54:35 +0100
keyboard: standalone: jump to bootloader option
Diffstat:
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/reform2-keyboard-fw/menu.c b/reform2-keyboard-fw/menu.c
@@ -17,12 +17,13 @@ int current_menu_y = 0;
int current_scroll_y = 0;
#ifdef KBD_VARIANT_STANDALONE
-#define MENU_NUM_ITEMS 4
+#define MENU_NUM_ITEMS 5
const MenuItem menu_items[] = {
{ "Exit Menu ESC", KEY_ESCAPE },
{ "Key Backlight- F1", KEY_F1 },
{ "Key Backlight+ F2", KEY_F2 },
- { "System Status s", KEY_S }
+ { "System Status s", KEY_S },
+ { "USB Flashing Mode x", KEY_X },
};
#else
#define MENU_NUM_ITEMS 9
@@ -67,6 +68,11 @@ int execute_menu_function(int y) {
return execute_meta_function(KEY_ESCAPE);
}
+#define BOOTLOADER_START_ADDRESS ((0x8000-0x1000) >> 1)
+void jump_to_bootloader(void) {
+ ((void (*)(void))BOOTLOADER_START_ADDRESS)();
+}
+
// returns 1 for navigation function (stay in meta mode), 0 for terminal function
int execute_meta_function(int keycode) {
if (keycode == KEY_0) {
@@ -133,6 +139,9 @@ int execute_meta_function(int keycode) {
gfx_clear();
gfx_flush();
}
+ else if (keycode == KEY_X) {
+ jump_to_bootloader();
+ }
gfx_clear();
gfx_flush();