From 5ae3de993d3f59e4fcb432b224fbcf80cd4759f5 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Wed, 25 Dec 2019 01:21:18 -0600 Subject: [PATCH] Add capability to set ring color --- .../AMDWraithPrismController.cpp | 38 ++++++++++++++++--- .../AMDWraithPrismController.h | 1 + .../RGBController_AMDWraithPrism.cpp | 23 ++++++++++- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp b/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp index bbe2c856..86d4efdf 100644 --- a/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp +++ b/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp @@ -30,11 +30,7 @@ AMDWraithPrismController::AMDWraithPrismController(libusb_device_handle* dev_han strcpy(device_name, "AMD Wraith Prism"); SendEnableCommand(); - SendRemapCommand(); - //SendEffectCommand(); - SetFanColor(0xFF, 0x00, 0xFF); - SetLogoColor(0x00, 0xFF, 0xFF); - SetRingEffectChannel(0x07); + SetRingEffectChannel(0x00); } AMDWraithPrismController::~AMDWraithPrismController() @@ -194,6 +190,38 @@ void AMDWraithPrismController::SetLogoColor(unsigned char red, unsigned char gre libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0); } +void AMDWraithPrismController::SetRingColor(unsigned char red, unsigned char green, unsigned char blue) +{ + unsigned char usb_buf[] = + { + 0x51, 0x2C, 0x01, 0x00, + 0x00, 0xFF, 0x00, 0xFF, + 0xFF, 0xFF, 0x00, 0xFF, + 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF + }; + + int actual; + + usb_buf[0x0A] = red; + usb_buf[0x0B] = green; + usb_buf[0x0C] = blue; + + libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0); + libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0); +} + void AMDWraithPrismController::SetRingEffectChannel(unsigned char channel) { unsigned char usb_buf[] = diff --git a/Controllers/AMDWraithPrismController/AMDWraithPrismController.h b/Controllers/AMDWraithPrismController/AMDWraithPrismController.h index 78a207d6..e0d0d323 100644 --- a/Controllers/AMDWraithPrismController/AMDWraithPrismController.h +++ b/Controllers/AMDWraithPrismController/AMDWraithPrismController.h @@ -27,6 +27,7 @@ public: void SetFanColor(unsigned char red, unsigned char green, unsigned char blue); void SetLogoColor(unsigned char red, unsigned char green, unsigned char blue); + void SetRingColor(unsigned char red, unsigned char green, unsigned char blue); void SendEnableCommand(); void SendRemapCommand(); diff --git a/RGBController/RGBController_AMDWraithPrism.cpp b/RGBController/RGBController_AMDWraithPrism.cpp index 4a479313..dca363ee 100644 --- a/RGBController/RGBController_AMDWraithPrism.cpp +++ b/RGBController/RGBController_AMDWraithPrism.cpp @@ -43,7 +43,19 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl std::vector fan_zone_map; fan_zone_map.push_back(1); fan_zone.map.push_back(fan_zone_map); - zones.push_back(fan_zone); + zones.push_back(fan_zone); + + led ring_led; + ring_led.name = "Ring"; + leds.push_back(ring_led); + + zone ring_zone; + ring_zone.name = "Ring"; + ring_zone.type = ZONE_TYPE_SINGLE; + std::vector ring_zone_map; + ring_zone_map.push_back(2); + ring_zone.map.push_back(ring_zone_map); + zones.push_back(ring_zone); } RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism() @@ -74,6 +86,7 @@ void RGBController_AMDWraithPrism::SetAllLEDs(RGBColor color) wraith->SetFanColor(red, grn, blu); wraith->SetLogoColor(red, grn, blu); + wraith->SetRingColor(red, grn, blu); } void RGBController_AMDWraithPrism::SetAllZoneLEDs(int zone, RGBColor color) @@ -90,6 +103,10 @@ void RGBController_AMDWraithPrism::SetAllZoneLEDs(int zone, RGBColor color) { wraith->SetFanColor(red, grn, blu); } + else if(zone == 2) + { + wraith->SetRingColor(red, grn, blu); + } } void RGBController_AMDWraithPrism::SetLED(int led, RGBColor color) @@ -106,6 +123,10 @@ void RGBController_AMDWraithPrism::SetLED(int led, RGBColor color) { wraith->SetFanColor(red, grn, blu); } + else if(led == 2) + { + wraith->SetRingColor(red, grn, blu); + } } void RGBController_AMDWraithPrism::UpdateLEDs()