Extract USB response codes into an enum.

This commit is contained in:
László Monda
2017-07-23 01:02:24 +02:00
parent 57136e279d
commit 4d15f6f756
2 changed files with 7 additions and 4 deletions

View File

@@ -21,7 +21,7 @@ void setError(uint8_t error) {
void setGenericError(void)
{
setError(PROTOCOL_RESPONSE_GENERIC_ERROR);
setError(UsbResponse_GenericError);
}
// Set a single byte as the response.
@@ -92,7 +92,7 @@ void readEeprom(void)
// I2cWrite(I2C_EEPROM_BUS_BASEADDR, I2C_ADDRESS_EEPROM, GenericHidInBuffer+2, 2);
// I2cRead(I2C_EEPROM_BUS_BASEADDR, I2C_ADDRESS_EEPROM, GenericHidOutBuffer+1, i2cPayloadSize);
GenericHidOutBuffer[0] = PROTOCOL_RESPONSE_SUCCESS;
GenericHidOutBuffer[0] = UsbResponse_Success;
}
void readMergeSensor(void)

View File

@@ -7,8 +7,6 @@
// Macros:
#define PROTOCOL_RESPONSE_SUCCESS 0
#define PROTOCOL_RESPONSE_GENERIC_ERROR 1
#define WRITE_LED_DRIVER_RESPONSE_INVALID_ADDRESS 1
#define WRITE_LED_DRIVER_RESPONSE_INVALID_PAYLOAD_SIZE 2
@@ -39,6 +37,11 @@
SystemProperty_FirmwareVersionId = 3,
} system_property_t;
typedef enum {
UsbResponse_Success = 0,
UsbResponse_GenericError = 1,
} usb_response_t;
// Functions:
extern void usbProtocolHandler();