diff --git a/right/src/usb_commands/usb_command_launch_eeprom_transfer_legacy.c b/right/src/usb_commands/usb_command_launch_eeprom_transfer_legacy.c new file mode 100644 index 0000000..a6e4f67 --- /dev/null +++ b/right/src/usb_commands/usb_command_launch_eeprom_transfer_legacy.c @@ -0,0 +1,23 @@ +#include "fsl_common.h" +#include "usb_commands/usb_command_write_config.h" +#include "usb_protocol_handler.h" +#include "eeprom.h" + +void UsbCommand_LaunchEepromTransferLegacy(void) +{ + uint8_t legacyEepromTransferId = GenericHidInBuffer[1]; + switch (legacyEepromTransferId) { + case 0: + EEPROM_LaunchTransfer(EepromOperation_Read, ConfigBufferId_HardwareConfig, NULL); + break; + case 1: + EEPROM_LaunchTransfer(EepromOperation_Write, ConfigBufferId_HardwareConfig, NULL); + break; + case 2: + EEPROM_LaunchTransfer(EepromOperation_Read, ConfigBufferId_ValidatedUserConfig, NULL); + break; + case 3: + EEPROM_LaunchTransfer(EepromOperation_Write, ConfigBufferId_ValidatedUserConfig, NULL); + break; + } +} diff --git a/right/src/usb_commands/usb_command_launch_eeprom_transfer_legacy.h b/right/src/usb_commands/usb_command_launch_eeprom_transfer_legacy.h new file mode 100644 index 0000000..adc78ba --- /dev/null +++ b/right/src/usb_commands/usb_command_launch_eeprom_transfer_legacy.h @@ -0,0 +1,8 @@ +#ifndef __USB_COMMAND_LAUNCH_EEPROM_TRANSFER_LEGACY_H__ +#define __USB_COMMAND_LAUNCH_EEPROM_TRANSFER_LEGACY_H__ + +// Functions: + + void UsbCommand_LaunchEepromTransferLegacy(void); + +#endif diff --git a/right/src/usb_protocol_handler.c b/right/src/usb_protocol_handler.c index 33afdeb..5835bd6 100644 --- a/right/src/usb_protocol_handler.c +++ b/right/src/usb_protocol_handler.c @@ -21,6 +21,7 @@ #include "usb_commands/usb_command_get_property.h" #include "usb_commands/usb_command_jump_to_slave_bootloader.h" #include "usb_commands/usb_command_send_kboot_command.h" +#include "usb_commands/usb_command_launch_eeprom_transfer_legacy.h" uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH]; @@ -76,25 +77,6 @@ void getAdcValue(void) *(uint32_t*)(GenericHidOutBuffer+1) = ADC_Measure(); } -void legacyLaunchEepromTransfer(void) -{ - uint8_t legacyEepromTransferId = GenericHidInBuffer[1]; - switch (legacyEepromTransferId) { - case 0: - EEPROM_LaunchTransfer(EepromOperation_Read, ConfigBufferId_HardwareConfig, NULL); - break; - case 1: - EEPROM_LaunchTransfer(EepromOperation_Write, ConfigBufferId_HardwareConfig, NULL); - break; - case 2: - EEPROM_LaunchTransfer(EepromOperation_Read, ConfigBufferId_ValidatedUserConfig, NULL); - break; - case 3: - EEPROM_LaunchTransfer(EepromOperation_Write, ConfigBufferId_ValidatedUserConfig, NULL); - break; - } -} - void getKeyboardState(void) { GenericHidOutBuffer[1] = IsEepromBusy; @@ -153,8 +135,8 @@ void UsbProtocolHandler(void) case UsbCommandId_GetAdcValue: getAdcValue(); break; - case UsbCommandId_LaunchEepromTransfer: - legacyLaunchEepromTransfer(); + case UsbCommandId_LaunchEepromTransferLegacy: + UsbCommand_LaunchEepromTransferLegacy(); break; case UsbCommandId_ReadHardwareConfiguration: UsbCommand_ReadConfig(true); diff --git a/right/src/usb_protocol_handler.h b/right/src/usb_protocol_handler.h index 5a7e301..02b246d 100644 --- a/right/src/usb_protocol_handler.h +++ b/right/src/usb_protocol_handler.h @@ -17,7 +17,7 @@ UsbCommandId_ApplyConfig = 9, UsbCommandId_SetLedPwm = 10, UsbCommandId_GetAdcValue = 11, - UsbCommandId_LaunchEepromTransfer = 12, + UsbCommandId_LaunchEepromTransferLegacy = 12, UsbCommandId_ReadHardwareConfiguration = 13, UsbCommandId_WriteHardwareConfiguration = 14, UsbCommandId_ReadUserConfiguration = 15,