mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 01:06:11 +00:00
Initial g815 support: native effects
TODO: There is a new ripple effect that needs to be added. This commit only provides support for the current effects. Signed-off-by: Kevin Pearson <kevin.pearson@ortmanconsulting.com>
This commit is contained in:
parent
3c42eee3e8
commit
1a26bf7e64
@ -374,9 +374,10 @@ bool LedKeyboard::commit() {
|
|||||||
case KeyboardModel::g413:
|
case KeyboardModel::g413:
|
||||||
return true; // Keyboard is non-transactional
|
return true; // Keyboard is non-transactional
|
||||||
case KeyboardModel::g410:
|
case KeyboardModel::g410:
|
||||||
case KeyboardModel::g513:
|
case KeyboardModel::g513:
|
||||||
case KeyboardModel::g610:
|
case KeyboardModel::g610:
|
||||||
case KeyboardModel::g810:
|
case KeyboardModel::g810:
|
||||||
|
case KeyboardModel::g815:
|
||||||
case KeyboardModel::gpro:
|
case KeyboardModel::gpro:
|
||||||
data = { 0x11, 0xff, 0x0c, 0x5a };
|
data = { 0x11, 0xff, 0x0c, 0x5a };
|
||||||
break;
|
break;
|
||||||
@ -541,7 +542,12 @@ bool LedKeyboard::setGroupKeys(KeyGroup keyGroup, LedKeyboard::Color color) {
|
|||||||
keyArray = keyGroupLogo;
|
keyArray = keyGroupLogo;
|
||||||
break;
|
break;
|
||||||
case KeyGroup::indicators:
|
case KeyGroup::indicators:
|
||||||
keyArray = keyGroupIndicators;
|
switch (currentDevice.model) {
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
keyArray = keyGroupIndicators;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KeyGroup::gkeys:
|
case KeyGroup::gkeys:
|
||||||
keyArray = keyGroupGKeys;
|
keyArray = keyGroupGKeys;
|
||||||
@ -753,13 +759,17 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part,
|
|||||||
if (part == NativeEffectPart::logo) return true; //Does not have logo component
|
if (part == NativeEffectPart::logo) return true; //Does not have logo component
|
||||||
break;
|
break;
|
||||||
case KeyboardModel::g410:
|
case KeyboardModel::g410:
|
||||||
case KeyboardModel::g513:
|
case KeyboardModel::g513:
|
||||||
case KeyboardModel::g610: // Unconfirmed
|
case KeyboardModel::g610: // Unconfirmed
|
||||||
case KeyboardModel::g810:
|
case KeyboardModel::g810:
|
||||||
case KeyboardModel::gpro:
|
case KeyboardModel::gpro:
|
||||||
protocolBytes[0] = 0x0d;
|
protocolBytes[0] = 0x0d;
|
||||||
protocolBytes[1] = 0x3c;
|
protocolBytes[1] = 0x3c;
|
||||||
break;
|
break;
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
protocolBytes[0] = 0x0f;
|
||||||
|
protocolBytes[1] = 0x1c;
|
||||||
|
break;
|
||||||
case KeyboardModel::g910:
|
case KeyboardModel::g910:
|
||||||
protocolBytes[0] = 0x10;
|
protocolBytes[0] = 0x10;
|
||||||
protocolBytes[1] = 0x3c;
|
protocolBytes[1] = 0x3c;
|
||||||
@ -768,10 +778,6 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((effectGroup == NativeEffectGroup::waves) && (part == NativeEffectPart::logo)) {
|
|
||||||
return setNativeEffect(NativeEffect::color, part, std::chrono::seconds(0), Color({0x00, 0xff, 0xff}), storage);
|
|
||||||
}
|
|
||||||
|
|
||||||
byte_buffer_t data = {
|
byte_buffer_t data = {
|
||||||
0x11, 0xff, protocolBytes[0], protocolBytes[1],
|
0x11, 0xff, protocolBytes[0], protocolBytes[1],
|
||||||
(uint8_t)part, static_cast<uint8_t>(effectGroup),
|
(uint8_t)part, static_cast<uint8_t>(effectGroup),
|
||||||
@ -790,7 +796,54 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part,
|
|||||||
0, // unused?
|
0, // unused?
|
||||||
0, // unused?
|
0, // unused?
|
||||||
};
|
};
|
||||||
return sendDataInternal(data);
|
|
||||||
|
byte_buffer_t setupData;
|
||||||
|
bool retval;
|
||||||
|
switch (currentDevice.model) {
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
setupData = { 0x11, 0xff, 0x0f, 0x5c, 0x01, 0x03, 0x03 };
|
||||||
|
setupData.resize(20, 0x00);
|
||||||
|
retval = sendDataInternal(setupData);
|
||||||
|
|
||||||
|
data[16] = 0x01;
|
||||||
|
|
||||||
|
switch (part) {
|
||||||
|
case NativeEffectPart::keys:
|
||||||
|
data[4] = 0x01;
|
||||||
|
break;
|
||||||
|
case NativeEffectPart::logo:
|
||||||
|
data[4] = 0x00;
|
||||||
|
switch (effect) {
|
||||||
|
case NativeEffect::breathing:
|
||||||
|
data[5]=0x03;
|
||||||
|
break;
|
||||||
|
case NativeEffect::cwave:
|
||||||
|
case NativeEffect::vwave:
|
||||||
|
case NativeEffect::hwave:
|
||||||
|
data[5]=0x02;
|
||||||
|
data[13]=0x64;
|
||||||
|
break;
|
||||||
|
case NativeEffect::waves:
|
||||||
|
case NativeEffect::cycle:
|
||||||
|
data[5]=0x02;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
data[5]=0x01;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: //Many devices may not support logo coloring for wave?
|
||||||
|
if ((effectGroup == NativeEffectGroup::waves) && (part == NativeEffectPart::logo)) {
|
||||||
|
return setNativeEffect(NativeEffect::color, part, std::chrono::seconds(0), Color({0x00, 0xff, 0xff}), storage);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
retval = sendDataInternal(data);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ class LedKeyboard {
|
|||||||
{ 0x46d, 0xc338, (uint16_t)KeyboardModel::g610 },
|
{ 0x46d, 0xc338, (uint16_t)KeyboardModel::g610 },
|
||||||
{ 0x46d, 0xc331, (uint16_t)KeyboardModel::g810 },
|
{ 0x46d, 0xc331, (uint16_t)KeyboardModel::g810 },
|
||||||
{ 0x46d, 0xc337, (uint16_t)KeyboardModel::g810 },
|
{ 0x46d, 0xc337, (uint16_t)KeyboardModel::g810 },
|
||||||
|
{ 0x46d, 0xc33f, (uint16_t)KeyboardModel::g815 },
|
||||||
{ 0x46d, 0xc32b, (uint16_t)KeyboardModel::g910 },
|
{ 0x46d, 0xc32b, (uint16_t)KeyboardModel::g910 },
|
||||||
{ 0x46d, 0xc335, (uint16_t)KeyboardModel::g910 },
|
{ 0x46d, 0xc335, (uint16_t)KeyboardModel::g910 },
|
||||||
{ 0x46d, 0xc339, (uint16_t)KeyboardModel::gpro }
|
{ 0x46d, 0xc339, (uint16_t)KeyboardModel::gpro }
|
||||||
@ -63,9 +64,10 @@ class LedKeyboard {
|
|||||||
g213,
|
g213,
|
||||||
g410,
|
g410,
|
||||||
g413,
|
g413,
|
||||||
g513,
|
g513,
|
||||||
g610,
|
g610,
|
||||||
g810,
|
g810,
|
||||||
|
g815,
|
||||||
g910,
|
g910,
|
||||||
gpro
|
gpro
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user