Store and print configuration table for Aura Addressable controller

This commit is contained in:
Adam Honse
2020-04-14 19:09:27 -05:00
parent dc88b1a752
commit 1e171fcfb0
2 changed files with 46 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ AuraAddressableController::AuraAddressableController(hid_device* dev_handle)
dev = dev_handle;
GetFirmwareVersion();
GetConfigTable();
}
AuraAddressableController::~AuraAddressableController()
@@ -92,6 +93,46 @@ void AuraAddressableController::SetMode
);
}
void AuraAddressableController::GetConfigTable()
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_REQUEST_CONFIG_TABLE;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 65);
/*-----------------------------------------------------*\
| Copy the firmware string if the reply ID is correct |
\*-----------------------------------------------------*/
if(usb_buf[1] == 0x30)
{
memcpy(config_table, &usb_buf[4], 60);
for(int i = 0; i < 60; i+=6)
{
printf("%02X %02X %02X %02X %02X %02X\r\n", config_table[i + 0],
config_table[i + 1],
config_table[i + 2],
config_table[i + 3],
config_table[i + 4],
config_table[i + 5]);
}
}
}
void AuraAddressableController::GetFirmwareVersion()
{
unsigned char usb_buf[65];

View File

@@ -49,6 +49,8 @@ public:
std::string GetDeviceName();
int GetChannelCount();
void SetLEDsDirect(std::vector<RGBColor> colors);
void SetMode
@@ -61,9 +63,12 @@ public:
private:
char device_name[16];
unsigned char config_table[60];
hid_device* dev;
unsigned int led_count;
void GetConfigTable();
void GetFirmwareVersion();
void SendEffect