MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / SetLEDs

Method SetLEDs

Controllers/MSI3ZoneController/MSI3ZoneController.cpp:51–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void MSI3ZoneController::SetLEDs(std::vector<RGBColor> colors)
52{
53 //Shout out to bparker06 for reverse engineering the MSI keyboard USB protocol!
54 // https://github.com/bparker06/msi-keyboard/blob/master/keyboard.cpp for original implementation
55 unsigned char buf[8] = { 0 };
56
57 buf[0] = 1;
58 buf[1] = 2;
59 buf[2] = 64;
60 buf[3] = 1;
61 buf[4] = RGBGetRValue(colors[0]);
62 buf[5] = RGBGetGValue(colors[0]);
63 buf[6] = RGBGetBValue(colors[0]);
64 buf[7] = 236;
65
66 hid_send_feature_report(dev, buf, 8);
67
68 buf[3] = 2;
69 buf[4] = RGBGetRValue(colors[1]);
70 buf[5] = RGBGetGValue(colors[1]);
71 buf[6] = RGBGetBValue(colors[1]);
72
73 hid_send_feature_report(dev, buf, 8);
74
75 buf[3] = 3;
76 buf[4] = RGBGetRValue(colors[2]);
77 buf[5] = RGBGetGValue(colors[2]);
78 buf[6] = RGBGetBValue(colors[2]);
79
80 hid_send_feature_report(dev, buf, 8);
81
82 buf[3] = 4;
83 buf[4] = RGBGetRValue(colors[3]);
84 buf[5] = RGBGetGValue(colors[3]);
85 buf[6] = RGBGetBValue(colors[3]);
86
87 hid_send_feature_report(dev, buf, 8);
88
89 buf[3] = 5;
90
91 hid_send_feature_report(dev, buf, 8);
92
93 buf[3] = 6;
94
95 hid_send_feature_report(dev, buf, 8);
96
97 buf[3] = 7;
98
99 hid_send_feature_report(dev, buf, 8);
100}

Callers 3

DeviceUpdateLEDsMethod · 0.45
UpdateZoneLEDsMethod · 0.45
UpdateSingleLEDMethod · 0.45

Calls 1

hid_send_feature_reportFunction · 0.85

Tested by

no test coverage detected