mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 09:16:11 +00:00
Add FX support for g910
This commit is contained in:
parent
36144826c4
commit
3af632a589
@ -611,6 +611,27 @@ bool Keyboard::populateAddressGroupInternal(KeyAddressGroup addressGroup, unsign
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Keyboard::populateFXAddressInternal(unsigned char *data) {
|
||||||
|
switch (kbdProtocol) {
|
||||||
|
case KeyboardProtocol::generic:
|
||||||
|
data[0] = 0x11; // Base address
|
||||||
|
data[1] = 0xff; // Base address
|
||||||
|
data[2] = 0x0d; // Base address
|
||||||
|
data[3] = 0x3c; // Base address
|
||||||
|
break;
|
||||||
|
case KeyboardProtocol::g910:
|
||||||
|
data[0] = 0x11; // Base address
|
||||||
|
data[1] = 0xff; // Base address
|
||||||
|
data[2] = 0x10; // Base address
|
||||||
|
data[3] = 0x3c; // Base address
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool Keyboard::setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[], size_t keyValueCount) {
|
bool Keyboard::setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[], size_t keyValueCount) {
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
int data_size;
|
int data_size;
|
||||||
@ -867,12 +888,9 @@ bool Keyboard::setFXColor(KeyColors colors) {
|
|||||||
unsigned char *data = new unsigned char[data_size];
|
unsigned char *data = new unsigned char[data_size];
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x00; // Keys
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x01; // Effect
|
||||||
data[3] = 0x3c; // Base address
|
|
||||||
data[4] = 0x00; // Base address
|
|
||||||
data[5] = 0x01; // Base address
|
|
||||||
data[6] = colors.red;
|
data[6] = colors.red;
|
||||||
data[7] = colors.green;
|
data[7] = colors.green;
|
||||||
data[8] = colors.blue;
|
data[8] = colors.blue;
|
||||||
@ -881,12 +899,9 @@ bool Keyboard::setFXColor(KeyColors colors) {
|
|||||||
retval = sendDataInternal(data, data_size);
|
retval = sendDataInternal(data, data_size);
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x01; // Logo
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x01; // Effect
|
||||||
data[3] = 0x3c; // Base address
|
|
||||||
data[4] = 0x01; // Base address
|
|
||||||
data[5] = 0x01; // Base address
|
|
||||||
data[6] = colors.red;
|
data[6] = colors.red;
|
||||||
data[7] = colors.green;
|
data[7] = colors.green;
|
||||||
data[8] = colors.blue;
|
data[8] = colors.blue;
|
||||||
@ -904,12 +919,9 @@ bool Keyboard::setFXBreathing(KeyColors colors, uint8_t speed) {
|
|||||||
unsigned char *data = new unsigned char[data_size];
|
unsigned char *data = new unsigned char[data_size];
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x00; // Keys
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x02; // Effect
|
||||||
data[3] = 0x3c; // Base address
|
|
||||||
data[4] = 0x00; // Base address
|
|
||||||
data[5] = 0x02; // Base address
|
|
||||||
data[6] = colors.red;
|
data[6] = colors.red;
|
||||||
data[7] = colors.green;
|
data[7] = colors.green;
|
||||||
data[8] = colors.blue;
|
data[8] = colors.blue;
|
||||||
@ -921,12 +933,9 @@ bool Keyboard::setFXBreathing(KeyColors colors, uint8_t speed) {
|
|||||||
retval = sendDataInternal(data, data_size);
|
retval = sendDataInternal(data, data_size);
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x01; // Logo
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x02; // Effect
|
||||||
data[3] = 0x3c; // Base address
|
|
||||||
data[4] = 0x01; // Base address
|
|
||||||
data[5] = 0x02; // Base address
|
|
||||||
data[6] = colors.red;
|
data[6] = colors.red;
|
||||||
data[7] = colors.green;
|
data[7] = colors.green;
|
||||||
data[8] = colors.blue;
|
data[8] = colors.blue;
|
||||||
@ -947,12 +956,9 @@ bool Keyboard::setFXColorCycle(uint8_t speed) {
|
|||||||
unsigned char *data = new unsigned char[data_size];
|
unsigned char *data = new unsigned char[data_size];
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x00; // Keys
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x03; // Effect
|
||||||
data[3] = 0x3c; // Base address
|
|
||||||
data[4] = 0x00; // Base address
|
|
||||||
data[5] = 0x03; // Base address
|
|
||||||
data[6] = 0x00;
|
data[6] = 0x00;
|
||||||
data[7] = 0x00;
|
data[7] = 0x00;
|
||||||
data[8] = 0x00;
|
data[8] = 0x00;
|
||||||
@ -966,12 +972,9 @@ bool Keyboard::setFXColorCycle(uint8_t speed) {
|
|||||||
retval = sendDataInternal(data, data_size);
|
retval = sendDataInternal(data, data_size);
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x01; // Logo
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x03; // Effect
|
||||||
data[3] = 0x3c; // Base address
|
|
||||||
data[4] = 0x01; // Base address
|
|
||||||
data[5] = 0x03; // Base address
|
|
||||||
data[6] = 0x00;
|
data[6] = 0x00;
|
||||||
data[7] = 0x00;
|
data[7] = 0x00;
|
||||||
data[8] = 0x00;
|
data[8] = 0x00;
|
||||||
@ -994,12 +997,9 @@ bool Keyboard::setFXHWave(uint8_t speed) {
|
|||||||
unsigned char *data = new unsigned char[data_size];
|
unsigned char *data = new unsigned char[data_size];
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x00; // Keys
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x04; // Effect
|
||||||
data[3] = 0x3b; // Base address
|
|
||||||
data[4] = 0x00; // Base address
|
|
||||||
data[5] = 0x04; // Base address
|
|
||||||
data[6] = 0x00;
|
data[6] = 0x00;
|
||||||
data[7] = 0x00;
|
data[7] = 0x00;
|
||||||
data[8] = 0x00;
|
data[8] = 0x00;
|
||||||
@ -1014,12 +1014,9 @@ bool Keyboard::setFXHWave(uint8_t speed) {
|
|||||||
retval = sendDataInternal(data, data_size);
|
retval = sendDataInternal(data, data_size);
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x01; // Logo
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x03; // Effect
|
||||||
data[3] = 0x3b; // Base address
|
|
||||||
data[4] = 0x01; // Base address
|
|
||||||
data[5] = 0x03; // Base address
|
|
||||||
data[6] = 0x00;
|
data[6] = 0x00;
|
||||||
data[7] = 0x00;
|
data[7] = 0x00;
|
||||||
data[8] = 0x00;
|
data[8] = 0x00;
|
||||||
@ -1043,12 +1040,9 @@ bool Keyboard::setFXVWave(uint8_t speed) {
|
|||||||
unsigned char *data = new unsigned char[data_size];
|
unsigned char *data = new unsigned char[data_size];
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x00; // Keys
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x04; // Effect
|
||||||
data[3] = 0x3b; // Base address
|
|
||||||
data[4] = 0x00; // Base address
|
|
||||||
data[5] = 0x04; // Base address
|
|
||||||
data[6] = 0x00;
|
data[6] = 0x00;
|
||||||
data[7] = 0x00;
|
data[7] = 0x00;
|
||||||
data[8] = 0x00;
|
data[8] = 0x00;
|
||||||
@ -1063,12 +1057,9 @@ bool Keyboard::setFXVWave(uint8_t speed) {
|
|||||||
retval = sendDataInternal(data, data_size);
|
retval = sendDataInternal(data, data_size);
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x01; // Logo
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x03; // Effect
|
||||||
data[3] = 0x3b; // Base address
|
|
||||||
data[4] = 0x01; // Base address
|
|
||||||
data[5] = 0x03; // Base address
|
|
||||||
data[6] = 0x00;
|
data[6] = 0x00;
|
||||||
data[7] = 0x00;
|
data[7] = 0x00;
|
||||||
data[8] = 0x00;
|
data[8] = 0x00;
|
||||||
@ -1092,12 +1083,9 @@ bool Keyboard::setFXCWave(uint8_t speed) {
|
|||||||
unsigned char *data = new unsigned char[data_size];
|
unsigned char *data = new unsigned char[data_size];
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x00; // Keys
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x04; // Effect
|
||||||
data[3] = 0x3b; // Base address
|
|
||||||
data[4] = 0x00; // Base address
|
|
||||||
data[5] = 0x04; // Base address
|
|
||||||
data[6] = 0x00;
|
data[6] = 0x00;
|
||||||
data[7] = 0x00;
|
data[7] = 0x00;
|
||||||
data[8] = 0x00;
|
data[8] = 0x00;
|
||||||
@ -1112,12 +1100,9 @@ bool Keyboard::setFXCWave(uint8_t speed) {
|
|||||||
retval = sendDataInternal(data, data_size);
|
retval = sendDataInternal(data, data_size);
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
data[0] = 0x11; // Base address
|
populateFXAddressInternal(data);
|
||||||
data[1] = 0xff; // Base address
|
data[4] = 0x01; // Logo
|
||||||
data[2] = 0x0d; // Base address
|
data[5] = 0x03; // Effect
|
||||||
data[3] = 0x3b; // Base address
|
|
||||||
data[4] = 0x01; // Base address
|
|
||||||
data[5] = 0x03; // Base address
|
|
||||||
data[6] = 0x00;
|
data[6] = 0x00;
|
||||||
data[7] = 0x00;
|
data[7] = 0x00;
|
||||||
data[8] = 0x00;
|
data[8] = 0x00;
|
||||||
|
@ -70,6 +70,7 @@ class Keyboard {
|
|||||||
libusb_context *ctx = NULL;
|
libusb_context *ctx = NULL;
|
||||||
|
|
||||||
bool populateAddressGroupInternal(KeyAddressGroup addressGroup, unsigned char *data);
|
bool populateAddressGroupInternal(KeyAddressGroup addressGroup, unsigned char *data);
|
||||||
|
bool populateFXAddressInternal(unsigned char *data);
|
||||||
bool sendDataInternal(unsigned char *data, uint16_t data_size);
|
bool sendDataInternal(unsigned char *data, uint16_t data_size);
|
||||||
bool setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[], size_t keyValueCount);
|
bool setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[], size_t keyValueCount);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user