diff --git a/right/src/usb_commands/usb_command_apply_config.c b/right/src/usb_commands/usb_command_apply_config.c index 36ca77e..edb80de 100644 --- a/right/src/usb_commands/usb_command_apply_config.c +++ b/right/src/usb_commands/usb_command_apply_config.c @@ -16,7 +16,7 @@ void UsbCommand_ApplyConfig(void) *(uint16_t*)(GenericHidOutBuffer+1) = StagingUserConfigBuffer.offset; GenericHidOutBuffer[3] = 0; - if (GenericHidOutBuffer[0] != UsbResponse_Success) { + if (GenericHidOutBuffer[0] != UsbStatusCode_Success) { return; } @@ -37,7 +37,7 @@ void UsbCommand_ApplyConfig(void) *(uint16_t*)(GenericHidOutBuffer+1) = ValidatedUserConfigBuffer.offset; GenericHidOutBuffer[3] = 1; - if (GenericHidOutBuffer[0] != UsbResponse_Success) { + if (GenericHidOutBuffer[0] != UsbStatusCode_Success) { return; } diff --git a/right/src/usb_commands/usb_command_get_property.c b/right/src/usb_commands/usb_command_get_property.c index 88ceaf7..dc384e6 100644 --- a/right/src/usb_commands/usb_command_get_property.c +++ b/right/src/usb_commands/usb_command_get_property.c @@ -27,7 +27,7 @@ void UsbCommand_GetProperty(void) SetUsbResponseWord(USER_CONFIG_SIZE); break; default: - SetUsbError(1); + SetUsbStatusCode(1); break; } } diff --git a/right/src/usb_commands/usb_command_jump_to_slave_bootloader.c b/right/src/usb_commands/usb_command_jump_to_slave_bootloader.c index c4b53db..917f0b0 100644 --- a/right/src/usb_commands/usb_command_jump_to_slave_bootloader.c +++ b/right/src/usb_commands/usb_command_jump_to_slave_bootloader.c @@ -6,7 +6,7 @@ void UsbCommand_JumpToSlaveBootloader(void) uint8_t uhkModuleDriverId = GenericHidInBuffer[1]; if (uhkModuleDriverId >= UHK_MODULE_MAX_COUNT) { - SetUsbError(JumpToBootloaderError_InvalidModuleDriverId); + SetUsbStatusCode(UsbStatusCode_JumpToSlaveBootloader_InvalidModuleDriverId); return; } diff --git a/right/src/usb_commands/usb_command_read_config.c b/right/src/usb_commands/usb_command_read_config.c index bf864bf..5482e7b 100644 --- a/right/src/usb_commands/usb_command_read_config.c +++ b/right/src/usb_commands/usb_command_read_config.c @@ -9,7 +9,7 @@ void UsbCommand_ReadConfig(bool isHardware) uint16_t offset = *(uint16_t*)(GenericHidInBuffer+2); if (length > USB_GENERIC_HID_OUT_BUFFER_LENGTH-1) { - SetUsbError(ConfigTransferResponse_LengthTooLarge); + SetUsbStatusCode(UsbStatusCode_TransferConfig_LengthTooLarge); return; } @@ -17,7 +17,7 @@ void UsbCommand_ReadConfig(bool isHardware) uint16_t bufferLength = isHardware ? HARDWARE_CONFIG_SIZE : USER_CONFIG_SIZE; if (offset + length > bufferLength) { - SetUsbError(ConfigTransferResponse_BufferOutOfBounds); + SetUsbStatusCode(UsbStatusCode_TransferConfig_BufferOutOfBounds); return; } diff --git a/right/src/usb_commands/usb_command_write_config.c b/right/src/usb_commands/usb_command_write_config.c index 5ae6eef..f20062a 100644 --- a/right/src/usb_commands/usb_command_write_config.c +++ b/right/src/usb_commands/usb_command_write_config.c @@ -9,7 +9,7 @@ void UsbCommand_WriteConfig(bool isHardware) uint16_t offset = *((uint16_t*)(GenericHidInBuffer+1+1)); if (length > USB_GENERIC_HID_OUT_BUFFER_LENGTH-1-1-2) { - SetUsbError(ConfigTransferResponse_LengthTooLarge); + SetUsbStatusCode(UsbStatusCode_TransferConfig_LengthTooLarge); return; } @@ -17,7 +17,7 @@ void UsbCommand_WriteConfig(bool isHardware) uint16_t bufferLength = isHardware ? HARDWARE_CONFIG_SIZE : USER_CONFIG_SIZE; if (offset + length > bufferLength) { - SetUsbError(ConfigTransferResponse_BufferOutOfBounds); + SetUsbStatusCode(UsbStatusCode_TransferConfig_BufferOutOfBounds); return; } diff --git a/right/src/usb_protocol_handler.c b/right/src/usb_protocol_handler.c index bf8ab92..734e71d 100644 --- a/right/src/usb_protocol_handler.c +++ b/right/src/usb_protocol_handler.c @@ -13,7 +13,7 @@ #include "usb_commands/usb_command_jump_to_slave_bootloader.h" #include "usb_commands/usb_command_send_kboot_command.h" -void SetUsbError(uint8_t error) +void SetUsbStatusCode(uint8_t error) { GenericHidOutBuffer[0] = error; } @@ -79,7 +79,7 @@ void UsbProtocolHandler(void) UsbCommand_SendKbootCommand(); break; default: - SetUsbError(UsbResponse_InvalidCommand); + SetUsbStatusCode(UsbStatusCode_InvalidCommand); break; } } diff --git a/right/src/usb_protocol_handler.h b/right/src/usb_protocol_handler.h index 9159a8d..3e3375a 100644 --- a/right/src/usb_protocol_handler.h +++ b/right/src/usb_protocol_handler.h @@ -27,23 +27,23 @@ } usb_command_id_t; typedef enum { - UsbResponse_Success = 0, - UsbResponse_InvalidCommand = 1, + UsbStatusCode_Success = 0, + UsbStatusCode_InvalidCommand = 1, } usb_response_t; typedef enum { - ConfigTransferResponse_LengthTooLarge = 1, - ConfigTransferResponse_BufferOutOfBounds = 2, + UsbStatusCode_TransferConfig_LengthTooLarge = 1, + UsbStatusCode_TransferConfig_BufferOutOfBounds = 2, } config_transfer_response_t; typedef enum { - JumpToBootloaderError_InvalidModuleDriverId = 1, + UsbStatusCode_JumpToSlaveBootloader_InvalidModuleDriverId = 1, } jump_to_bootloader_error_t; // Functions: void UsbProtocolHandler(void); - void SetUsbError(uint8_t error); + void SetUsbStatusCode(uint8_t status); void SetUsbResponseByte(uint8_t response); void SetUsbResponseWord(uint16_t response);