Change UsbCommandId_WriteHardwareConfig and UsbCommandId_WriteUserConfig to 0x05 and 0x06.

This commit is contained in:
László Monda
2017-12-12 01:59:53 +01:00
parent 235e18d706
commit a212c254a9
4 changed files with 14 additions and 10 deletions
@@ -3,7 +3,7 @@
#include "usb_protocol_handler.h" #include "usb_protocol_handler.h"
#include "eeprom.h" #include "eeprom.h"
void UsbCommand_WriteConfig(bool isHardware) void UsbCommand_WriteConfig(config_buffer_id_t configBufferId)
{ {
uint8_t length = GetUsbRxBufferUint8(1); uint8_t length = GetUsbRxBufferUint8(1);
uint16_t offset = GetUsbRxBufferUint16(2); uint16_t offset = GetUsbRxBufferUint16(2);
@@ -14,8 +14,8 @@ void UsbCommand_WriteConfig(bool isHardware)
return; return;
} }
uint8_t *buffer = isHardware ? HardwareConfigBuffer.buffer : StagingUserConfigBuffer.buffer; uint8_t *buffer = ConfigBufferIdToConfigBuffer(configBufferId)->buffer;
uint16_t bufferLength = isHardware ? HARDWARE_CONFIG_SIZE : USER_CONFIG_SIZE; uint16_t bufferLength = ConfigBufferIdToBufferSize(configBufferId);
if (offset + length > bufferLength) { if (offset + length > bufferLength) {
SetUsbTxBufferUint8(0, UsbStatusCode_WriteConfig_BufferOutOfBounds); SetUsbTxBufferUint8(0, UsbStatusCode_WriteConfig_BufferOutOfBounds);
@@ -1,9 +1,9 @@
#ifndef __USB_COMMAND_WRITE_CONFIG_H__ #ifndef __USB_COMMAND_WRITE_CONFIG_H__
#define __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: // Typedefs:
@@ -12,4 +12,8 @@
UsbStatusCode_WriteConfig_BufferOutOfBounds = 3, UsbStatusCode_WriteConfig_BufferOutOfBounds = 3,
} usb_status_code_write_config_t; } usb_status_code_write_config_t;
// Functions:
void UsbCommand_WriteConfig(config_buffer_id_t configBufferId);
#endif #endif
+3 -3
View File
@@ -28,8 +28,8 @@ void UsbProtocolHandler(void)
case UsbCommandId_SetTestLed: case UsbCommandId_SetTestLed:
UsbCommand_SetTestLed(); UsbCommand_SetTestLed();
break; break;
case UsbCommandId_WriteUserConfig: case UsbCommandId_WriteStagingUserConfig:
UsbCommand_WriteConfig(false); UsbCommand_WriteConfig(ConfigBufferId_StagingUserConfig);
break; break;
case UsbCommandId_ApplyConfig: case UsbCommandId_ApplyConfig:
UsbCommand_ApplyConfig(); UsbCommand_ApplyConfig();
@@ -47,7 +47,7 @@ void UsbProtocolHandler(void)
UsbCommand_ReadConfig(); UsbCommand_ReadConfig();
break; break;
case UsbCommandId_WriteHardwareConfig: case UsbCommandId_WriteHardwareConfig:
UsbCommand_WriteConfig(true); UsbCommand_WriteConfig(ConfigBufferId_HardwareConfig);
break; break;
case UsbCommandId_GetKeyboardState: case UsbCommandId_GetKeyboardState:
UsbCommand_GetKeyboardState(); UsbCommand_GetKeyboardState();
+2 -2
View File
@@ -20,8 +20,8 @@
UsbCommandId_SendKbootCommandToModule = 0x03, // was 0x13 UsbCommandId_SendKbootCommandToModule = 0x03, // was 0x13
UsbCommandId_ReadConfig = 0x04, // was 0x0d and 0x0f UsbCommandId_ReadConfig = 0x04, // was 0x0d and 0x0f
UsbCommandId_WriteHardwareConfig = 0x0E, UsbCommandId_WriteHardwareConfig = 0x05, // was 0x0e
UsbCommandId_WriteUserConfig = 0x08, UsbCommandId_WriteStagingUserConfig = 0x06, // was 0x08
UsbCommandId_ApplyConfig = 0x09, UsbCommandId_ApplyConfig = 0x09,
UsbCommandId_LaunchEepromTransferLegacy = 0x0C, UsbCommandId_LaunchEepromTransferLegacy = 0x0C,