WIP Galax RTX GPU support
Setting RGB values works. Modes still unknown.
This commit is contained in:
parent
5e0b1fa3cc
commit
12f5d6070f
6 changed files with 452 additions and 0 deletions
86
Controllers/GalaxGPUController/GalaxGPUController.cpp
Normal file
86
Controllers/GalaxGPUController/GalaxGPUController.cpp
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/*-----------------------------------------*\
|
||||
| GalaxGPUController.cpp |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "GalaxGPUController.h"
|
||||
#include <cstring>
|
||||
|
||||
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(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)
|
||||
{
|
||||
//not researched yet
|
||||
|
||||
/*
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER, mode);
|
||||
*/
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
53
Controllers/GalaxGPUController/GalaxGPUController.h
Normal file
53
Controllers/GalaxGPUController/GalaxGPUController.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*-----------------------------------------*\
|
||||
| GalaxGPUController.h |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char galax_gpu_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
GALAX_RED_REGISTER = 0x02, /* Red Register */
|
||||
GALAX_GREEN_REGISTER = 0x03, /* Green Register */
|
||||
GALAX_BLUE_REGISTER = 0x04, /* Blue Register */
|
||||
//GALAX_MODE_REGISTER = 0x07, /* Mode Register */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
//GALAX_MODE_STATIC = 0x04,
|
||||
};
|
||||
|
||||
class GalaxGPUController
|
||||
{
|
||||
public:
|
||||
GalaxGPUController(i2c_smbus_interface* bus, galax_gpu_dev_id);
|
||||
~GalaxGPUController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned char GetLEDRed();
|
||||
unsigned char GetLEDGreen();
|
||||
unsigned char GetLEDBlue();
|
||||
void SetLEDColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColorsEffect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetMode(unsigned char mode);
|
||||
|
||||
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;
|
||||
};
|
||||
68
Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp
Normal file
68
Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*-----------------------------------------*\
|
||||
| GalaxGPUControllerDetect.cpp |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "GalaxGPUController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_GalaxGPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForGalaxGPUController *
|
||||
* *
|
||||
* Tests the given address to see if a Galax GPU controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
unsigned char res = bus->i2c_smbus_read_byte_data(address, 0x00);
|
||||
|
||||
if(res == 0x10 || res == 0x27) //Windows reads 0x10, Linux reads 0x27 which is correct as 0x10 is at 0x01
|
||||
{
|
||||
pass = true;
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForGalaxGPUController() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectGalaxGPUControllers *
|
||||
* *
|
||||
* Detect Galax GPU controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectGalaxGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
GalaxGPUController* new_GalaxGPU;
|
||||
RGBController_GalaxGPU* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Check for GALAX controller at 0x23
|
||||
if (TestForGalaxGPUController(busses[bus], 0x23))
|
||||
{
|
||||
new_GalaxGPU = new GalaxGPUController(busses[bus], 0x23);
|
||||
new_controller = new RGBController_GalaxGPU(new_GalaxGPU);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectGalaxGPUControllers() */
|
||||
|
|
@ -425,6 +425,7 @@ void DetectRGBFusion2SMBusControllers(std::vector<i2c_smbus_interface*>& busses,
|
|||
void DetectRGBFusion2DRAMControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectMSIGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectSapphireGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectGalaxGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectMSIMysticLightControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectMSIRGBControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectAuraUSBControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
|
|
@ -470,6 +471,7 @@ void DetectRGBControllers(void)
|
|||
DetectCorsairVengeanceControllers(busses, rgb_controllers);
|
||||
DetectCorsairVengeanceProControllers(busses, rgb_controllers);
|
||||
DetectCrucialControllers(busses, rgb_controllers);
|
||||
DetectGalaxGPUControllers(busses, rgb_controllers);
|
||||
DetectHyperXDRAMControllers(busses, rgb_controllers);
|
||||
DetectPatriotViperControllers(busses, rgb_controllers);
|
||||
DetectPolychromeControllers(busses, rgb_controllers);
|
||||
|
|
|
|||
209
RGBController/RGBController_GalaxGPU.cpp
Normal file
209
RGBController/RGBController_GalaxGPU.cpp
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_GalaxGPU.cpp |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_GalaxGPU.h"
|
||||
|
||||
/*
|
||||
int RGBController_GalaxGPU::GetDeviceMode()
|
||||
{
|
||||
|
||||
int dev_mode = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER);
|
||||
int color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
if(dev_mode == GALAX_MODE_STATIC)
|
||||
{
|
||||
if (galax_gpu->direct)
|
||||
{
|
||||
dev_mode = GALAX;
|
||||
}
|
||||
}
|
||||
|
||||
switch(dev_mode)
|
||||
{
|
||||
case AURA_GPU_MODE_OFF:
|
||||
case AURA_GPU_MODE_SPECTRUM_CYCLE:
|
||||
color_mode = MODE_COLORS_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
for(std::size_t mode = 0; mode < modes.size(); mode++)
|
||||
{
|
||||
if(modes[mode].value == dev_mode)
|
||||
{
|
||||
active_mode = mode;
|
||||
modes[mode].color_mode = color_mode;
|
||||
}
|
||||
}
|
||||
|
||||
return(active_mode);
|
||||
|
||||
}
|
||||
*/
|
||||
RGBController_GalaxGPU::RGBController_GalaxGPU(GalaxGPUController * galax_gpu_ptr)
|
||||
{
|
||||
galax_gpu = galax_gpu_ptr;
|
||||
|
||||
|
||||
name = galax_gpu->GetDeviceName();
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "GALAX / KFA2 RTX GPU";
|
||||
version = "1.0";
|
||||
location = galax_gpu->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
//Direct.value = GALAX_MODE_STATIC;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
/*
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = AURA_GPU_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = AURA_GPU_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = AURA_GPU_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Flashing;
|
||||
Flashing.name = "Flashing";
|
||||
Flashing.value = AURA_GPU_MODE_FLASHING;
|
||||
Flashing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Flashing.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Flashing);
|
||||
|
||||
mode Spectrum_Cycle;
|
||||
Spectrum_Cycle.name = "Spectrum Cycle";
|
||||
Spectrum_Cycle.value = AURA_GPU_MODE_SPECTRUM_CYCLE;
|
||||
Spectrum_Cycle.flags = 0;
|
||||
Spectrum_Cycle.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Spectrum_Cycle);
|
||||
*/
|
||||
|
||||
SetupZones();
|
||||
|
||||
//active_mode = GetDeviceMode();
|
||||
}
|
||||
|
||||
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 = galax_gpu->GetLEDRed();
|
||||
unsigned char grn = galax_gpu->GetLEDGreen();
|
||||
unsigned char blu = galax_gpu->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() == 0)
|
||||
{
|
||||
galax_gpu->SetLEDColorsDirect(red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
galax_gpu->SetLEDColorsEffect(red, grn, blu);
|
||||
}
|
||||
*/
|
||||
|
||||
galax_gpu->SetLEDColorsDirect(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::UpdateMode()
|
||||
{
|
||||
/*
|
||||
int new_mode = modes[active_mode].value;
|
||||
galax_gpu->direct = false;
|
||||
|
||||
switch(new_mode)
|
||||
{
|
||||
|
||||
// Set all LEDs to 0 and Mode to static as a workaround for the non existing Off Mode
|
||||
case AURA_GPU_MODE_OFF:
|
||||
galax_gpu->SetLEDColorsEffect(0, 0, 0);
|
||||
new_mode = AURA_GPU_MODE_STATIC;
|
||||
break;
|
||||
|
||||
// Direct mode is done by switching to Static and not applying color changes
|
||||
case AURA_GPU_MODE_DIRECT:
|
||||
galax_gpu->direct = true;
|
||||
new_mode = AURA_GPU_MODE_STATIC;
|
||||
break;
|
||||
}
|
||||
|
||||
galax_gpu->SetMode(new_mode);
|
||||
*/
|
||||
}
|
||||
34
RGBController/RGBController_GalaxGPU.h
Normal file
34
RGBController/RGBController_GalaxGPU.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_GalaxGPU.h |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GalaxGPUController.h"
|
||||
|
||||
class RGBController_GalaxGPU : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GalaxGPU(GalaxGPUController* galax_gpu_ptr);
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
|
||||
private:
|
||||
GalaxGPUController* galax_gpu;
|
||||
|
||||
//int GetDeviceMode();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue