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

Method SetMode

Controllers/SinowealthController/SinowealthController.cpp:100–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void SinowealthController::SetMode
101 (
102 unsigned char mode,
103 unsigned char speed,
104 unsigned char direction,
105 RGBColor* color_buf
106 )
107{
108 if (GetProfile() < SINOWEALTH_CONFIG_SIZE_MIN) return;
109
110 unsigned char usb_buf[SINOWEALTH_CONFIG_REPORT_SIZE];
111 memcpy(usb_buf, device_configuration, SINOWEALTH_CONFIG_SIZE); // Yes, we only copy 167 bytes back, for now - if anything weird starts happening use SINOWEALTH_CONFIG_REPORT_SIZE
112
113 usb_buf[0x03] = 0x7B; //write to device
114 usb_buf[0x06] = 0x00;
115
116 usb_buf[0x35] = mode;
117
118 switch (mode)
119 {
120 case GLORIOUS_MODE_OFF:
121 usb_buf[0x81] = 0x00; //mode 0 either 0x00 or 0x03
122 break;
123 case GLORIOUS_MODE_RAINBOW:
124 usb_buf[0x36] = speed;
125 usb_buf[0x37] = direction;
126 break;
127 case GLORIOUS_MODE_SPECTRUM_BREATING:
128 //colours not yet researched
129 usb_buf[0x3C] = speed; //speed for mode 3
130 usb_buf[0x3D] = 0x07; //maybe some kind of bank change?+
131 //usb_buf[0x3D] = 0x06;
132 usb_buf[0x3E] = RGBGetRValue(color_buf[0]); //mode 3 red 1
133 usb_buf[0x3F] = RGBGetBValue(color_buf[0]); //mode 3 blue 1
134 usb_buf[0x40] = RGBGetGValue(color_buf[0]); //mode 3 green 1
135 usb_buf[0x41] = RGBGetRValue(color_buf[1]); //mode 3 red 2
136 usb_buf[0x42] = RGBGetBValue(color_buf[1]); //mode 3 blue 2
137 usb_buf[0x43] = RGBGetGValue(color_buf[1]); //mode 3 green 2
138 usb_buf[0x44] = RGBGetRValue(color_buf[2]); //mode 3 red 3
139 usb_buf[0x45] = RGBGetBValue(color_buf[2]); //mode 3 blue 3
140 usb_buf[0x46] = RGBGetGValue(color_buf[2]); //mode 3 green 3
141 usb_buf[0x47] = RGBGetRValue(color_buf[3]); //mode 3 red 4
142 usb_buf[0x48] = RGBGetBValue(color_buf[3]); //mode 3 blue 4
143 usb_buf[0x49] = RGBGetGValue(color_buf[3]); //mode 3 green 4
144 usb_buf[0x4A] = RGBGetRValue(color_buf[4]); //mode 3 red 5
145 usb_buf[0x4B] = RGBGetBValue(color_buf[4]); //mode 3 blue 5
146 usb_buf[0x4C] = RGBGetGValue(color_buf[4]); //mode 3 green 5
147 usb_buf[0x4D] = RGBGetRValue(color_buf[5]); //mode 3 red 6
148 usb_buf[0x4E] = RGBGetBValue(color_buf[5]); //mode 3 blue 6
149 usb_buf[0x4F] = RGBGetGValue(color_buf[5]); //mode 3 green 6
150 usb_buf[0x50] = RGBGetRValue(color_buf[6]); //mode 3 red 7
151 usb_buf[0x51] = RGBGetBValue(color_buf[6]); //mode 3 blue 7
152 usb_buf[0x52] = RGBGetGValue(color_buf[6]); //mode 3 green 7
153 break;
154 case GLORIOUS_MODE_TAIL:
155 usb_buf[0x53] = speed; //Speed for mode 4
156 break;
157 case GLORIOUS_MODE_SPECTRUM_CYCLE:

Callers 5

DeviceUpdateModeMethod · 0.45
DeviceUpdateModeMethod · 0.45
DeviceUpdateModeMethod · 0.45
DeviceUpdateModeMethod · 0.45
DeviceUpdateModeMethod · 0.45

Calls 1

hid_send_feature_reportFunction · 0.85

Tested by

no test coverage detected