Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| EVGAGPUv1Controller.cpp |
|
||||
| |
|
||||
| Driver for EVGA V1 (Pascal) GPU |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 11 Sep 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "EVGAGPUv1Controller.h"
|
||||
|
||||
EVGAGPUv1Controller::EVGAGPUv1Controller(i2c_smbus_interface* bus, evga_dev_id dev, std::string dev_name)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
this->name = dev_name;
|
||||
}
|
||||
|
||||
EVGAGPUv1Controller::~EVGAGPUv1Controller()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string EVGAGPUv1Controller::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 EVGAGPUv1Controller::GetDeviceName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
unsigned char EVGAGPUv1Controller::GetMode()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_MODE));
|
||||
}
|
||||
|
||||
unsigned char EVGAGPUv1Controller::GetRed()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_RED));
|
||||
}
|
||||
|
||||
unsigned char EVGAGPUv1Controller::GetGreen()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_GREEN));
|
||||
}
|
||||
|
||||
unsigned char EVGAGPUv1Controller::GetBlue()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_BLUE));
|
||||
}
|
||||
|
||||
void EVGAGPUv1Controller::SetColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V1_REG_RED, red);
|
||||
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V1_REG_GREEN, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V1_REG_BLUE, blue);
|
||||
}
|
||||
|
||||
void EVGAGPUv1Controller::SetMode(unsigned char mode)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V1_REG_MODE, mode);
|
||||
}
|
||||
|
||||
void EVGAGPUv1Controller::SaveSettings()
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x23, 0xE5);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| EVGAGPUv1Controller.h |
|
||||
| |
|
||||
| Driver for EVGA V1 (Pascal) GPU |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 11 Sep 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
typedef unsigned char evga_dev_id;
|
||||
|
||||
#define EVGAGPUV1_CONTROLLER_NAME "EVGAv1"
|
||||
|
||||
enum
|
||||
{
|
||||
EVGA_GPU_V1_REG_MODE = 0x0C,
|
||||
EVGA_GPU_V1_REG_RED = 0x09,
|
||||
EVGA_GPU_V1_REG_GREEN = 0x0A,
|
||||
EVGA_GPU_V1_REG_BLUE = 0x0B,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EVGA_GPU_V1_MODE_OFF = 0x00,
|
||||
EVGA_GPU_V1_MODE_CUSTOM = 0x01,
|
||||
EVGA_GPU_V1_MODE_RAINBOW = 0x02,
|
||||
EVGA_GPU_V1_MODE_BREATHING = 0x05,
|
||||
};
|
||||
|
||||
class EVGAGPUv1Controller
|
||||
{
|
||||
public:
|
||||
EVGAGPUv1Controller(i2c_smbus_interface* bus, evga_dev_id dev, std::string dev_name);
|
||||
~EVGAGPUv1Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetDeviceName();
|
||||
|
||||
unsigned char GetMode();
|
||||
unsigned char GetRed();
|
||||
unsigned char GetGreen();
|
||||
unsigned char GetBlue();
|
||||
|
||||
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetMode(unsigned char mode);
|
||||
void SaveSettings();
|
||||
|
||||
private:
|
||||
i2c_smbus_interface* bus;
|
||||
evga_dev_id dev;
|
||||
std::string name;
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| EVGAGPUv1ControllerDetect.cpp |
|
||||
| |
|
||||
| Detector for EVGA V1 (Pascal) GPU |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 11 Sep 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "EVGAGPUv1Controller.h"
|
||||
#include "LogManager.h"
|
||||
#include "RGBController_EVGAGPUv1.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectEVGAGPUControllers *
|
||||
* *
|
||||
* Detect EVGA Pascal GPU controllers on the enumerated I2C busses at address 0x49. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where EVGA GPU device is connected *
|
||||
* dev - I2C address of EVGA GPU device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectEVGAPascalGPUControllers(i2c_smbus_interface* bus, uint8_t address, const std::string& name)
|
||||
{
|
||||
if(bus->port_id == 1)
|
||||
{
|
||||
EVGAGPUv1Controller* controller = new EVGAGPUv1Controller(bus, address, name);
|
||||
RGBController_EVGAGPUv1* rgb_controller = new RGBController_EVGAGPUv1(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectEVGAPascalGPUControllers() */
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("EVGA GeForce GTX 1070 FTW DT Gaming", DetectEVGAPascalGPUControllers, NVIDIA_VEN, NVIDIA_GTX1070_DEV, EVGA_SUB_VEN, EVGA_GTX1070_FTW_DT_GAMING_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("EVGA GeForce GTX 1070 FTW", DetectEVGAPascalGPUControllers, NVIDIA_VEN, NVIDIA_GTX1070_DEV, EVGA_SUB_VEN, EVGA_GTX1070_FTW_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("EVGA GeForce GTX 1070 FTW HYBRID", DetectEVGAPascalGPUControllers, NVIDIA_VEN, NVIDIA_GTX1070_DEV, EVGA_SUB_VEN, EVGA_GTX1070_FTW_HYBRID_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("EVGA GeForce GTX 1070 Ti FTW2", DetectEVGAPascalGPUControllers, NVIDIA_VEN, NVIDIA_GTX1070TI_DEV, EVGA_SUB_VEN, EVGA_GTX1070TI_FTW2_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("EVGA GeForce GTX 1080 FTW", DetectEVGAPascalGPUControllers, NVIDIA_VEN, NVIDIA_GTX1080_DEV, EVGA_SUB_VEN, EVGA_GTX1080_FTW_SUB_DEV, 0x49);
|
||||
@@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_EVGAGPUv1.cpp |
|
||||
| |
|
||||
| RGBController for EVGA V1 (Pascal) GPU |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 11 Sep 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_EVGAGPUv1.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name EVGA RGB v1 GPU
|
||||
@category GPU
|
||||
@type I2C
|
||||
@save :white_check_mark:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectEVGAGPUControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_EVGAGPUv1::RGBController_EVGAGPUv1(EVGAGPUv1Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "EVGA";
|
||||
description = "EVGA RGB v1 GPU Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
type = DEVICE_TYPE_GPU;
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = EVGA_GPU_V1_MODE_OFF;
|
||||
Off.flags = MODE_FLAG_MANUAL_SAVE;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = EVGA_GPU_V1_MODE_CUSTOM;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = EVGA_GPU_V1_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_MANUAL_SAVE;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = EVGA_GPU_V1_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
|
||||
// Initialize active mode and stored color
|
||||
|
||||
unsigned char raw_active_mode = controller->GetMode();
|
||||
|
||||
active_mode = 0;
|
||||
for(unsigned int i = 0; i < modes.size(); i++)
|
||||
{
|
||||
if (modes[i].value == raw_active_mode)
|
||||
{
|
||||
active_mode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char r = controller->GetRed();
|
||||
unsigned char g = controller->GetGreen();
|
||||
unsigned char b = controller->GetBlue();
|
||||
|
||||
RGBColor color = ToRGBColor(r, g, b);
|
||||
colors[0] = color;
|
||||
}
|
||||
|
||||
RGBController_EVGAGPUv1::~RGBController_EVGAGPUv1()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv1::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device only has one LED, so create a single zone and |
|
||||
| LED for it |
|
||||
\*---------------------------------------------------------*/
|
||||
zone* new_zone = new zone();
|
||||
led* new_led = new led();
|
||||
|
||||
new_zone->name = "GPU Zone";
|
||||
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;
|
||||
|
||||
new_led->name = "GPU LED";
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Push the zone and LED on to device vectors |
|
||||
\*---------------------------------------------------------*/
|
||||
leds.push_back(*new_led);
|
||||
zones.push_back(*new_zone);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv1::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv1::DeviceUpdateLEDs()
|
||||
{
|
||||
RGBColor color = colors[0];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv1::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv1::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv1::DeviceUpdateMode()
|
||||
{
|
||||
controller->SetMode((unsigned char)modes[(unsigned int)active_mode].value);
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv1::DeviceSaveMode()
|
||||
{
|
||||
controller->SaveSettings();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_EVGAGPUv1.h |
|
||||
| |
|
||||
| RGBController for EVGA V1 (Pascal) GPU |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 11 Sep 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "EVGAGPUv1Controller.h"
|
||||
|
||||
class RGBController_EVGAGPUv1 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_EVGAGPUv1(EVGAGPUv1Controller* controller_ptr);
|
||||
~RGBController_EVGAGPUv1();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
EVGAGPUv1Controller* controller;
|
||||
};
|
||||
Reference in New Issue
Block a user