Skip to content

Commit 8777884

Browse files
stuporglueCalcProgrammer1
authored andcommitted
PCB RGB support for the ASRock B550 Phantom Gaming-ITX/ax
1 parent 30c80ad commit 8777884

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,19 @@ void PolychromeUSBController::SetDeviceInfo()
7676
{
7777
if(configtable[zonecnt] == 0x1E)
7878
{
79-
break;
79+
/*-----------------------------------------------------------------------*\
80+
| If we don't have this device type (0x1E) we will skip it and continue. |
81+
\*-----------------------------------------------------------------------*/
82+
continue;
8083
}
8184

8285
newdev_info.num_leds = configtable[zonecnt];
8386

87+
/*--------------------------------------------------------------------------------------------------*\
88+
| We will need to know what zone type this is, so that we can look up the name and make calls later. |
89+
\*--------------------------------------------------------------------------------------------------*/
90+
newdev_info.zone_type = zonecnt;
91+
8492
switch (zonecnt)
8593
{
8694
/*-----------------------------------------*\
@@ -124,6 +132,12 @@ void PolychromeUSBController::WriteZone
124132
bool allzone = false
125133
)
126134
{
135+
136+
/*----------------------------------------------------*\
137+
| Get the device info so we can look up the zone type. |
138+
\*----------------------------------------------------*/
139+
PolychromeDeviceInfo device_info = GetPolychromeDevices()[zone];
140+
127141
unsigned char usb_buf[65];
128142

129143
/*-----------------------------------------------------*\
@@ -135,7 +149,7 @@ void PolychromeUSBController::WriteZone
135149
| Set up message packet with leading 00 |
136150
\*-----------------------------------------------------*/
137151
usb_buf[0x01] = POLYCHROME_USB_SET_ZONE;
138-
usb_buf[0x03] = zone;
152+
usb_buf[0x03] = device_info.zone_type;
139153
usb_buf[0x04] = mode;
140154
usb_buf[0x05] = RGBGetRValue(rgb);
141155
usb_buf[0x06] = RGBGetGValue(rgb);
@@ -211,9 +225,13 @@ void PolychromeUSBController::WriteHeader
211225

212226
PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
213227
{
228+
/*-----------------------------------------------------*\
229+
| Get the device info so we can look up the zone type |
230+
\*-----------------------------------------------------*/
231+
PolychromeDeviceInfo device_info = GetPolychromeDevices()[zone];
232+
214233
unsigned char usb_buf[65];
215234
PolychromeZoneInfo zoneinfo;
216-
//unsigned char all;
217235
unsigned char r;
218236
unsigned char g;
219237
unsigned char b;
@@ -227,7 +245,7 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
227245
| Set up config table request packet |
228246
\*-----------------------------------------------------*/
229247
usb_buf[0x01] = POLYCHROME_USB_READ_ZONE_CONFIG;
230-
usb_buf[0x03] = zone;
248+
usb_buf[0x03] = device_info.zone_type;
231249

232250
/*-----------------------------------------------------*\
233251
| Send packet |
@@ -248,7 +266,6 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
248266
zoneinfo.color = ToRGBColor(r,g,b);
249267
zoneinfo.speed = usb_buf[0x08];
250268
zoneinfo.zone = usb_buf[0x03];
251-
//all = usb_buf[0x10];
252269

253270
return(zoneinfo);
254271
}

Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct PolychromeDeviceInfo
9999
{
100100
unsigned char effect_channel;
101101
unsigned char num_leds;
102+
unsigned char zone_type;
102103
PolychromeDeviceType device_type;
103104
};
104105

Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,14 @@ void RGBController_PolychromeUSB::SetupZones()
200200

201201
if(device_info.device_type== PolychromeDeviceType::ADDRESSABLE)
202202
{
203-
zones[channel_idx].name = polychrome_USB_zone_names[channel_idx];
203+
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
204204
zones[channel_idx].leds_min = 0;
205205
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
206206
zones[channel_idx].leds_count = device_info.num_leds;
207207
}
208208
else if(device_info.device_type==PolychromeDeviceType::FIXED)
209209
{
210-
zones[channel_idx].name = polychrome_USB_zone_names[channel_idx];
210+
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
211211
zones[channel_idx].leds_min = device_info.num_leds;
212212
zones[channel_idx].leds_max = device_info.num_leds;
213213
zones[channel_idx].leds_count = device_info.num_leds;

0 commit comments

Comments
 (0)