Initial implementation of Pulsefire Surge direct mode (requires new firmware?)

This commit is contained in:
Adam Honse
2020-08-08 01:51:57 -05:00
parent 2440ab8fc9
commit 9f91170240
4 changed files with 176 additions and 22 deletions

View File

@@ -39,13 +39,44 @@ void HyperXPulsefireSurgeController::SendWakeup()
/*-----------------------------------------------------*\
| Set up Wakeup packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = 0x03;
buf[0x02] = 0x04;
buf[0x03] = 0x01;
buf[0x04] = 0x01;
buf[0x05] = 0x01;
buf[0x06] = 0x03;
buf[0x00] = 0x07;
buf[0x01] = 0x07;
buf[0x02] = 0x01;
// buf[0x00] = 0x07;
// buf[0x01] = 0x03;
// buf[0x02] = 0x04;
// buf[0x03] = 0x01;
// buf[0x04] = 0x01;
// buf[0x05] = 0x01;
// buf[0x06] = 0x03;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Wakeup packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = 0x03;
buf[0x02] = 0x01;
buf[0x03] = 0x01;
buf[0x04] = 0x01;
buf[0x05] = 0x01;
buf[0x06] = 0x64;
// buf[0x00] = 0x07;
// buf[0x01] = 0x03;
// buf[0x02] = 0x04;
// buf[0x03] = 0x01;
// buf[0x04] = 0x01;
// buf[0x05] = 0x01;
// buf[0x06] = 0x03;
/*-----------------------------------------------------*\
| Send packet |
@@ -144,7 +175,7 @@ void HyperXPulsefireSurgeController::SendWakeup()
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
//hid_send_feature_report(dev, buf, 264);
}
void HyperXPulsefireSurgeController::SendData
@@ -178,11 +209,11 @@ void HyperXPulsefireSurgeController::SendData
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
| Set up Set Configuration packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = 0x01;
buf[0x02] = 0x04;
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_CONFIGURATION;
buf[0x02] = 0x01;
/*-----------------------------------------------------*\
| DPI settings |
@@ -285,3 +316,47 @@ void HyperXPulsefireSurgeController::SendData
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXPulsefireSurgeController::SendDirect
(
RGBColor* color_data
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_DIRECT;
buf[0x03] = 0xA0;
for(int red_idx = 0; red_idx < 32; red_idx++)
{
buf[0x08 + red_idx] = RGBGetRValue(color_data[red_idx]);
}
for(int grn_idx = 0; grn_idx < 32; grn_idx++)
{
buf[0x28 + grn_idx] = RGBGetGValue(color_data[grn_idx]);
}
for(int blu_idx = 0; blu_idx < 32; blu_idx++)
{
buf[0x48 + blu_idx] = RGBGetBValue(color_data[blu_idx]);
}
buf[0x6C] = RGBGetRValue(color_data[32]);
buf[0x6D] = RGBGetGValue(color_data[32]);
buf[0x6E] = RGBGetBValue(color_data[32]);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}