Add support for PowerColor Red Devil GPUs
This commit is contained in:
parent
c3b1b16d11
commit
75bf674537
6 changed files with 592 additions and 0 deletions
143
Controllers/PowerColorRedDevilGPUController/PowerColorRedDevilGPUController.cpp
Executable file
143
Controllers/PowerColorRedDevilGPUController/PowerColorRedDevilGPUController.cpp
Executable file
|
|
@ -0,0 +1,143 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| PowerColorRedDevilGPUController.cpp |
|
||||
| |
|
||||
| Driver for PowerColor Red Devil GPU |
|
||||
| |
|
||||
| Jana Rettig (SapphicKitten) 14 Jan 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "pci_ids.h"
|
||||
#include "PowerColorRedDevilGPUController.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
RedDevilGPUController::RedDevilGPUController(i2c_smbus_interface* bus, red_devil_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
if(bus->pci_device > AMD_NAVI10_DEV) // Only Navi 2 cards have this mode
|
||||
{
|
||||
this->has_sync_mode = true;
|
||||
}
|
||||
}
|
||||
|
||||
RedDevilGPUController::~RedDevilGPUController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string RedDevilGPUController::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);
|
||||
}
|
||||
|
||||
void RedDevilGPUController::SetLEDColor(int led, RGBColor color)
|
||||
{
|
||||
if(led > RED_DEVIL_GPU_LED_MAX_COUNT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char data[3] =
|
||||
{
|
||||
(unsigned char)RGBGetRValue(color),
|
||||
(unsigned char)RGBGetGValue(color),
|
||||
(unsigned char)RGBGetBValue(color),
|
||||
};
|
||||
|
||||
RegisterWrite(RED_DEVIL_GPU_REG_LED_1 + led, data);
|
||||
}
|
||||
|
||||
RGBColor RedDevilGPUController::GetLEDColor(int led)
|
||||
{
|
||||
if(led > RED_DEVIL_GPU_LED_MAX_COUNT)
|
||||
{
|
||||
return RGBColor(0);
|
||||
}
|
||||
|
||||
unsigned char data[3] = {0};
|
||||
RegisterRead(RED_DEVIL_GPU_REG_LED_1 + RED_DEVIL_GPU_READ_OFFSET, data);
|
||||
return ToRGBColor(data[0], data[1], data[2]);
|
||||
}
|
||||
|
||||
void RedDevilGPUController::SetLEDColorAll(RGBColor color)
|
||||
{
|
||||
unsigned char data[3] =
|
||||
{
|
||||
(unsigned char)RGBGetRValue(color),
|
||||
(unsigned char)RGBGetGValue(color),
|
||||
(unsigned char)RGBGetBValue(color),
|
||||
};
|
||||
|
||||
RegisterWrite(RED_DEVIL_GPU_REG_LED_ALL, data);
|
||||
}
|
||||
|
||||
void RedDevilGPUController::SetModeColor(RGBColor color)
|
||||
{
|
||||
unsigned char data[3] =
|
||||
{
|
||||
(unsigned char)RGBGetRValue(color),
|
||||
(unsigned char)RGBGetGValue(color),
|
||||
(unsigned char)RGBGetBValue(color),
|
||||
};
|
||||
|
||||
RegisterWrite(RED_DEVIL_GPU_REG_MODE_COLOR, data);
|
||||
}
|
||||
|
||||
RGBColor RedDevilGPUController::GetModeColor()
|
||||
{
|
||||
unsigned char data[3] = {0};
|
||||
RegisterRead(RED_DEVIL_GPU_REG_MODE_COLOR + RED_DEVIL_GPU_READ_OFFSET, data);
|
||||
return ToRGBColor(data[0], data[1], data[2]);
|
||||
}
|
||||
|
||||
void RedDevilGPUController::SetMode(red_devil_mode_config config)
|
||||
{
|
||||
if(config.mode == RED_DEVIL_GPU_MODE_MB_SYNC)
|
||||
{
|
||||
unsigned char data[3] = {1, 0, 1};
|
||||
RegisterWrite(RED_DEVIL_GPU_REG_MB_SYNC, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char data[3] = {0};
|
||||
RegisterWrite(RED_DEVIL_GPU_REG_MB_SYNC, data);
|
||||
RegisterWrite(RED_DEVIL_GPU_REG_MODE, (unsigned char *)&config);
|
||||
}
|
||||
}
|
||||
|
||||
red_devil_mode_config RedDevilGPUController::GetMode()
|
||||
{
|
||||
unsigned char data[3] = {0};
|
||||
RegisterRead(RED_DEVIL_GPU_REG_MB_SYNC + RED_DEVIL_GPU_READ_OFFSET, data);
|
||||
if(data[0] != 0 && this->has_sync_mode)
|
||||
{
|
||||
return red_devil_mode_config{RED_DEVIL_GPU_MODE_MB_SYNC, 0, 0};
|
||||
}
|
||||
|
||||
RegisterRead(RED_DEVIL_GPU_REG_MODE + RED_DEVIL_GPU_READ_OFFSET, data);
|
||||
return red_devil_mode_config{data[0], data[1], data[2]};
|
||||
}
|
||||
|
||||
int RedDevilGPUController::RegisterRead(unsigned char reg, unsigned char *data)
|
||||
{
|
||||
int ret = bus->i2c_smbus_read_i2c_block_data(dev, reg, 3, data);
|
||||
std::this_thread::sleep_for(32ms);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int RedDevilGPUController::RegisterWrite(unsigned char reg, unsigned char *data)
|
||||
{
|
||||
int ret = bus->i2c_smbus_write_i2c_block_data(dev, reg, 3, data);
|
||||
std::this_thread::sleep_for(32ms);
|
||||
return ret;
|
||||
}
|
||||
107
Controllers/PowerColorRedDevilGPUController/PowerColorRedDevilGPUController.h
Executable file
107
Controllers/PowerColorRedDevilGPUController/PowerColorRedDevilGPUController.h
Executable file
|
|
@ -0,0 +1,107 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| PowerColorRedDevilGPUController.h |
|
||||
| |
|
||||
| Driver for PowerColor Red Devil GPU |
|
||||
| |
|
||||
| Jana Rettig (SapphicKitten) 14 Jan 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
#define RED_DEVIL_GPU_READ_OFFSET 0x80
|
||||
#define RED_DEVIL_GPU_LED_MAX_COUNT 12
|
||||
|
||||
typedef unsigned char red_devil_dev_id;
|
||||
|
||||
struct red_devil_mode_config
|
||||
{
|
||||
unsigned char mode;
|
||||
unsigned char brightness;
|
||||
unsigned char speed;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RED_DEVIL_GPU_REG_MODE = 0x01,
|
||||
RED_DEVIL_GPU_REG_LED_1 = 0x02,
|
||||
RED_DEVIL_GPU_REG_LED_2 = 0x03,
|
||||
RED_DEVIL_GPU_REG_LED_3 = 0x04,
|
||||
RED_DEVIL_GPU_REG_LED_4 = 0x05,
|
||||
RED_DEVIL_GPU_REG_LED_5 = 0x06,
|
||||
RED_DEVIL_GPU_REG_LED_6 = 0x07,
|
||||
RED_DEVIL_GPU_REG_LED_7 = 0x08,
|
||||
RED_DEVIL_GPU_REG_LED_8 = 0x09,
|
||||
RED_DEVIL_GPU_REG_LED_9 = 0x0A,
|
||||
RED_DEVIL_GPU_REG_LED_10 = 0x0B,
|
||||
RED_DEVIL_GPU_REG_LED_11 = 0x0C,
|
||||
RED_DEVIL_GPU_REG_LED_12 = 0x0D, // Unused for now, acts like any other led reg
|
||||
RED_DEVIL_GPU_REG_LED_ALL = 0x0E,
|
||||
RED_DEVIL_GPU_REG_MODE_COLOR = 0x0F,
|
||||
RED_DEVIL_GPU_REG_UNKNOWN_1 = 0x10, // Never seen writes to this, reads 0x01 0x05 0x00. Maybe Version?
|
||||
RED_DEVIL_GPU_REG_UNKNOWN_2 = 0x11, // DevilZone writes to this sometimes. No observable change
|
||||
RED_DEVIL_GPU_REG_MB_SYNC = 0x12 // Unused on NAVI 1X cards. Disables controller and allows LEDs to be controlled by external source via ARGB header
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RED_DEVIL_GPU_MODE_OFF = 0x00,
|
||||
RED_DEVIL_GPU_MODE_STATIC = 0x01,
|
||||
RED_DEVIL_GPU_MODE_BREATHING = 0x02,
|
||||
RED_DEVIL_GPU_MODE_NEON = 0x03,
|
||||
RED_DEVIL_GPU_MODE_BLINK = 0x04,
|
||||
RED_DEVIL_GPU_MODE_DOUBLE_BLINK = 0x05,
|
||||
RED_DEVIL_GPU_MODE_COLOR_SHIFT = 0x06,
|
||||
RED_DEVIL_GPU_MODE_METEOR = 0x07,
|
||||
RED_DEVIL_GPU_MODE_RIPPLE = 0x08,
|
||||
RED_DEVIL_GPU_MODE_SEVEN_COLORS = 0x09,
|
||||
RED_DEVIL_GPU_MODE_MB_SYNC = 0xFF
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RED_DEVIL_GPU_BRIGHTNESS_MIN = 0x00,
|
||||
RED_DEVIL_GPU_BRIGHTNESS_MAX = 0xFF,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RED_DEVIL_GPU_SPEED_SLOWEST = 0x64,
|
||||
RED_DEVIL_GPU_SPEED_DEFAULT = 0x32,
|
||||
RED_DEVIL_GPU_SPEED_FASTEST = 0x00
|
||||
};
|
||||
|
||||
class RedDevilGPUController
|
||||
{
|
||||
public:
|
||||
RedDevilGPUController(i2c_smbus_interface* bus, red_devil_dev_id dev);
|
||||
~RedDevilGPUController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
|
||||
void SetLEDColor(int led, RGBColor color);
|
||||
RGBColor GetLEDColor(int led);
|
||||
|
||||
void SetLEDColorAll(RGBColor color);
|
||||
|
||||
void SetModeColor(RGBColor color);
|
||||
RGBColor GetModeColor();
|
||||
|
||||
void SetMode(red_devil_mode_config config);
|
||||
red_devil_mode_config GetMode();
|
||||
|
||||
int RegisterRead(unsigned char reg, unsigned char *data);
|
||||
int RegisterWrite(unsigned char reg, unsigned char *data);
|
||||
|
||||
bool has_sync_mode = false;
|
||||
|
||||
private:
|
||||
i2c_smbus_interface* bus;
|
||||
red_devil_dev_id dev;
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| PowerColorRedDevilGPUControllerDetect.cpp |
|
||||
| |
|
||||
| Driver for PowerColor Red Devil GPU |
|
||||
| |
|
||||
| Jana Rettig (SapphicKitten) 14 Jan 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "pci_ids.h"
|
||||
#include "RGBController_PowerColorRedDevilGPU.h"
|
||||
#include "PowerColorRedDevilGPUController.h"
|
||||
|
||||
static const unsigned char indicator[3] = {0x01, 0x05, 0x00};
|
||||
|
||||
void DetectPowerColorRedDevilGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
|
||||
{
|
||||
unsigned char data[3] = {0};
|
||||
int ret = bus->i2c_smbus_read_i2c_block_data(i2c_addr, 0x90, 3, data);
|
||||
if(ret == 3 && memcmp(data, indicator, 3) == 0)
|
||||
{
|
||||
RedDevilGPUController* controller = new RedDevilGPUController(bus, i2c_addr);
|
||||
RGBController_RedDevilGPU* rgb_controller = new RGBController_RedDevilGPU(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX5700", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI10_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX5700_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX5700XT", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI10_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX5700XT_SUB_DEV, 0x22);
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6900XT Ultimate", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI21_DEV2, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6900XT_ULTIMATE_SUB_DEV, 0x22);
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6750XT", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI22_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6750XT_SUB_DEV, 0x22);
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| RGBController_PowerColorRedDevilGPU.cpp |
|
||||
| |
|
||||
| Driver for PowerColor Red Devil GPU |
|
||||
| |
|
||||
| Jana Rettig (SapphicKitten) 14 Jan 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_PowerColorRedDevilGPU.h"
|
||||
|
||||
RGBController_RedDevilGPU::RGBController_RedDevilGPU(RedDevilGPUController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "PowerColor Red Devil GPU";
|
||||
vendor = "PowerColor";
|
||||
description = name;
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_GPU;
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = RED_DEVIL_GPU_MODE_OFF;
|
||||
Off.flags = MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = RED_DEVIL_GPU_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
Static.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
Static.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Static.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = RED_DEVIL_GPU_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
Breathing.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Breathing.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Breathing.speed_min = RED_DEVIL_GPU_SPEED_SLOWEST;
|
||||
Breathing.speed_max = RED_DEVIL_GPU_SPEED_FASTEST;
|
||||
Breathing.speed = RED_DEVIL_GPU_SPEED_DEFAULT;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Neon;
|
||||
Neon.name = "Neon";
|
||||
Neon.value = RED_DEVIL_GPU_MODE_NEON;
|
||||
Neon.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Neon.color_mode = MODE_COLORS_NONE;
|
||||
Neon.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
Neon.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Neon.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Neon.speed_min = RED_DEVIL_GPU_SPEED_SLOWEST;
|
||||
Neon.speed_max = RED_DEVIL_GPU_SPEED_FASTEST;
|
||||
Neon.speed = RED_DEVIL_GPU_SPEED_DEFAULT;
|
||||
modes.push_back(Neon);
|
||||
|
||||
mode Blink;
|
||||
Blink.name = "Blink";
|
||||
Blink.value = RED_DEVIL_GPU_MODE_BLINK;
|
||||
Blink.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Blink.color_mode = MODE_COLORS_PER_LED;
|
||||
Blink.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
Blink.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Blink.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Blink.speed_min = RED_DEVIL_GPU_SPEED_SLOWEST;
|
||||
Blink.speed_max = RED_DEVIL_GPU_SPEED_FASTEST;
|
||||
Blink.speed = RED_DEVIL_GPU_SPEED_DEFAULT;
|
||||
modes.push_back(Blink);
|
||||
|
||||
mode DoubleBlink;
|
||||
DoubleBlink.name = "Double Blink";
|
||||
DoubleBlink.value = RED_DEVIL_GPU_MODE_DOUBLE_BLINK;
|
||||
DoubleBlink.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
DoubleBlink.color_mode = MODE_COLORS_PER_LED;
|
||||
DoubleBlink.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
DoubleBlink.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
DoubleBlink.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
DoubleBlink.speed_min = RED_DEVIL_GPU_SPEED_SLOWEST;
|
||||
DoubleBlink.speed_max = RED_DEVIL_GPU_SPEED_FASTEST;
|
||||
DoubleBlink.speed = RED_DEVIL_GPU_SPEED_DEFAULT;
|
||||
modes.push_back(DoubleBlink);
|
||||
|
||||
mode ColorShift;
|
||||
ColorShift.name = "Color Shift";
|
||||
ColorShift.value = RED_DEVIL_GPU_MODE_COLOR_SHIFT;
|
||||
ColorShift.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
ColorShift.color_mode = MODE_COLORS_NONE;
|
||||
ColorShift.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
ColorShift.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
ColorShift.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
ColorShift.speed_min = RED_DEVIL_GPU_SPEED_SLOWEST;
|
||||
ColorShift.speed_max = RED_DEVIL_GPU_SPEED_FASTEST;
|
||||
ColorShift.speed = RED_DEVIL_GPU_SPEED_DEFAULT;
|
||||
modes.push_back(ColorShift);
|
||||
|
||||
|
||||
mode Meteor;
|
||||
Meteor.name = "Meteor";
|
||||
Meteor.value = RED_DEVIL_GPU_MODE_METEOR;
|
||||
Meteor.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Meteor.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Meteor.colors_min = 1;
|
||||
Meteor.colors_max = 1;
|
||||
Meteor.colors.resize(1);
|
||||
Meteor.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
Meteor.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Meteor.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Meteor.speed_min = RED_DEVIL_GPU_SPEED_SLOWEST;
|
||||
Meteor.speed_max = RED_DEVIL_GPU_SPEED_FASTEST;
|
||||
Meteor.speed = RED_DEVIL_GPU_SPEED_DEFAULT;
|
||||
modes.push_back(Meteor);
|
||||
|
||||
mode Ripple;
|
||||
Ripple.name = "Ripple";
|
||||
Ripple.value = RED_DEVIL_GPU_MODE_RIPPLE;
|
||||
Ripple.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Ripple.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Ripple.colors_min = 1;
|
||||
Ripple.colors_max = 1;
|
||||
Ripple.colors.resize(1);
|
||||
Ripple.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
Ripple.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Ripple.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
Ripple.speed_min = RED_DEVIL_GPU_SPEED_SLOWEST;
|
||||
Ripple.speed_max = RED_DEVIL_GPU_SPEED_FASTEST;
|
||||
Ripple.speed = RED_DEVIL_GPU_SPEED_DEFAULT;
|
||||
modes.push_back(Ripple);
|
||||
|
||||
mode SevenColors;
|
||||
SevenColors.name = "Seven Colors";
|
||||
SevenColors.value = RED_DEVIL_GPU_MODE_SEVEN_COLORS;
|
||||
SevenColors.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
SevenColors.color_mode = MODE_COLORS_NONE;
|
||||
SevenColors.brightness_min = RED_DEVIL_GPU_BRIGHTNESS_MIN;
|
||||
SevenColors.brightness_max = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
SevenColors.brightness = RED_DEVIL_GPU_BRIGHTNESS_MAX;
|
||||
SevenColors.speed_min = RED_DEVIL_GPU_SPEED_SLOWEST;
|
||||
SevenColors.speed_max = RED_DEVIL_GPU_SPEED_FASTEST;
|
||||
SevenColors.speed = RED_DEVIL_GPU_SPEED_DEFAULT;
|
||||
modes.push_back(SevenColors);
|
||||
|
||||
if(controller->has_sync_mode)
|
||||
{
|
||||
mode Sync;
|
||||
Sync.name = "Sync with Motherboard";
|
||||
Sync.value = RED_DEVIL_GPU_MODE_MB_SYNC;
|
||||
Sync.flags = MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Sync.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Sync);
|
||||
}
|
||||
|
||||
SetupZones();
|
||||
|
||||
red_devil_mode_config config = controller->GetMode();
|
||||
active_mode = config.mode;
|
||||
|
||||
if (active_mode != RED_DEVIL_GPU_MODE_OFF)
|
||||
{
|
||||
modes[active_mode].brightness = config.brightness;
|
||||
modes[active_mode].speed = config.speed;
|
||||
if (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
modes[active_mode].colors[0] = controller->GetModeColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
colors[0] = controller->GetLEDColor(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RGBController_RedDevilGPU::~RGBController_RedDevilGPU()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_RedDevilGPU::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
zone* new_zone = new zone();
|
||||
|
||||
new_zone->name = "GPU";
|
||||
new_zone->type = ZONE_TYPE_SINGLE;
|
||||
new_zone->leds_min = 1;
|
||||
new_zone->leds_max = 1;
|
||||
new_zone->leds_count = 1;
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| This device can control up to 12 LEDs |
|
||||
| For now all LEDs show the same color |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
led* new_led = new led();
|
||||
new_led->name = "GPU";
|
||||
leds.push_back(*new_led);
|
||||
|
||||
zones.push_back(*new_zone);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_RedDevilGPU::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_RedDevilGPU::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->SetLEDColorAll(colors[0]);
|
||||
}
|
||||
|
||||
void RGBController_RedDevilGPU::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_RedDevilGPU::UpdateSingleLED(int led)
|
||||
{
|
||||
controller->SetLEDColor(led, colors[led]);
|
||||
}
|
||||
|
||||
void RGBController_RedDevilGPU::DeviceUpdateMode()
|
||||
{
|
||||
if (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
if (modes[active_mode].colors[0] != 0)
|
||||
{
|
||||
controller->SetModeColor(modes[active_mode].colors[0]);
|
||||
}
|
||||
}
|
||||
|
||||
red_devil_mode_config config{(unsigned char)modes[active_mode].value, (unsigned char)modes[active_mode].brightness, (unsigned char)modes[active_mode].speed};
|
||||
controller->SetMode(config);
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| RGBController_PowerColorRedDevilGPU.cpp |
|
||||
| |
|
||||
| Driver for PowerColor Red Devil GPU |
|
||||
| |
|
||||
| Jana Rettig (SapphicKitten) 14 Jan 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "PowerColorRedDevilGPUController.h"
|
||||
|
||||
class RGBController_RedDevilGPU : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_RedDevilGPU(RedDevilGPUController* controller_ptr);
|
||||
~RGBController_RedDevilGPU();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
RedDevilGPUController* controller;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue