Replace {GET,SET}_USB_BUFFER_UINT8 with {Get,Set}UsbRxBufferUint8

This commit is contained in:
László Monda
2017-11-11 16:49:48 +01:00
parent f4de0df149
commit 22141ba1e3
14 changed files with 75 additions and 44 deletions
@@ -5,12 +5,12 @@
void UsbCommand_WriteConfig(bool isHardware)
{
uint8_t length = GET_USB_BUFFER_UINT8(1);
uint16_t offset = GET_USB_BUFFER_UINT16(2);
uint8_t length = GetUsbRxBufferUint8(1);
uint16_t offset = GetUsbRxBufferUint16(2);
const uint8_t paramsSize = USB_STATUS_CODE_SIZE + sizeof(length) + sizeof(offset);
if (length > USB_GENERIC_HID_OUT_BUFFER_LENGTH - paramsSize) {
SET_USB_BUFFER_UINT8(0, UsbStatusCode_WriteConfig_LengthTooLarge);
SetUsbTxBufferUint8(0, UsbStatusCode_WriteConfig_LengthTooLarge);
return;
}
@@ -18,7 +18,7 @@ void UsbCommand_WriteConfig(bool isHardware)
uint16_t bufferLength = isHardware ? HARDWARE_CONFIG_SIZE : USER_CONFIG_SIZE;
if (offset + length > bufferLength) {
SET_USB_BUFFER_UINT8(0, UsbStatusCode_WriteConfig_BufferOutOfBounds);
SetUsbTxBufferUint8(0, UsbStatusCode_WriteConfig_BufferOutOfBounds);
return;
}