mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-03-29 03:11:11 -04:00
Commonize other RedDevil driver under one tree and detector as V1
This commit is contained in:
@@ -11,24 +11,25 @@
|
||||
|
||||
#include "Detector.h"
|
||||
#include "pci_ids.h"
|
||||
#include "PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.h"
|
||||
#include "PowerColorRedDevilV1Controller/PowerColorRedDevilV1Controller.h"
|
||||
#include "PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.h"
|
||||
#include "PowerColorRedDevilV2Controller/PowerColorRedDevilV2Controller.h"
|
||||
|
||||
#define RED_DEVIL_V1_MAGIC_ADDR 0x90
|
||||
|
||||
static const unsigned char magic_v1[3] = {0x01, 0x05, 0x00};
|
||||
static const unsigned char magic_v2[3] = {0x01, 0x32, 0x00};
|
||||
|
||||
void DetectPowerColorRedDevilGPUControllersV2(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
|
||||
/*---------------------------------------------------------*\
|
||||
| The controller reports a unique identifier for V1 and V2. |
|
||||
| Unfortunately they are on different addresses. Read it |
|
||||
| for good measure anyways. |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
void DetectPowerColorRedDevilGPUControllersV1(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| The controller reports a unique identifier for V1 and V2. |
|
||||
| Unfortunately they are on different addresses. Read it |
|
||||
| for good measure anyways. |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char data[3];
|
||||
int ret = bus->i2c_smbus_read_i2c_block_data(i2c_addr, RED_DEVIL_V2_READ_REG_MAGIC, 3, data);
|
||||
if(ret == 3 && memcmp(data, magic_v2, 3) == 0)
|
||||
int ret = bus->i2c_smbus_read_i2c_block_data(i2c_addr, RED_DEVIL_V1_REG_MAGIC, 3, data);
|
||||
if(ret == 3 && memcmp(data, magic_v1, 3) == 0)
|
||||
{
|
||||
PowerColorRedDevilV2Controller* controller = new PowerColorRedDevilV2Controller(bus, i2c_addr, name);
|
||||
RGBController_PowerColorRedDevilV2* rgb_controller = new RGBController_PowerColorRedDevilV2(controller);
|
||||
@@ -37,4 +38,24 @@ void DetectPowerColorRedDevilGPUControllersV2(i2c_smbus_interface* bus, uint8_t
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX9070XT", DetectPowerColorRedDevilGPUControllersV2, AMD_GPU_VEN, AMD_NAVI48_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX9070XT_SUB_DEV, 0x22);
|
||||
|
||||
void DetectPowerColorRedDevilGPUControllersV2(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
|
||||
{
|
||||
unsigned char data[3];
|
||||
int ret = bus->i2c_smbus_read_i2c_block_data(i2c_addr, RED_DEVIL_V2_READ_REG_MAGIC, 3, data);
|
||||
if(ret == 3 && memcmp(data, magic_v2, 3) == 0)
|
||||
{
|
||||
PowerColorRedDevilV1Controller* controller = new PowerColorRedDevilV1Controller(bus, i2c_addr, name);
|
||||
RGBController_PowerColorRedDevilV1* rgb_controller = new RGBController_PowerColorRedDevilV1(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX5700", DetectPowerColorRedDevilGPUControllersV1, AMD_GPU_VEN, AMD_NAVI10_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX5700_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX5700XT", DetectPowerColorRedDevilGPUControllersV1, AMD_GPU_VEN, AMD_NAVI10_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX5700XT_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6750XT", DetectPowerColorRedDevilGPUControllersV1, AMD_GPU_VEN, AMD_NAVI22_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6750XT_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6800XT", DetectPowerColorRedDevilGPUControllersV1, AMD_GPU_VEN, AMD_NAVI21_DEV1, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6800XT_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6900XT Ultimate", DetectPowerColorRedDevilGPUControllersV1, AMD_GPU_VEN, AMD_NAVI21_DEV2, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6900XT_ULTIMATE_SUB_DEV, 0x22);
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX9070XT", DetectPowerColorRedDevilGPUControllersV2, AMD_GPU_VEN, AMD_NAVI48_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX9070XT_SUB_DEV, 0x22);
|
||||
@@ -0,0 +1,149 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| PowerColorRedDevilV1Controller.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 "PowerColorRedDevilV1Controller.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
PowerColorRedDevilV1Controller::PowerColorRedDevilV1Controller(i2c_smbus_interface* bus, red_devil_v1_dev_id dev, std::string dev_name)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
this->name = dev_name;
|
||||
|
||||
if(bus->pci_device > AMD_NAVI10_DEV) // Only Navi 2 cards have this mode
|
||||
{
|
||||
this->has_sync_mode = true;
|
||||
}
|
||||
}
|
||||
|
||||
PowerColorRedDevilV1Controller::~PowerColorRedDevilV1Controller()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string PowerColorRedDevilV1Controller::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);
|
||||
}
|
||||
|
||||
std::string PowerColorRedDevilV1Controller::GetDeviceName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
void PowerColorRedDevilV1Controller::SetLEDColor(int led, RGBColor color)
|
||||
{
|
||||
if(led > RED_DEVIL_V1_LED_MAX_COUNT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char data[3] =
|
||||
{
|
||||
(unsigned char)RGBGetRValue(color),
|
||||
(unsigned char)RGBGetGValue(color),
|
||||
(unsigned char)RGBGetBValue(color),
|
||||
};
|
||||
|
||||
RegisterWrite(RED_DEVIL_V1_REG_LED_1 + led, data);
|
||||
}
|
||||
|
||||
RGBColor PowerColorRedDevilV1Controller::GetLEDColor(int led)
|
||||
{
|
||||
if(led > RED_DEVIL_V1_LED_MAX_COUNT)
|
||||
{
|
||||
return RGBColor(0);
|
||||
}
|
||||
|
||||
unsigned char data[3] = {0};
|
||||
RegisterRead(RED_DEVIL_V1_REG_LED_1 + RED_DEVIL_V1_READ_OFFSET, data);
|
||||
return ToRGBColor(data[0], data[1], data[2]);
|
||||
}
|
||||
|
||||
void PowerColorRedDevilV1Controller::SetLEDColorAll(RGBColor color)
|
||||
{
|
||||
unsigned char data[3] =
|
||||
{
|
||||
(unsigned char)RGBGetRValue(color),
|
||||
(unsigned char)RGBGetGValue(color),
|
||||
(unsigned char)RGBGetBValue(color),
|
||||
};
|
||||
|
||||
RegisterWrite(RED_DEVIL_V1_REG_LED_ALL, data);
|
||||
}
|
||||
|
||||
void PowerColorRedDevilV1Controller::SetModeColor(RGBColor color)
|
||||
{
|
||||
unsigned char data[3] =
|
||||
{
|
||||
(unsigned char)RGBGetRValue(color),
|
||||
(unsigned char)RGBGetGValue(color),
|
||||
(unsigned char)RGBGetBValue(color),
|
||||
};
|
||||
|
||||
RegisterWrite(RED_DEVIL_V1_REG_MODE_COLOR, data);
|
||||
}
|
||||
|
||||
RGBColor PowerColorRedDevilV1Controller::GetModeColor()
|
||||
{
|
||||
unsigned char data[3] = {0};
|
||||
RegisterRead(RED_DEVIL_V1_REG_MODE_COLOR + RED_DEVIL_V1_READ_OFFSET, data);
|
||||
return ToRGBColor(data[0], data[1], data[2]);
|
||||
}
|
||||
|
||||
void PowerColorRedDevilV1Controller::SetMode(red_devil_v1_mode config)
|
||||
{
|
||||
if(config.mode == RED_DEVIL_V1_MODE_MB_SYNC)
|
||||
{
|
||||
unsigned char data[3] = {1, 0, 1};
|
||||
RegisterWrite(RED_DEVIL_V1_REG_MB_SYNC, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char data[3] = {0};
|
||||
RegisterWrite(RED_DEVIL_V1_REG_MB_SYNC, data);
|
||||
RegisterWrite(RED_DEVIL_V1_REG_MODE, (unsigned char *)&config);
|
||||
}
|
||||
}
|
||||
|
||||
red_devil_v1_mode PowerColorRedDevilV1Controller::GetMode()
|
||||
{
|
||||
unsigned char data[3] = {0};
|
||||
RegisterRead(RED_DEVIL_V1_REG_MB_SYNC + RED_DEVIL_V1_READ_OFFSET, data);
|
||||
if(data[0] != 0 && this->has_sync_mode)
|
||||
{
|
||||
return red_devil_v1_mode{RED_DEVIL_V1_MODE_MB_SYNC, 0, 0};
|
||||
}
|
||||
|
||||
RegisterRead(RED_DEVIL_V1_REG_MODE + RED_DEVIL_V1_READ_OFFSET, data);
|
||||
return red_devil_v1_mode{data[0], data[1], data[2]};
|
||||
}
|
||||
|
||||
int PowerColorRedDevilV1Controller::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 PowerColorRedDevilV1Controller::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;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| PowerColorRedDevilV1Controller.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_V1_READ_OFFSET 0x80
|
||||
#define RED_DEVIL_V1_LED_MAX_COUNT 12
|
||||
|
||||
typedef unsigned char red_devil_v1_dev_id;
|
||||
|
||||
struct red_devil_v1_mode
|
||||
{
|
||||
unsigned char mode;
|
||||
unsigned char brightness;
|
||||
unsigned char speed;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RED_DEVIL_V1_REG_MODE = 0x01,
|
||||
RED_DEVIL_V1_REG_LED_1 = 0x02,
|
||||
RED_DEVIL_V1_REG_LED_2 = 0x03,
|
||||
RED_DEVIL_V1_REG_LED_3 = 0x04,
|
||||
RED_DEVIL_V1_REG_LED_4 = 0x05,
|
||||
RED_DEVIL_V1_REG_LED_5 = 0x06,
|
||||
RED_DEVIL_V1_REG_LED_6 = 0x07,
|
||||
RED_DEVIL_V1_REG_LED_7 = 0x08,
|
||||
RED_DEVIL_V1_REG_LED_8 = 0x09,
|
||||
RED_DEVIL_V1_REG_LED_9 = 0x0A,
|
||||
RED_DEVIL_V1_REG_LED_10 = 0x0B,
|
||||
RED_DEVIL_V1_REG_LED_11 = 0x0C,
|
||||
RED_DEVIL_V1_REG_LED_12 = 0x0D, // Unused for now, acts like any other led reg
|
||||
RED_DEVIL_V1_REG_LED_ALL = 0x0E,
|
||||
RED_DEVIL_V1_REG_MODE_COLOR = 0x0F,
|
||||
RED_DEVIL_V1_REG_UNKNOWN_1 = 0x10, // Never seen writes to this, reads 0x01 0x05 0x00. Maybe Version?
|
||||
RED_DEVIL_V1_REG_UNKNOWN_2 = 0x11, // DevilZone writes to this sometimes. No observable change
|
||||
RED_DEVIL_V1_REG_MB_SYNC = 0x12, // Unused on NAVI 1X cards. Disables controller and allows LEDs to be controlled by external source via ARGB header
|
||||
RED_DEVIL_V1_REG_MAGIC = 0x90
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RED_DEVIL_V1_MODE_OFF = 0x00,
|
||||
RED_DEVIL_V1_MODE_STATIC = 0x01,
|
||||
RED_DEVIL_V1_MODE_BREATHING = 0x02,
|
||||
RED_DEVIL_V1_MODE_NEON = 0x03,
|
||||
RED_DEVIL_V1_MODE_BLINK = 0x04,
|
||||
RED_DEVIL_V1_MODE_DOUBLE_BLINK = 0x05,
|
||||
RED_DEVIL_V1_MODE_COLOR_SHIFT = 0x06,
|
||||
RED_DEVIL_V1_MODE_METEOR = 0x07,
|
||||
RED_DEVIL_V1_MODE_RIPPLE = 0x08,
|
||||
RED_DEVIL_V1_MODE_SEVEN_COLORS = 0x09,
|
||||
RED_DEVIL_V1_MODE_MB_SYNC = 0xFF
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RED_DEVIL_V1_BRIGHTNESS_MIN = 0x00,
|
||||
RED_DEVIL_V1_BRIGHTNESS_MAX = 0xFF,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RED_DEVIL_V1_SPEED_SLOWEST = 0x64,
|
||||
RED_DEVIL_V1_SPEED_DEFAULT = 0x32,
|
||||
RED_DEVIL_V1_SPEED_FASTEST = 0x00
|
||||
};
|
||||
|
||||
class PowerColorRedDevilV1Controller
|
||||
{
|
||||
public:
|
||||
PowerColorRedDevilV1Controller(i2c_smbus_interface* bus, red_devil_v1_dev_id dev, std::string dev_name);
|
||||
~PowerColorRedDevilV1Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetDeviceName();
|
||||
|
||||
void SetLEDColor(int led, RGBColor color);
|
||||
RGBColor GetLEDColor(int led);
|
||||
|
||||
void SetLEDColorAll(RGBColor color);
|
||||
|
||||
void SetModeColor(RGBColor color);
|
||||
RGBColor GetModeColor();
|
||||
|
||||
void SetMode(red_devil_v1_mode config);
|
||||
red_devil_v1_mode 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_v1_dev_id dev;
|
||||
std::string name;
|
||||
};
|
||||
@@ -0,0 +1,249 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_PowerColorRedDevilV1.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_PowerColorRedDevilV1.h"
|
||||
|
||||
RGBController_PowerColorRedDevilV1::RGBController_PowerColorRedDevilV1(PowerColorRedDevilV1Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "PowerColor";
|
||||
description = "PowerColor Red Devil GPU Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
type = DEVICE_TYPE_GPU;
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = RED_DEVIL_V1_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_V1_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_V1_BRIGHTNESS_MIN;
|
||||
Static.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Static.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = RED_DEVIL_V1_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_V1_BRIGHTNESS_MIN;
|
||||
Breathing.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Breathing.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Breathing.speed_min = RED_DEVIL_V1_SPEED_SLOWEST;
|
||||
Breathing.speed_max = RED_DEVIL_V1_SPEED_FASTEST;
|
||||
Breathing.speed = RED_DEVIL_V1_SPEED_DEFAULT;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Neon;
|
||||
Neon.name = "Neon";
|
||||
Neon.value = RED_DEVIL_V1_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_V1_BRIGHTNESS_MIN;
|
||||
Neon.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Neon.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Neon.speed_min = RED_DEVIL_V1_SPEED_SLOWEST;
|
||||
Neon.speed_max = RED_DEVIL_V1_SPEED_FASTEST;
|
||||
Neon.speed = RED_DEVIL_V1_SPEED_DEFAULT;
|
||||
modes.push_back(Neon);
|
||||
|
||||
mode Blink;
|
||||
Blink.name = "Blink";
|
||||
Blink.value = RED_DEVIL_V1_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_V1_BRIGHTNESS_MIN;
|
||||
Blink.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Blink.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Blink.speed_min = RED_DEVIL_V1_SPEED_SLOWEST;
|
||||
Blink.speed_max = RED_DEVIL_V1_SPEED_FASTEST;
|
||||
Blink.speed = RED_DEVIL_V1_SPEED_DEFAULT;
|
||||
modes.push_back(Blink);
|
||||
|
||||
mode DoubleBlink;
|
||||
DoubleBlink.name = "Double Blink";
|
||||
DoubleBlink.value = RED_DEVIL_V1_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_V1_BRIGHTNESS_MIN;
|
||||
DoubleBlink.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
DoubleBlink.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
DoubleBlink.speed_min = RED_DEVIL_V1_SPEED_SLOWEST;
|
||||
DoubleBlink.speed_max = RED_DEVIL_V1_SPEED_FASTEST;
|
||||
DoubleBlink.speed = RED_DEVIL_V1_SPEED_DEFAULT;
|
||||
modes.push_back(DoubleBlink);
|
||||
|
||||
mode ColorShift;
|
||||
ColorShift.name = "Color Shift";
|
||||
ColorShift.value = RED_DEVIL_V1_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_V1_BRIGHTNESS_MIN;
|
||||
ColorShift.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
ColorShift.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
ColorShift.speed_min = RED_DEVIL_V1_SPEED_SLOWEST;
|
||||
ColorShift.speed_max = RED_DEVIL_V1_SPEED_FASTEST;
|
||||
ColorShift.speed = RED_DEVIL_V1_SPEED_DEFAULT;
|
||||
modes.push_back(ColorShift);
|
||||
|
||||
|
||||
mode Meteor;
|
||||
Meteor.name = "Meteor";
|
||||
Meteor.value = RED_DEVIL_V1_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_V1_BRIGHTNESS_MIN;
|
||||
Meteor.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Meteor.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Meteor.speed_min = RED_DEVIL_V1_SPEED_SLOWEST;
|
||||
Meteor.speed_max = RED_DEVIL_V1_SPEED_FASTEST;
|
||||
Meteor.speed = RED_DEVIL_V1_SPEED_DEFAULT;
|
||||
modes.push_back(Meteor);
|
||||
|
||||
mode Ripple;
|
||||
Ripple.name = "Ripple";
|
||||
Ripple.value = RED_DEVIL_V1_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_V1_BRIGHTNESS_MIN;
|
||||
Ripple.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Ripple.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
Ripple.speed_min = RED_DEVIL_V1_SPEED_SLOWEST;
|
||||
Ripple.speed_max = RED_DEVIL_V1_SPEED_FASTEST;
|
||||
Ripple.speed = RED_DEVIL_V1_SPEED_DEFAULT;
|
||||
modes.push_back(Ripple);
|
||||
|
||||
mode SevenColors;
|
||||
SevenColors.name = "Seven Colors";
|
||||
SevenColors.value = RED_DEVIL_V1_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_V1_BRIGHTNESS_MIN;
|
||||
SevenColors.brightness_max = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
SevenColors.brightness = RED_DEVIL_V1_BRIGHTNESS_MAX;
|
||||
SevenColors.speed_min = RED_DEVIL_V1_SPEED_SLOWEST;
|
||||
SevenColors.speed_max = RED_DEVIL_V1_SPEED_FASTEST;
|
||||
SevenColors.speed = RED_DEVIL_V1_SPEED_DEFAULT;
|
||||
modes.push_back(SevenColors);
|
||||
|
||||
if(controller->has_sync_mode)
|
||||
{
|
||||
mode Sync;
|
||||
Sync.name = "Sync with Motherboard";
|
||||
Sync.value = RED_DEVIL_V1_MODE_MB_SYNC;
|
||||
Sync.flags = MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Sync.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Sync);
|
||||
}
|
||||
|
||||
SetupZones();
|
||||
|
||||
red_devil_v1_mode config = controller->GetMode();
|
||||
active_mode = config.mode;
|
||||
|
||||
if(active_mode != RED_DEVIL_V1_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_PowerColorRedDevilV1::~RGBController_PowerColorRedDevilV1()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_PowerColorRedDevilV1::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;
|
||||
zones.push_back(*new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| 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);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_PowerColorRedDevilV1::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_PowerColorRedDevilV1::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->SetLEDColorAll(colors[0]);
|
||||
}
|
||||
|
||||
void RGBController_PowerColorRedDevilV1::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_PowerColorRedDevilV1::UpdateSingleLED(int led)
|
||||
{
|
||||
controller->SetLEDColor(led, colors[led]);
|
||||
}
|
||||
|
||||
void RGBController_PowerColorRedDevilV1::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_v1_mode 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_PowerColorRedDevilV1.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 "PowerColorRedDevilV1Controller.h"
|
||||
|
||||
class RGBController_PowerColorRedDevilV1 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_PowerColorRedDevilV1(PowerColorRedDevilV1Controller* controller_ptr);
|
||||
~RGBController_PowerColorRedDevilV1();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
PowerColorRedDevilV1Controller* controller;
|
||||
};
|
||||
Reference in New Issue
Block a user