Extract UsbCommand_LaunchEepromTransferLegacy() into its own file.
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "usb_commands/usb_command_get_property.h"
|
#include "usb_commands/usb_command_get_property.h"
|
||||||
#include "usb_commands/usb_command_jump_to_slave_bootloader.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_send_kboot_command.h"
|
||||||
|
#include "usb_commands/usb_command_launch_eeprom_transfer_legacy.h"
|
||||||
|
|
||||||
uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
|
uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
|
||||||
|
|
||||||
@@ -76,25 +77,6 @@ void getAdcValue(void)
|
|||||||
*(uint32_t*)(GenericHidOutBuffer+1) = ADC_Measure();
|
*(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)
|
void getKeyboardState(void)
|
||||||
{
|
{
|
||||||
GenericHidOutBuffer[1] = IsEepromBusy;
|
GenericHidOutBuffer[1] = IsEepromBusy;
|
||||||
@@ -153,8 +135,8 @@ void UsbProtocolHandler(void)
|
|||||||
case UsbCommandId_GetAdcValue:
|
case UsbCommandId_GetAdcValue:
|
||||||
getAdcValue();
|
getAdcValue();
|
||||||
break;
|
break;
|
||||||
case UsbCommandId_LaunchEepromTransfer:
|
case UsbCommandId_LaunchEepromTransferLegacy:
|
||||||
legacyLaunchEepromTransfer();
|
UsbCommand_LaunchEepromTransferLegacy();
|
||||||
break;
|
break;
|
||||||
case UsbCommandId_ReadHardwareConfiguration:
|
case UsbCommandId_ReadHardwareConfiguration:
|
||||||
UsbCommand_ReadConfig(true);
|
UsbCommand_ReadConfig(true);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
UsbCommandId_ApplyConfig = 9,
|
UsbCommandId_ApplyConfig = 9,
|
||||||
UsbCommandId_SetLedPwm = 10,
|
UsbCommandId_SetLedPwm = 10,
|
||||||
UsbCommandId_GetAdcValue = 11,
|
UsbCommandId_GetAdcValue = 11,
|
||||||
UsbCommandId_LaunchEepromTransfer = 12,
|
UsbCommandId_LaunchEepromTransferLegacy = 12,
|
||||||
UsbCommandId_ReadHardwareConfiguration = 13,
|
UsbCommandId_ReadHardwareConfiguration = 13,
|
||||||
UsbCommandId_WriteHardwareConfiguration = 14,
|
UsbCommandId_WriteHardwareConfiguration = 14,
|
||||||
UsbCommandId_ReadUserConfiguration = 15,
|
UsbCommandId_ReadUserConfiguration = 15,
|
||||||
|
|||||||
Reference in New Issue
Block a user