Publish LumaOps source

This commit is contained in:
LumaOps release export
2026-09-03 01:18:36 +02:00
commit 7f1c0e5f71
2363 changed files with 501543 additions and 0 deletions
@@ -0,0 +1,166 @@
/*---------------------------------------------------------*\
| ColorfulTuringGPUController.cpp |
| |
| Driver for Colorful Turing GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include "ColorfulTuringGPUController.h"
ColorfulTuringGPUController::ColorfulTuringGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev, std::string dev_name)
{
this->bus = bus;
this->dev = dev;
this->name = dev_name;
}
ColorfulTuringGPUController::~ColorfulTuringGPUController()
{
}
std::string ColorfulTuringGPUController::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 ColorfulTuringGPUController::GetDeviceName()
{
return(name);
}
int ColorfulTuringGPUController::GetMode()
{
uint8_t data_pkt[COLORFUL_MODE_PACKET_LENGTH];
int size = COLORFUL_MODE_PACKET_LENGTH;
bus->i2c_read_block(dev, &size, data_pkt);
int mode = data_pkt[2]<<16 | data_pkt[3]<<8 | data_pkt[4];
return mode;
}
RGBColor ColorfulTuringGPUController::GetColor()
{
uint8_t data_pkt[COLORFUL_MODE_PACKET_LENGTH];
int size = COLORFUL_MODE_PACKET_LENGTH;
bus->i2c_read_block(dev, &size, data_pkt);
RGBColor color = ToRGBColor(data_pkt[5], data_pkt[6], data_pkt[7]);
return color;
}
void ColorfulTuringGPUController::SetStateDisplay(RGBColor color)
{
uint8_t r = RGBGetRValue(color);
uint8_t g = RGBGetGValue(color);
uint8_t b = RGBGetBValue(color);
uint8_t data_pkt[COLORFUL_COLOR_PACKET_LENGTH] = { 0x08, 0x01, 0x32, 0x04, r, g, b};
int crc = 1;
for(int i = 0; i < COLORFUL_COLOR_PACKET_LENGTH - 1; ++i)
{
crc += data_pkt[i];
}
crc &= 0xFF;
crc = 256-crc;
data_pkt[COLORFUL_COLOR_PACKET_LENGTH - 1] = crc & 0xFF;
bus->i2c_write_block(dev, COLORFUL_COLOR_PACKET_LENGTH, data_pkt);
}
void ColorfulTuringGPUController::SetDirect(RGBColor color, bool save)
{
uint8_t r = RGBGetRValue(color);
uint8_t g = RGBGetGValue(color);
uint8_t b = RGBGetBValue(color);
uint8_t data_pkt[COLORFUL_COLOR_PACKET_LENGTH] = { 0x08, 0x0, 0x20, 0x10, r, g, b};
if(save)
{
data_pkt[0] = 0x88;
data_pkt[1] = 0x02;
data_pkt[2] = 0x32;
data_pkt[3] = 0x02;
}
int crc = 1;
for(int i = 0; i < COLORFUL_COLOR_PACKET_LENGTH - 1; ++i)
{
crc += data_pkt[i];
}
crc &= 0xFF;
crc = 256-crc;
data_pkt[COLORFUL_COLOR_PACKET_LENGTH - 1] = crc & 0xFF;
bus->i2c_write_block(dev, COLORFUL_COLOR_PACKET_LENGTH, data_pkt);
}
void ColorfulTuringGPUController::SetBreathing(RGBColor color)
{
uint8_t r = RGBGetRValue(color);
uint8_t g = RGBGetGValue(color);
uint8_t b = RGBGetBValue(color);
uint8_t data_pkt[COLORFUL_COLOR_PACKET_LENGTH] = { 0x88, 0x01, 0x32, 0x02, r, g, b};
int crc = 1;
for(int i = 0; i < COLORFUL_COLOR_PACKET_LENGTH - 1; ++i)
{
crc += data_pkt[i];
}
crc &= 0xFF;
crc = 256-crc;
data_pkt[COLORFUL_COLOR_PACKET_LENGTH - 1] = crc & 0xFF;
bus->i2c_write_block(dev, COLORFUL_COLOR_PACKET_LENGTH, data_pkt);
}
void ColorfulTuringGPUController::SetOff()
{
uint8_t data_pkt[COLORFUL_NON_COLOR_PACKET_LENGTH] = { 0x85, 0x00, 0x00, 0x0A };
int crc = 1;
for(int i = 0; i < COLORFUL_NON_COLOR_PACKET_LENGTH - 1; ++i)
{
crc += data_pkt[i];
}
crc &= 0xFF;
crc = 256-crc;
data_pkt[COLORFUL_NON_COLOR_PACKET_LENGTH - 1] = crc & 0xFF;
bus->i2c_write_block(dev, COLORFUL_NON_COLOR_PACKET_LENGTH, data_pkt);
}
void ColorfulTuringGPUController::SetRainbow()
{
uint8_t data_pkt[COLORFUL_NON_COLOR_PACKET_LENGTH] = { 0x85, 0x04, 0x32, 0x02 };
int crc = 1;
for(int i = 0; i < COLORFUL_NON_COLOR_PACKET_LENGTH - 1; ++i)
{
crc += data_pkt[i];
}
crc &= 0xFF;
crc = 256-crc;
data_pkt[COLORFUL_NON_COLOR_PACKET_LENGTH - 1] = crc & 0xFF;
bus->i2c_write_block(dev, COLORFUL_NON_COLOR_PACKET_LENGTH, data_pkt);
}
@@ -0,0 +1,53 @@
/*---------------------------------------------------------*\
| ColorfulTuringGPUController.h |
| |
| Driver for Colorful Turing GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <string>
#include "i2c_smbus.h"
#include "RGBController.h"
typedef unsigned char colorful_gpu_dev_id;
#define COLORFUL_COLOR_PACKET_LENGTH 8
#define COLORFUL_NON_COLOR_PACKET_LENGTH 5
#define COLORFUL_MODE_PACKET_LENGTH 0x1B
enum
{
COLORFUL_TURING_GPU_RGB_MODE_STATE_DISPLAY = 0x013204,
COLORFUL_TURING_GPU_RGB_MODE_OFF = 0x00000A,
COLORFUL_TURING_GPU_RGB_MODE_STATIC = 0x023202,
COLORFUL_TURING_GPU_RGB_MODE_RAINBOW = 0x043202,
COLORFUL_TURING_GPU_RGB_MODE_BREATHING = 0x013202,
};
class ColorfulTuringGPUController
{
public:
ColorfulTuringGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev, std::string dev_name);
~ColorfulTuringGPUController();
std::string GetDeviceLocation();
std::string GetDeviceName();
int GetMode();
RGBColor GetColor();
void SetDirect(RGBColor color, bool save);
void SetStateDisplay(RGBColor color);
void SetBreathing(RGBColor color);
void SetOff();
void SetRainbow();
private:
i2c_smbus_interface * bus;
colorful_gpu_dev_id dev;
std::string name;
};
@@ -0,0 +1,28 @@
/*---------------------------------------------------------*\
| ColorfulTuringGPUControllerDetect.cpp |
| |
| Driver for Colorful Turing GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "Detector.h"
#include "ColorfulTuringGPUController.h"
#include "RGBController_ColorfulTuringGPU.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
void DetectColorfulTuringGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
{
if(bus->port_id == 1)
{
ColorfulTuringGPUController* controller = new ColorfulTuringGPUController(bus, i2c_addr, name);
RGBController_ColorfulTuringGPU* rgb_controller = new RGBController_ColorfulTuringGPU(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 2070 SUPER Advanced OC-V", DetectColorfulTuringGPUControllers, NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_2070_SUPER_ADVANCED_OCV, 0x50);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 2070 SUPER Advanced OC-V", DetectColorfulTuringGPUControllers, NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_2070_SUPER_ADVANCED_OCV2, 0x50);
@@ -0,0 +1,167 @@
/*---------------------------------------------------------*\
| RGBController_ColorfulTuringGPU.cpp |
| |
| RGBController for Colorful Turing GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <array>
#include "RGBController_ColorfulTuringGPU.h"
/**------------------------------------------------------------------*\
@name Colorful GPU
@category GPU
@type I2C
@save :x:
@direct :white_check_mark:
@effects :white_check_mark:
@detectors DetectColorfulTuringGPUControllers
@comment This card supports off, direct, rainbow and pulse mode.
\*-------------------------------------------------------------------*/
RGBController_ColorfulTuringGPU::RGBController_ColorfulTuringGPU(ColorfulTuringGPUController * colorful_gpu_ptr)
{
controller = colorful_gpu_ptr;
name = controller->GetDeviceName();
vendor = "Colorful";
type = DEVICE_TYPE_GPU;
description = name;
location = controller->GetDeviceLocation();
mode Off;
Off.name = "Off";
Off.value = COLORFUL_TURING_GPU_RGB_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Direct;
Direct.name = "Direct";
Direct.value = COLORFUL_TURING_GPU_RGB_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode StateDisplay;
StateDisplay.name = "State Display";
StateDisplay.value = COLORFUL_TURING_GPU_RGB_MODE_STATE_DISPLAY;
StateDisplay.flags = MODE_FLAG_HAS_PER_LED_COLOR;
StateDisplay.color_mode = MODE_COLORS_PER_LED;
modes.push_back(StateDisplay);
mode Rainbow;
Rainbow.name = "Spectrum Cycle";
Rainbow.value = COLORFUL_TURING_GPU_RGB_MODE_RAINBOW;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = COLORFUL_TURING_GPU_RGB_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
SetupZones();
// Initialize active mode
active_mode = getModeIndex(controller->GetMode());
colors[0] = controller->GetColor();
}
RGBController_ColorfulTuringGPU::~RGBController_ColorfulTuringGPU()
{
delete controller;
}
int RGBController_ColorfulTuringGPU::getModeIndex(int mode_value)
{
for(unsigned int mode_index = 0; mode_index < modes.size(); mode_index++)
{
if(modes[mode_index].value == mode_value)
{
return(mode_index);
}
}
return(0);
}
void RGBController_ColorfulTuringGPU::SetupZones()
{
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 = nullptr;
zones.emplace_back(new_zone);
leds.resize(new_zone.leds_count);
leds[0].name = "GPU LED";
SetupColors();
}
void RGBController_ColorfulTuringGPU::ResizeZone(int /*zone*/, int /*new_size*/)
{
}
void RGBController_ColorfulTuringGPU::DeviceUpdateLEDs()
{
switch(modes[active_mode].value)
{
case COLORFUL_TURING_GPU_RGB_MODE_BREATHING:
controller->SetBreathing(colors[0]);
break;
case COLORFUL_TURING_GPU_RGB_MODE_OFF:
controller->SetOff();
break;
case COLORFUL_TURING_GPU_RGB_MODE_RAINBOW:
controller->SetRainbow();
break;
case COLORFUL_TURING_GPU_RGB_MODE_STATE_DISPLAY:
controller->SetStateDisplay(colors[0]);
break;
case COLORFUL_TURING_GPU_RGB_MODE_STATIC:
controller->SetDirect(colors[0], false);
break;
default:
controller->SetDirect(colors[0], false);
}
}
void RGBController_ColorfulTuringGPU::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_ColorfulTuringGPU::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_ColorfulTuringGPU::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
void RGBController_ColorfulTuringGPU::DeviceSaveMode()
{
switch(modes[active_mode].value)
{
case COLORFUL_TURING_GPU_RGB_MODE_STATIC:
controller->SetDirect(colors[0], true);
break;
default:
DeviceUpdateLEDs();
}
}
@@ -0,0 +1,34 @@
/*---------------------------------------------------------*\
| RGBController_ColorfulTuringGPU.h |
| |
| RGBController for Colorful Turing GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "ColorfulTuringGPUController.h"
class RGBController_ColorfulTuringGPU : public RGBController
{
public:
RGBController_ColorfulTuringGPU(ColorfulTuringGPUController* colorful_gpu_ptr);
~RGBController_ColorfulTuringGPU();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceSaveMode();
private:
ColorfulTuringGPUController* controller;
int getModeIndex(int mode_value);
};