Initial support for Galax v2 GPU controller
This commit is contained in:
parent
34ff3aa99a
commit
d98db1587b
11 changed files with 858 additions and 354 deletions
|
|
@ -1,109 +0,0 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| GalaxGPUController.cpp |
|
||||
| |
|
||||
| Driver for Galax/KFA2 GPU |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "GalaxGPUController.h"
|
||||
|
||||
GalaxGPUController::GalaxGPUController(i2c_smbus_interface* bus, galax_gpu_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder.
|
||||
}
|
||||
|
||||
GalaxGPUController::~GalaxGPUController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string GalaxGPUController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string GalaxGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return("I2C: " + return_string);
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUController::GetLEDRed()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_RED_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUController::GetLEDGreen()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_GREEN_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUController::GetLEDBlue()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_BLUE_REGISTER));
|
||||
}
|
||||
|
||||
void GalaxGPUController::SetLEDColorsDirect(unsigned char red, unsigned char green, unsigned char blue) // Direct Mode is just Static Mode without applying color changes
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_RED_REGISTER, red);
|
||||
GalaxGPURegisterWrite(GALAX_GREEN_REGISTER, green);
|
||||
GalaxGPURegisterWrite(GALAX_BLUE_REGISTER, blue);
|
||||
}
|
||||
|
||||
void GalaxGPUController::SetLEDColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_RED_REGISTER, red);
|
||||
GalaxGPURegisterWrite(GALAX_GREEN_REGISTER, green);
|
||||
GalaxGPURegisterWrite(GALAX_BLUE_REGISTER, blue);
|
||||
}
|
||||
|
||||
void GalaxGPUController::SetMode(unsigned char mode)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case 1:
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_STATIC_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_STATIC_VALUE_2);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_BREATHING_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_BREATHING_VALUE_2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_RAINBOW_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_RAINBOW_VALUE_2);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_CYCLE_BREATHING_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_CYCLE_BREATHING_VALUE_2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUController::GalaxGPURegisterRead(unsigned char reg)
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, reg));
|
||||
}
|
||||
|
||||
void GalaxGPUController::GalaxGPURegisterWrite(unsigned char reg, unsigned char val)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, reg, val);
|
||||
}
|
||||
|
|
@ -10,8 +10,10 @@
|
|||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "GalaxGPUController.h"
|
||||
#include "RGBController_GalaxGPU.h"
|
||||
#include "GalaxGPUv1Controller.h"
|
||||
#include "GalaxGPUv2Controller.h"
|
||||
#include "RGBController_GalaxGPUv1.h"
|
||||
#include "RGBController_GalaxGPUv2.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
|
||||
|
|
@ -26,17 +28,33 @@
|
|||
bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
unsigned char res;
|
||||
|
||||
unsigned char res = bus->i2c_smbus_read_byte_data(address, 0x00);
|
||||
unsigned char res2 = bus->i2c_smbus_read_byte_data(address, 0x01);
|
||||
|
||||
if((res == 0x27 || res == 0x26) && (res2 == 0x10 || res2 == 0x20))
|
||||
switch (address)
|
||||
{
|
||||
pass = true;
|
||||
/*-----------------------------------------------------------------*\
|
||||
| V1 Controller |
|
||||
\*-----------------------------------------------------------------*/
|
||||
case 0x32:
|
||||
res = bus->i2c_smbus_read_byte_data(address, 0x00);
|
||||
if(res == 0x27 || res == 0x26) {
|
||||
res = bus->i2c_smbus_read_byte_data(address, 0x01);
|
||||
if (res == 0x10 || res == 0x20)
|
||||
pass = true;
|
||||
}
|
||||
break;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| V2 Controller |
|
||||
\*-----------------------------------------------------------------*/
|
||||
case 0x51:
|
||||
res = bus->i2c_smbus_read_byte_data(address, 0x00);
|
||||
if (res == 0x80)
|
||||
pass = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForGalaxGPUController() */
|
||||
|
||||
|
||||
|
|
@ -52,11 +70,34 @@ void DetectGalaxGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const
|
|||
{
|
||||
if(TestForGalaxGPUController(bus, i2c_addr))
|
||||
{
|
||||
GalaxGPUController* controller = new GalaxGPUController(bus, i2c_addr);
|
||||
RGBController_GalaxGPU* rgb_controller = new RGBController_GalaxGPU(controller);
|
||||
rgb_controller->name = name;
|
||||
switch(i2c_addr)
|
||||
{
|
||||
/*-----------------------------------------------------------------*\
|
||||
| V1 Controller |
|
||||
\*-----------------------------------------------------------------*/
|
||||
case 0x32:
|
||||
{
|
||||
GalaxGPUv1Controller* controller = new GalaxGPUv1Controller(bus, i2c_addr);
|
||||
RGBController_GalaxGPUv1* rgb_controller = new RGBController_GalaxGPUv1(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
break;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| V2 Controller |
|
||||
\*-----------------------------------------------------------------*/
|
||||
case 0x51:
|
||||
{
|
||||
GalaxGPUv2Controller* controller = new GalaxGPUv2Controller(bus, i2c_addr);
|
||||
RGBController_GalaxGPUv2* rgb_controller = new RGBController_GalaxGPUv2(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* DetectGalaxGPUControllers() */
|
||||
|
||||
|
|
@ -66,3 +107,4 @@ REGISTER_I2C_PCI_DETECTOR("GALAX GeForce RTX 2070 SUPER EX Gamer Black", Dete
|
|||
REGISTER_I2C_PCI_DETECTOR("KFA2 GeForce RTX 2080 EX OC", DetectGalaxGPUControllers, NVIDIA_VEN, NVIDIA_RTX2080_DEV, NVIDIA_SUB_VEN, KFA2_RTX_2080_EX_OC_SUB_DEV, 0x23);
|
||||
REGISTER_I2C_PCI_DETECTOR("KFA2 GeForce RTX 2080 SUPER EX OC", DetectGalaxGPUControllers, NVIDIA_VEN, NVIDIA_RTX2080S_DEV, NVIDIA_SUB_VEN, KFA2_RTX_2080_SUPER_EX_OC_SUB_DEV, 0x23);
|
||||
REGISTER_I2C_PCI_DETECTOR("KFA2 GeForce RTX 2080 Ti EX OC", DetectGalaxGPUControllers, NVIDIA_VEN, NVIDIA_RTX2080TI_DEV, NVIDIA_SUB_VEN, KFA2_RTX_2080TI_EX_OC_SUB_DEV, 0x23);
|
||||
REGISTER_I2C_PCI_DETECTOR("GALAX GeForce RTX 5070 Ti EX Gamer 1-Click OC", DetectGalaxGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, NVIDIA_SUB_VEN, GALAX_RTX_5070TI_EX_OC_SUB_DEV, 0x51);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| GalaxGPUv1Controller.cpp |
|
||||
| |
|
||||
| Driver for Galax/KFA2 GPU |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "GalaxGPUv1Controller.h"
|
||||
|
||||
GalaxGPUv1Controller::GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder.
|
||||
}
|
||||
|
||||
GalaxGPUv1Controller::~GalaxGPUv1Controller()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string GalaxGPUv1Controller::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string GalaxGPUv1Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return("I2C: " + return_string);
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv1Controller::GetLEDRed()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_V1_RED_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv1Controller::GetLEDGreen()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_V1_GREEN_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv1Controller::GetLEDBlue()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_V1_BLUE_REGISTER));
|
||||
}
|
||||
|
||||
void GalaxGPUv1Controller::SetLEDColorsDirect(unsigned char red, unsigned char green, unsigned char blue) // Direct Mode is just Static Mode without applying color changes
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_V1_RED_REGISTER, red);
|
||||
GalaxGPURegisterWrite(GALAX_V1_GREEN_REGISTER, green);
|
||||
GalaxGPURegisterWrite(GALAX_V1_BLUE_REGISTER, blue);
|
||||
}
|
||||
|
||||
void GalaxGPUv1Controller::SetLEDColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_V1_RED_REGISTER, red);
|
||||
GalaxGPURegisterWrite(GALAX_V1_GREEN_REGISTER, green);
|
||||
GalaxGPURegisterWrite(GALAX_V1_BLUE_REGISTER, blue);
|
||||
}
|
||||
|
||||
void GalaxGPUv1Controller::SetMode(unsigned char mode)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case 1:
|
||||
GalaxGPURegisterWrite(GALAX_V1_MODE_REGISTER_1, GALAX_V1_MODE_STATIC_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_V1_MODE_REGISTER_2, GALAX_V1_MODE_STATIC_VALUE_2);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
GalaxGPURegisterWrite(GALAX_V1_MODE_REGISTER_1, GALAX_V1_MODE_BREATHING_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_V1_MODE_REGISTER_2, GALAX_V1_MODE_BREATHING_VALUE_2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
GalaxGPURegisterWrite(GALAX_V1_MODE_REGISTER_1, GALAX_V1_MODE_RAINBOW_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_V1_MODE_REGISTER_2, GALAX_V1_MODE_RAINBOW_VALUE_2);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
GalaxGPURegisterWrite(GALAX_V1_MODE_REGISTER_1, GALAX_V1_MODE_CYCLE_BREATHING_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_V1_MODE_REGISTER_2, GALAX_V1_MODE_CYCLE_BREATHING_VALUE_2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv1Controller::GalaxGPURegisterRead(unsigned char reg)
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, reg));
|
||||
}
|
||||
|
||||
void GalaxGPUv1Controller::GalaxGPURegisterWrite(unsigned char reg, unsigned char val)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, reg, val);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| GalaxGPUController.h |
|
||||
| GalaxGPUv1Controller.h |
|
||||
| |
|
||||
| Driver for Galax/KFA2 GPU |
|
||||
| |
|
||||
|
|
@ -19,35 +19,35 @@ typedef unsigned char galax_gpu_dev_id;
|
|||
enum
|
||||
{
|
||||
/* RGB Registers */
|
||||
GALAX_RED_REGISTER = 0x02, /* Red Register */
|
||||
GALAX_GREEN_REGISTER = 0x03, /* Green Register */
|
||||
GALAX_BLUE_REGISTER = 0x04, /* Blue Register */
|
||||
GALAX_V1_RED_REGISTER = 0x02, /* Red Register */
|
||||
GALAX_V1_GREEN_REGISTER = 0x03, /* Green Register */
|
||||
GALAX_V1_BLUE_REGISTER = 0x04, /* Blue Register */
|
||||
/* MODE Registers */
|
||||
GALAX_MODE_REGISTER_1 = 0x05, /* Mode Register 1 */
|
||||
GALAX_MODE_REGISTER_2 = 0x06, /* Mode Register 2 */
|
||||
GALAX_V1_MODE_REGISTER_1 = 0x05, /* Mode Register 1 */
|
||||
GALAX_V1_MODE_REGISTER_2 = 0x06, /* Mode Register 2 */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
/* Static Mode Values */
|
||||
GALAX_MODE_STATIC_VALUE_1 = 0x00,
|
||||
GALAX_MODE_STATIC_VALUE_2 = 0x01,
|
||||
GALAX_V1_MODE_STATIC_VALUE_1 = 0x00,
|
||||
GALAX_V1_MODE_STATIC_VALUE_2 = 0x01,
|
||||
/* Breathing Mode Values */
|
||||
GALAX_MODE_BREATHING_VALUE_1 = 0x04,
|
||||
GALAX_MODE_BREATHING_VALUE_2 = 0x00,
|
||||
GALAX_V1_MODE_BREATHING_VALUE_1 = 0x04,
|
||||
GALAX_V1_MODE_BREATHING_VALUE_2 = 0x00,
|
||||
/* Rainbow Mode Values */
|
||||
GALAX_MODE_RAINBOW_VALUE_1 = 0x84,
|
||||
GALAX_MODE_RAINBOW_VALUE_2 = 0x02,
|
||||
GALAX_V1_MODE_RAINBOW_VALUE_1 = 0x84,
|
||||
GALAX_V1_MODE_RAINBOW_VALUE_2 = 0x02,
|
||||
/* Cycle Breathing Mode Values */
|
||||
GALAX_MODE_CYCLE_BREATHING_VALUE_1 = 0x84,
|
||||
GALAX_MODE_CYCLE_BREATHING_VALUE_2 = 0x40,
|
||||
GALAX_V1_MODE_CYCLE_BREATHING_VALUE_1 = 0x84,
|
||||
GALAX_V1_MODE_CYCLE_BREATHING_VALUE_2 = 0x40,
|
||||
};
|
||||
|
||||
class GalaxGPUController
|
||||
class GalaxGPUv1Controller
|
||||
{
|
||||
public:
|
||||
GalaxGPUController(i2c_smbus_interface* bus, galax_gpu_dev_id);
|
||||
~GalaxGPUController();
|
||||
GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id);
|
||||
~GalaxGPUv1Controller();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
|
|
@ -1,179 +1,179 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| RGBController_GalaxGPU.cpp |
|
||||
| |
|
||||
| RGBController for Galax/KFA2 GPU |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_GalaxGPU.h"
|
||||
|
||||
int RGBController_GalaxGPU::GetDeviceMode()
|
||||
{
|
||||
int modereg1 = controller->GalaxGPURegisterRead(GALAX_MODE_REGISTER_1);
|
||||
int modereg2 = controller->GalaxGPURegisterRead(GALAX_MODE_REGISTER_2);
|
||||
|
||||
if(modereg1 == GALAX_MODE_STATIC_VALUE_1 && modereg2 == GALAX_MODE_STATIC_VALUE_2)
|
||||
{
|
||||
active_mode = 1;
|
||||
modes[active_mode].color_mode = MODE_COLORS_PER_LED;
|
||||
}
|
||||
|
||||
if(modereg1 == GALAX_MODE_BREATHING_VALUE_1 && modereg2 == GALAX_MODE_BREATHING_VALUE_2)
|
||||
{
|
||||
active_mode = 2;
|
||||
modes[active_mode].color_mode = MODE_COLORS_PER_LED;
|
||||
}
|
||||
|
||||
if(modereg1 == GALAX_MODE_RAINBOW_VALUE_1 && modereg2 == GALAX_MODE_RAINBOW_VALUE_2)
|
||||
{
|
||||
active_mode = 3;
|
||||
modes[active_mode].color_mode = MODE_COLORS_NONE;
|
||||
}
|
||||
|
||||
if(modereg1 == GALAX_MODE_CYCLE_BREATHING_VALUE_1 && modereg2 == GALAX_MODE_CYCLE_BREATHING_VALUE_2)
|
||||
{
|
||||
active_mode = 4;
|
||||
modes[active_mode].color_mode = MODE_COLORS_NONE;
|
||||
}
|
||||
|
||||
return(active_mode);
|
||||
}
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Galax GPU
|
||||
@category GPU
|
||||
@type I2C
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectGalaxGPUControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_GalaxGPU::RGBController_GalaxGPU(GalaxGPUController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "GALAX";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "GALAX / KFA2 RTX GPU";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 1;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = 2;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = 3;
|
||||
Rainbow.flags = 0;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Cycle_Breathing;
|
||||
Cycle_Breathing.name = "Cycle Breathing";
|
||||
Cycle_Breathing.value = 4;
|
||||
Cycle_Breathing.flags = 0;
|
||||
Cycle_Breathing.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Cycle_Breathing);
|
||||
|
||||
SetupZones();
|
||||
|
||||
active_mode = GetDeviceMode();
|
||||
}
|
||||
|
||||
RGBController_GalaxGPU::~RGBController_GalaxGPU()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone galax_gpu_zone;
|
||||
galax_gpu_zone.name = "GPU";
|
||||
galax_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
galax_gpu_zone.leds_min = 1;
|
||||
galax_gpu_zone.leds_max = 1;
|
||||
galax_gpu_zone.leds_count = 1;
|
||||
galax_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(galax_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led galax_gpu_led;
|
||||
galax_gpu_led.name = "GPU";
|
||||
leds.push_back(galax_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = controller->GetLEDRed();
|
||||
unsigned char grn = controller->GetLEDGreen();
|
||||
unsigned char blu = controller->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
|
||||
if(GetMode() == 1)
|
||||
{
|
||||
controller->SetLEDColorsDirect(red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SetLEDColorsEffect(red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::DeviceUpdateMode()
|
||||
{
|
||||
int new_mode = modes[active_mode].value;
|
||||
|
||||
controller->SetMode(new_mode);
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_GalaxGPUv1.cpp |
|
||||
| |
|
||||
| RGBController for Galax/KFA2 GPU |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_GalaxGPUv1.h"
|
||||
|
||||
int RGBController_GalaxGPUv1::GetDeviceMode()
|
||||
{
|
||||
int modereg1 = controller->GalaxGPURegisterRead(GALAX_V1_MODE_REGISTER_1);
|
||||
int modereg2 = controller->GalaxGPURegisterRead(GALAX_V1_MODE_REGISTER_2);
|
||||
|
||||
if(modereg1 == GALAX_V1_MODE_STATIC_VALUE_1 && modereg2 == GALAX_V1_MODE_STATIC_VALUE_2)
|
||||
{
|
||||
active_mode = 1;
|
||||
modes[active_mode].color_mode = MODE_COLORS_PER_LED;
|
||||
}
|
||||
|
||||
if(modereg1 == GALAX_V1_MODE_BREATHING_VALUE_1 && modereg2 == GALAX_V1_MODE_BREATHING_VALUE_2)
|
||||
{
|
||||
active_mode = 2;
|
||||
modes[active_mode].color_mode = MODE_COLORS_PER_LED;
|
||||
}
|
||||
|
||||
if(modereg1 == GALAX_V1_MODE_RAINBOW_VALUE_1 && modereg2 == GALAX_V1_MODE_RAINBOW_VALUE_2)
|
||||
{
|
||||
active_mode = 3;
|
||||
modes[active_mode].color_mode = MODE_COLORS_NONE;
|
||||
}
|
||||
|
||||
if(modereg1 == GALAX_V1_MODE_CYCLE_BREATHING_VALUE_1 && modereg2 == GALAX_V1_MODE_CYCLE_BREATHING_VALUE_2)
|
||||
{
|
||||
active_mode = 4;
|
||||
modes[active_mode].color_mode = MODE_COLORS_NONE;
|
||||
}
|
||||
|
||||
return(active_mode);
|
||||
}
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Galax GPU v1
|
||||
@category GPU
|
||||
@type I2C
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectGalaxGPUv1Controllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_GalaxGPUv1::RGBController_GalaxGPUv1(GalaxGPUv1Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "GALAX";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "GALAX / KFA2 RTX GPU";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 1;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = 2;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = 3;
|
||||
Rainbow.flags = 0;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Cycle_Breathing;
|
||||
Cycle_Breathing.name = "Cycle Breathing";
|
||||
Cycle_Breathing.value = 4;
|
||||
Cycle_Breathing.flags = 0;
|
||||
Cycle_Breathing.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Cycle_Breathing);
|
||||
|
||||
SetupZones();
|
||||
|
||||
active_mode = GetDeviceMode();
|
||||
}
|
||||
|
||||
RGBController_GalaxGPUv1::~RGBController_GalaxGPUv1()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv1::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone galax_gpu_zone;
|
||||
galax_gpu_zone.name = "GPU";
|
||||
galax_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
galax_gpu_zone.leds_min = 1;
|
||||
galax_gpu_zone.leds_max = 1;
|
||||
galax_gpu_zone.leds_count = 1;
|
||||
galax_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(galax_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led galax_gpu_led;
|
||||
galax_gpu_led.name = "GPU";
|
||||
leds.push_back(galax_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = controller->GetLEDRed();
|
||||
unsigned char grn = controller->GetLEDGreen();
|
||||
unsigned char blu = controller->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv1::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv1::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
|
||||
if(GetMode() == 1)
|
||||
{
|
||||
controller->SetLEDColorsDirect(red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SetLEDColorsEffect(red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv1::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv1::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv1::DeviceUpdateMode()
|
||||
{
|
||||
int new_mode = modes[active_mode].value;
|
||||
|
||||
controller->SetMode(new_mode);
|
||||
}
|
||||
|
|
@ -1,37 +1,37 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| RGBController_GalaxGPU.h |
|
||||
| |
|
||||
| RGBController for Galax/KFA2 GPU |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GalaxGPUController.h"
|
||||
|
||||
class RGBController_GalaxGPU : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GalaxGPU(GalaxGPUController* controller_ptr);
|
||||
~RGBController_GalaxGPU();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GalaxGPUController* controller;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_GalaxGPUv1.h |
|
||||
| |
|
||||
| RGBController for Galax/KFA2 GPU |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GalaxGPUv1Controller.h"
|
||||
|
||||
class RGBController_GalaxGPUv1 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GalaxGPUv1(GalaxGPUv1Controller* controller_ptr);
|
||||
~RGBController_GalaxGPUv1();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GalaxGPUv1Controller* controller;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| GalaxGPUv2Controller.cpp |
|
||||
| |
|
||||
| RGBController for Galax GPUs (Xtreme Tuner) |
|
||||
| |
|
||||
| Daniel Stuart (daniel.stuart14) 26 may 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "GalaxGPUv2Controller.h"
|
||||
|
||||
GalaxGPUv2Controller::GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder.
|
||||
}
|
||||
|
||||
GalaxGPUv2Controller::~GalaxGPUv2Controller()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string GalaxGPUv2Controller::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string GalaxGPUv2Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return("I2C: " + return_string);
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv2Controller::GetLEDRed()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_V2_RED_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv2Controller::GetLEDGreen()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_V2_GREEN_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv2Controller::GetLEDBlue()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_V2_BLUE_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv2Controller::GetMode()
|
||||
{
|
||||
return GalaxGPURegisterRead(GALAX_V2_MODE_REGISTER);
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv2Controller::GetSync()
|
||||
{
|
||||
return GalaxGPURegisterRead(GALAX_V2_SYNC_REGISTER);
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv2Controller::GetSpeed()
|
||||
{
|
||||
return GalaxGPURegisterRead(GALAX_V2_SPEED_REGISTER_A);
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv2Controller::GetBrightness()
|
||||
{
|
||||
return GalaxGPURegisterRead(GALAX_V2_BRIGHTNESS_REGISTER);
|
||||
}
|
||||
|
||||
void GalaxGPUv2Controller::SetLEDColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_V2_RED_REGISTER, red);
|
||||
GalaxGPURegisterWrite(GALAX_V2_GREEN_REGISTER, green);
|
||||
GalaxGPURegisterWrite(GALAX_V2_BLUE_REGISTER, blue);
|
||||
}
|
||||
|
||||
void GalaxGPUv2Controller::SetMode(unsigned char value)
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_V2_MODE_REGISTER, value);
|
||||
}
|
||||
|
||||
void GalaxGPUv2Controller::SetSync(unsigned char value)
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_V2_SYNC_REGISTER, value);
|
||||
}
|
||||
|
||||
void GalaxGPUv2Controller::SetSpeed(unsigned char value)
|
||||
{
|
||||
// We just duplicate the value to both speed registers
|
||||
GalaxGPURegisterWrite(GALAX_V2_SPEED_REGISTER_A, value);
|
||||
GalaxGPURegisterWrite(GALAX_V2_SPEED_REGISTER_B, value);
|
||||
}
|
||||
|
||||
void GalaxGPUv2Controller::SetBrightness(unsigned char value)
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_V2_BRIGHTNESS_REGISTER, value);
|
||||
}
|
||||
|
||||
void GalaxGPUv2Controller::SaveMode()
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_V2_SAVE_REGISTER, GALAX_V2_SAVE_VALUE);
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUv2Controller::GalaxGPURegisterRead(unsigned char reg)
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, reg));
|
||||
}
|
||||
|
||||
void GalaxGPUv2Controller::GalaxGPURegisterWrite(unsigned char reg, unsigned char val)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, reg, val);
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| GalaxGPUv2Controller.h |
|
||||
| |
|
||||
| RGBController for Galax GPUs (Xtreme Tuner) |
|
||||
| |
|
||||
| Daniel Stuart (daniel.stuart14) 26 may 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
typedef unsigned char galax_gpu_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
GALAX_V2_RED_REGISTER = 0x02, /* Red Register */
|
||||
GALAX_V2_GREEN_REGISTER = 0x03, /* Green Register */
|
||||
GALAX_V2_BLUE_REGISTER = 0x04, /* Blue Register */
|
||||
GALAX_V2_SPEED_REGISTER_A = 0x21, /* Speed Register A */
|
||||
GALAX_V2_SPEED_REGISTER_B = 0x22, /* Speed Register B */
|
||||
GALAX_V2_SYNC_REGISTER = 0x27, /* Sync Register */
|
||||
GALAX_V2_BRIGHTNESS_REGISTER = 0x2D, /* Brightness Register */
|
||||
GALAX_V2_MODE_REGISTER = 0x30, /* Mode Register */
|
||||
GALAX_V2_SAVE_REGISTER = 0x40, /* Save Register */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GALAX_V2_MODE_STATIC_VALUE = 0x01, /* Static Mode */
|
||||
GALAX_V2_MODE_BREATHING_VALUE = 0x02, /* Breathing Mode */
|
||||
GALAX_V2_MODE_RAINBOW_VALUE = 0x16, /* Rainbow Mode */
|
||||
GALAX_V2_MODE_OFF_VALUE = 0x19, /* Off Mode */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GALAX_V2_SYNC_OFF = 0x00, /* Sync Off */
|
||||
GALAX_V2_SYNC_ON = 0x01, /* Sync On */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GALAX_V2_SAVE_VALUE = 0x5A, /* Save Value */
|
||||
};
|
||||
|
||||
class GalaxGPUv2Controller
|
||||
{
|
||||
public:
|
||||
GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id);
|
||||
~GalaxGPUv2Controller();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned char GetLEDRed();
|
||||
unsigned char GetLEDGreen();
|
||||
unsigned char GetLEDBlue();
|
||||
unsigned char GetMode();
|
||||
unsigned char GetSync();
|
||||
unsigned char GetSpeed();
|
||||
unsigned char GetBrightness();
|
||||
void SetLEDColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetMode(unsigned char value);
|
||||
void SetSync(unsigned char value);
|
||||
void SetSpeed(unsigned char value);
|
||||
void SetBrightness(unsigned char value);
|
||||
void SaveMode();
|
||||
|
||||
unsigned char GalaxGPURegisterRead(unsigned char reg);
|
||||
void GalaxGPURegisterWrite(unsigned char reg, unsigned char val);
|
||||
|
||||
bool direct = false; // Temporary solution to check if we are in "Direct" mode
|
||||
|
||||
private:
|
||||
char device_name[16];
|
||||
i2c_smbus_interface * bus;
|
||||
galax_gpu_dev_id dev;
|
||||
};
|
||||
|
|
@ -0,0 +1,221 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| RGBController_GalaxGPUv2.cpp |
|
||||
| |
|
||||
| RGBController for Galax GPUs (Xtreme Tuner) |
|
||||
| |
|
||||
| Daniel Stuart (daniel.stuart14) 26 may 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_GalaxGPUv2.h"
|
||||
|
||||
int RGBController_GalaxGPUv2::GetDeviceMode()
|
||||
{
|
||||
int modereg = controller->GetMode();
|
||||
int syncreg = controller->GetSync();
|
||||
|
||||
int cur_mode = 0; // Static mode by default
|
||||
|
||||
if (syncreg == GALAX_V2_SYNC_ON)
|
||||
{
|
||||
cur_mode = 3; // External Sync mode
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (modereg)
|
||||
{
|
||||
case GALAX_V2_MODE_BREATHING_VALUE:
|
||||
cur_mode = 1;
|
||||
break;
|
||||
|
||||
case GALAX_V2_MODE_RAINBOW_VALUE:
|
||||
cur_mode = 2;
|
||||
break;
|
||||
|
||||
case GALAX_V2_MODE_OFF_VALUE:
|
||||
cur_mode = 4; // Off mode
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(cur_mode);
|
||||
}
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Galax GPU v2
|
||||
@category GPU
|
||||
@type I2C
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectGalaxGPUv2Controllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_GalaxGPUv2::RGBController_GalaxGPUv2(GalaxGPUv2Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "GALAX";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "GALAX RTX 40+ GPU";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.brightness_min = 0x01;
|
||||
Direct.brightness_max = 0x03;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = 1;
|
||||
Breathing.brightness_min = 0x01;
|
||||
Breathing.brightness_max = 0x03;
|
||||
Breathing.speed_min = 0x00;
|
||||
Breathing.speed_max = 0x09;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = 2;
|
||||
Rainbow.flags = 0;
|
||||
Rainbow.brightness_min = 0x01;
|
||||
Rainbow.brightness_max = 0x03;
|
||||
Rainbow.speed_min = 0x00;
|
||||
Rainbow.speed_max = 0x09;
|
||||
Rainbow.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Sync;
|
||||
Sync.name = "External Sync";
|
||||
Sync.value = 3;
|
||||
Sync.flags = MODE_FLAG_MANUAL_SAVE;
|
||||
Sync.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Sync);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = 4;
|
||||
Off.flags = MODE_FLAG_MANUAL_SAVE;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
SetupZones();
|
||||
|
||||
active_mode = GetDeviceMode();
|
||||
modes[active_mode].brightness = controller->GetBrightness();
|
||||
modes[active_mode].speed = controller->GetSpeed();
|
||||
}
|
||||
|
||||
RGBController_GalaxGPUv2::~RGBController_GalaxGPUv2()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv2::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone galax_gpu_zone;
|
||||
galax_gpu_zone.name = "GPU";
|
||||
galax_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
galax_gpu_zone.leds_min = 1;
|
||||
galax_gpu_zone.leds_max = 1;
|
||||
galax_gpu_zone.leds_count = 1;
|
||||
galax_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(galax_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led galax_gpu_led;
|
||||
galax_gpu_led.name = "GPU";
|
||||
leds.push_back(galax_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = controller->GetLEDRed();
|
||||
unsigned char grn = controller->GetLEDGreen();
|
||||
unsigned char blu = controller->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv2::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv2::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
|
||||
controller->SetLEDColors(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv2::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv2::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv2::DeviceUpdateMode()
|
||||
{
|
||||
unsigned char mode_value = GALAX_V2_MODE_STATIC_VALUE; // Default to static mode
|
||||
unsigned char sync_value = GALAX_V2_SYNC_OFF; // Default to sync off
|
||||
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case 1:
|
||||
mode_value = GALAX_V2_MODE_BREATHING_VALUE;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
mode_value = GALAX_V2_MODE_RAINBOW_VALUE;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
sync_value = GALAX_V2_SYNC_ON; // Enable sync
|
||||
break;
|
||||
|
||||
case 4:
|
||||
mode_value = GALAX_V2_MODE_OFF_VALUE; // Off mode
|
||||
break;
|
||||
}
|
||||
|
||||
controller->SetSync(sync_value);
|
||||
controller->SetMode(mode_value);
|
||||
controller->SetSpeed(modes[active_mode].speed);
|
||||
controller->SetBrightness(modes[active_mode].brightness);
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPUv2::DeviceSaveMode()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
controller->SaveMode();
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| RGBController_GalaxGPUv2.h |
|
||||
| |
|
||||
| RGBController for Galax GPUs (Xtreme Tuner) |
|
||||
| |
|
||||
| Daniel Stuart (daniel.stuart14) 26 may 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GalaxGPUv2Controller.h"
|
||||
|
||||
class RGBController_GalaxGPUv2 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GalaxGPUv2(GalaxGPUv2Controller* controller_ptr);
|
||||
~RGBController_GalaxGPUv2();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
GalaxGPUv2Controller* controller;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue