PCB RGB support for the ASRock B550 Phantom Gaming-ITX/ax

This commit is contained in:
Michael Moore 2022-04-20 13:40:32 +00:00 committed by Adam Honse
parent 30c80adbe1
commit 87778842c9
3 changed files with 25 additions and 7 deletions

View file

@ -76,11 +76,19 @@ void PolychromeUSBController::SetDeviceInfo()
{
if(configtable[zonecnt] == 0x1E)
{
break;
/*-----------------------------------------------------------------------*\
| If we don't have this device type (0x1E) we will skip it and continue. |
\*-----------------------------------------------------------------------*/
continue;
}
newdev_info.num_leds = configtable[zonecnt];
/*--------------------------------------------------------------------------------------------------*\
| We will need to know what zone type this is, so that we can look up the name and make calls later. |
\*--------------------------------------------------------------------------------------------------*/
newdev_info.zone_type = zonecnt;
switch (zonecnt)
{
/*-----------------------------------------*\
@ -124,6 +132,12 @@ void PolychromeUSBController::WriteZone
bool allzone = false
)
{
/*----------------------------------------------------*\
| Get the device info so we can look up the zone type. |
\*----------------------------------------------------*/
PolychromeDeviceInfo device_info = GetPolychromeDevices()[zone];
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
@ -135,7 +149,7 @@ void PolychromeUSBController::WriteZone
| Set up message packet with leading 00 |
\*-----------------------------------------------------*/
usb_buf[0x01] = POLYCHROME_USB_SET_ZONE;
usb_buf[0x03] = zone;
usb_buf[0x03] = device_info.zone_type;
usb_buf[0x04] = mode;
usb_buf[0x05] = RGBGetRValue(rgb);
usb_buf[0x06] = RGBGetGValue(rgb);
@ -211,9 +225,13 @@ void PolychromeUSBController::WriteHeader
PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
{
/*-----------------------------------------------------*\
| Get the device info so we can look up the zone type |
\*-----------------------------------------------------*/
PolychromeDeviceInfo device_info = GetPolychromeDevices()[zone];
unsigned char usb_buf[65];
PolychromeZoneInfo zoneinfo;
//unsigned char all;
unsigned char r;
unsigned char g;
unsigned char b;
@ -227,7 +245,7 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x01] = POLYCHROME_USB_READ_ZONE_CONFIG;
usb_buf[0x03] = zone;
usb_buf[0x03] = device_info.zone_type;
/*-----------------------------------------------------*\
| Send packet |
@ -248,7 +266,6 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
zoneinfo.color = ToRGBColor(r,g,b);
zoneinfo.speed = usb_buf[0x08];
zoneinfo.zone = usb_buf[0x03];
//all = usb_buf[0x10];
return(zoneinfo);
}

View file

@ -99,6 +99,7 @@ struct PolychromeDeviceInfo
{
unsigned char effect_channel;
unsigned char num_leds;
unsigned char zone_type;
PolychromeDeviceType device_type;
};

View file

@ -200,14 +200,14 @@ void RGBController_PolychromeUSB::SetupZones()
if(device_info.device_type== PolychromeDeviceType::ADDRESSABLE)
{
zones[channel_idx].name = polychrome_USB_zone_names[channel_idx];
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
zones[channel_idx].leds_count = device_info.num_leds;
}
else if(device_info.device_type==PolychromeDeviceType::FIXED)
{
zones[channel_idx].name = polychrome_USB_zone_names[channel_idx];
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
zones[channel_idx].leds_min = device_info.num_leds;
zones[channel_idx].leds_max = device_info.num_leds;
zones[channel_idx].leds_count = device_info.num_leds;