Change UsbCommandId_WriteHardwareConfig and UsbCommandId_WriteUserConfig to 0x05 and 0x06.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "usb_protocol_handler.h"
|
||||
#include "eeprom.h"
|
||||
|
||||
void UsbCommand_WriteConfig(bool isHardware)
|
||||
void UsbCommand_WriteConfig(config_buffer_id_t configBufferId)
|
||||
{
|
||||
uint8_t length = GetUsbRxBufferUint8(1);
|
||||
uint16_t offset = GetUsbRxBufferUint16(2);
|
||||
@@ -14,8 +14,8 @@ void UsbCommand_WriteConfig(bool isHardware)
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t *buffer = isHardware ? HardwareConfigBuffer.buffer : StagingUserConfigBuffer.buffer;
|
||||
uint16_t bufferLength = isHardware ? HARDWARE_CONFIG_SIZE : USER_CONFIG_SIZE;
|
||||
uint8_t *buffer = ConfigBufferIdToConfigBuffer(configBufferId)->buffer;
|
||||
uint16_t bufferLength = ConfigBufferIdToBufferSize(configBufferId);
|
||||
|
||||
if (offset + length > bufferLength) {
|
||||
SetUsbTxBufferUint8(0, UsbStatusCode_WriteConfig_BufferOutOfBounds);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef __USB_COMMAND_WRITE_CONFIG_H__
|
||||
#define __USB_COMMAND_WRITE_CONFIG_H__
|
||||
|
||||
// Functions:
|
||||
// Includes:
|
||||
|
||||
void UsbCommand_WriteConfig(bool isHardware);
|
||||
#include "config_parser/config_globals.h"
|
||||
|
||||
// Typedefs:
|
||||
|
||||
@@ -12,4 +12,8 @@
|
||||
UsbStatusCode_WriteConfig_BufferOutOfBounds = 3,
|
||||
} usb_status_code_write_config_t;
|
||||
|
||||
// Functions:
|
||||
|
||||
void UsbCommand_WriteConfig(config_buffer_id_t configBufferId);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,8 +28,8 @@ void UsbProtocolHandler(void)
|
||||
case UsbCommandId_SetTestLed:
|
||||
UsbCommand_SetTestLed();
|
||||
break;
|
||||
case UsbCommandId_WriteUserConfig:
|
||||
UsbCommand_WriteConfig(false);
|
||||
case UsbCommandId_WriteStagingUserConfig:
|
||||
UsbCommand_WriteConfig(ConfigBufferId_StagingUserConfig);
|
||||
break;
|
||||
case UsbCommandId_ApplyConfig:
|
||||
UsbCommand_ApplyConfig();
|
||||
@@ -47,7 +47,7 @@ void UsbProtocolHandler(void)
|
||||
UsbCommand_ReadConfig();
|
||||
break;
|
||||
case UsbCommandId_WriteHardwareConfig:
|
||||
UsbCommand_WriteConfig(true);
|
||||
UsbCommand_WriteConfig(ConfigBufferId_HardwareConfig);
|
||||
break;
|
||||
case UsbCommandId_GetKeyboardState:
|
||||
UsbCommand_GetKeyboardState();
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
UsbCommandId_SendKbootCommandToModule = 0x03, // was 0x13
|
||||
|
||||
UsbCommandId_ReadConfig = 0x04, // was 0x0d and 0x0f
|
||||
UsbCommandId_WriteHardwareConfig = 0x0E,
|
||||
UsbCommandId_WriteUserConfig = 0x08,
|
||||
UsbCommandId_WriteHardwareConfig = 0x05, // was 0x0e
|
||||
UsbCommandId_WriteStagingUserConfig = 0x06, // was 0x08
|
||||
UsbCommandId_ApplyConfig = 0x09,
|
||||
UsbCommandId_LaunchEepromTransferLegacy = 0x0C,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user