Upon receiving the reset BusPal command, reset the MCU and reenumerate in normal keyboard mode.

This commit is contained in:
László Monda
2017-10-21 01:29:05 +02:00
parent a052f4f59c
commit 89fef3d933

View File

@@ -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);