From 89fef3d93317f08e106c0327b5fc90c0fff0cef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sat, 21 Oct 2017 01:29:05 +0200 Subject: [PATCH] Upon receiving the reset BusPal command, reset the MCU and reenumerate in normal keyboard mode. --- right/src/buspal/command.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/right/src/buspal/command.c b/right/src/buspal/command.c index a22ad99..d5dd11b 100644 --- a/right/src/buspal/command.c +++ b/right/src/buspal/command.c @@ -6,6 +6,8 @@ #if FIXED_BUSPAL_BOOTLOADER #include "microseconds/microseconds.h" #endif +#include "bootloader/wormhole.h" + command_processor_data_t g_commandData; buspal_state_t g_buspalState = kBuspal_Idle; @@ -483,6 +485,10 @@ status_t bootloader_command_pump() handle_write_memory_command(g_commandData.packet, g_commandData.packetLength); g_commandData.state = kCommandState_DataPhaseWrite; + } else if (cmdTag == kCommandTag_Reset) { + Wormhole.magicNumber = WORMHOLE_MAGIC_NUMBER; + Wormhole.enumerationMode = EnumerationMode_NormalKeyboard; + NVIC_SystemReset(); } status = handle_command_internal(g_commandData.packet, g_commandData.packetLength);