Extract UsbCommand_Reenumerate() into its own file.

This commit is contained in:
László Monda
2017-11-05 01:18:37 +01:00
parent 0febc9dd69
commit e907e65751
3 changed files with 22 additions and 9 deletions

View File

@@ -0,0 +1,12 @@
#include "fsl_common.h"
#include "usb_commands/usb_command_reenumerate.h"
#include "usb_protocol_handler.h"
#include "bootloader/wormhole.h"
void UsbCommand_Reenumerate(void)
{
Wormhole.magicNumber = WORMHOLE_MAGIC_NUMBER;
Wormhole.enumerationMode = GenericHidInBuffer[1];
Wormhole.timeoutMs = *((uint32_t*)(GenericHidInBuffer+2));
NVIC_SystemReset();
}

View File

@@ -0,0 +1,8 @@
#ifndef __USB_COMMAND_REENUMERATE_H__
#define __USB_COMMAND_REENUMERATE_H__
// Functions:
void UsbCommand_Reenumerate(void);
#endif

View File

@@ -24,6 +24,7 @@
#include "usb_commands/usb_command_launch_eeprom_transfer_legacy.h" #include "usb_commands/usb_command_launch_eeprom_transfer_legacy.h"
#include "usb_commands/usb_command_get_keyboard_state.h" #include "usb_commands/usb_command_get_keyboard_state.h"
#include "usb_commands/usb_command_get_debug_info.h" #include "usb_commands/usb_command_get_debug_info.h"
#include "usb_commands/usb_command_reenumerate.h"
uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH]; uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
@@ -46,14 +47,6 @@ void SetUsbResponseWord(uint16_t response)
// Per command protocol command handlers // Per command protocol command handlers
void reenumerate(void)
{
Wormhole.magicNumber = WORMHOLE_MAGIC_NUMBER;
Wormhole.enumerationMode = GenericHidInBuffer[1];
Wormhole.timeoutMs = *((uint32_t*)(GenericHidInBuffer+2));
NVIC_SystemReset();
}
void setTestLed(void) void setTestLed(void)
{ {
uint8_t ledState = GenericHidInBuffer[1]; uint8_t ledState = GenericHidInBuffer[1];
@@ -90,7 +83,7 @@ void UsbProtocolHandler(void)
UsbCommand_GetProperty(); UsbCommand_GetProperty();
break; break;
case UsbCommandId_Reenumerate: case UsbCommandId_Reenumerate:
reenumerate(); UsbCommand_Reenumerate();
break; break;
case UsbCommandId_SetTestLed: case UsbCommandId_SetTestLed:
setTestLed(); setTestLed();