Make reading and writing the hardware and user configuration possible via USB. Remove readEeprom() and writeEeprom(). Use enums instead of macros.
This commit is contained in:
@@ -3,31 +3,24 @@
|
||||
|
||||
// Includes:
|
||||
|
||||
#include "usb_interfaces/usb_interface_generic_hid.h"
|
||||
|
||||
// Macros:
|
||||
|
||||
|
||||
#define WRITE_LED_DRIVER_RESPONSE_INVALID_ADDRESS 1
|
||||
#define WRITE_LED_DRIVER_RESPONSE_INVALID_PAYLOAD_SIZE 2
|
||||
#define WRITE_EEPROM_RESPONSE_INVALID_PAYLOAD_SIZE 1
|
||||
#define UPLOAD_CONFIG_INVALID_PAYLOAD_SIZE 1
|
||||
#include "usb_interfaces/usb_interface_generic_hid.h"
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef enum {
|
||||
UsbCommand_GetSystemProperty = 0,
|
||||
UsbCommand_Reenumerate = 1,
|
||||
UsbCommand_SetTestLed = 2,
|
||||
UsbCommand_WriteLedDriver = 3,
|
||||
UsbCommand_WriteEeprom = 5,
|
||||
UsbCommand_ReadEeprom = 6,
|
||||
UsbCommand_ReadMergeSensor = 7,
|
||||
UsbCommand_UploadConfig = 8,
|
||||
UsbCommand_ApplyConfig = 9,
|
||||
UsbCommand_SetLedPwm = 10,
|
||||
UsbCommand_GetAdcValue = 11,
|
||||
UsbCommand_LaunchEepromTransfer = 12,
|
||||
UsbCommand_GetSystemProperty = 0,
|
||||
UsbCommand_Reenumerate = 1,
|
||||
UsbCommand_SetTestLed = 2,
|
||||
UsbCommand_WriteLedDriver = 3,
|
||||
UsbCommand_ReadMergeSensor = 7,
|
||||
UsbCommand_WriteUserConfiguration = 8,
|
||||
UsbCommand_ApplyConfig = 9,
|
||||
UsbCommand_SetLedPwm = 10,
|
||||
UsbCommand_GetAdcValue = 11,
|
||||
UsbCommand_LaunchEepromTransfer = 12,
|
||||
UsbCommand_ReadHardwareConfiguration = 13,
|
||||
UsbCommand_WriteHardwareConfiguration = 14,
|
||||
UsbCommand_ReadUserConfiguration = 15,
|
||||
} usb_command_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -42,6 +35,11 @@
|
||||
UsbResponse_GenericError = 1,
|
||||
} usb_response_t;
|
||||
|
||||
typedef enum {
|
||||
ConfigTransferResponse_LengthTooLarge = 1,
|
||||
ConfigTransferResponse_BufferOutOfBounds = 2,
|
||||
} config_transfer_response_t;
|
||||
|
||||
// Functions:
|
||||
|
||||
extern void usbProtocolHandler();
|
||||
|
||||
Reference in New Issue
Block a user