Code cleanup round 3
This commit is contained in:
parent
97e154ea84
commit
c09e4c9c92
52 changed files with 2953 additions and 3065 deletions
|
|
@ -13,7 +13,6 @@ using namespace std::chrono_literals;
|
|||
|
||||
bool TestForCorsairDominatorPlatinumController(i2c_smbus_interface *bus, unsigned char address)
|
||||
{
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
LOG_DEBUG("[%s] Trying address %02X", CORSAIR_DOMINATOR_PLATINUM_NAME, address);
|
||||
|
|
@ -62,12 +61,13 @@ void DetectCorsairDominatorPlatinumControllers(std::vector<i2c_smbus_interface *
|
|||
{
|
||||
LOG_DEBUG("[%s] Testing bus %d", CORSAIR_DOMINATOR_PLATINUM_NAME, bus);
|
||||
|
||||
for(unsigned char addr = 0x58; addr <= 0x5f; addr++)
|
||||
for(unsigned char addr = 0x58; addr <= 0x5F; addr++)
|
||||
{
|
||||
if(TestForCorsairDominatorPlatinumController(busses[bus], addr))
|
||||
{
|
||||
CorsairDominatorPlatinumController* new_controller = new CorsairDominatorPlatinumController(busses[bus], addr);
|
||||
CorsairDominatorPlatinumController* new_controller = new CorsairDominatorPlatinumController(busses[bus], addr);
|
||||
RGBController_CorsairDominatorPlatinum* new_rgbcontroller = new RGBController_CorsairDominatorPlatinum(new_controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(new_rgbcontroller);
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);
|
||||
|
|
@ -78,6 +78,6 @@ void DetectCorsairDominatorPlatinumControllers(std::vector<i2c_smbus_interface *
|
|||
LOG_DEBUG("[%s] Bus %d is not a DRAM bus", CORSAIR_DOMINATOR_PLATINUM_NAME, bus);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* DetectCorsairDominatorPlatinumControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("Corsair Dominator Platinum", DetectCorsairDominatorPlatinumControllers);
|
||||
|
|
|
|||
|
|
@ -1,114 +1,115 @@
|
|||
/*-------------------------------------------------*\
|
||||
| RGBController_CorsairDominatorPlatinum.cpp |
|
||||
| |
|
||||
| Corsair Vengeance Pro RGB driver |
|
||||
| |
|
||||
| Erik Gilling (konkers) 9/25/2020 |
|
||||
\*-------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairDominatorPlatinum.h"
|
||||
|
||||
RGBController_CorsairDominatorPlatinum::RGBController_CorsairDominatorPlatinum(CorsairDominatorPlatinumController* corsair_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Dominator Platinum RGB Device";
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.speed_min = 0;
|
||||
Direct.speed_max = 0;
|
||||
Direct.speed = 0;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
RGBController_CorsairDominatorPlatinum::~RGBController_CorsairDominatorPlatinum()
|
||||
{
|
||||
delete corsair;
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone new_zone;
|
||||
new_zone.name = "Corsair Platinum Zone";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = corsair->GetLEDCount();
|
||||
new_zone.leds_max = corsair->GetLEDCount();
|
||||
new_zone.leds_count = corsair->GetLEDCount();
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led *new_led = new led();
|
||||
new_led->name = "Corsair Platinum LED ";
|
||||
new_led->name.append(std::to_string(led_idx));
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
corsair->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
|
||||
corsair->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::UpdateSingleLED(int led)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
corsair->SetLEDColor(led, red, grn, blu);
|
||||
corsair->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
/*-------------------------------------------------*\
|
||||
| RGBController_CorsairDominatorPlatinum.cpp |
|
||||
| |
|
||||
| Corsair Vengeance Pro RGB driver |
|
||||
| |
|
||||
| Erik Gilling (konkers) 9/25/2020 |
|
||||
\*-------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairDominatorPlatinum.h"
|
||||
|
||||
RGBController_CorsairDominatorPlatinum::RGBController_CorsairDominatorPlatinum(CorsairDominatorPlatinumController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Dominator Platinum RGB Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.speed_min = 0;
|
||||
Direct.speed_max = 0;
|
||||
Direct.speed = 0;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
RGBController_CorsairDominatorPlatinum::~RGBController_CorsairDominatorPlatinum()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone new_zone;
|
||||
new_zone.name = "Corsair Platinum Zone";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = controller->GetLEDCount();
|
||||
new_zone.leds_max = controller->GetLEDCount();
|
||||
new_zone.leds_count = controller->GetLEDCount();
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led *new_led = new led();
|
||||
new_led->name = "Corsair Platinum LED ";
|
||||
new_led->name.append(std::to_string(led_idx));
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
|
||||
controller->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::UpdateSingleLED(int led)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetLEDColor(led, red, grn, blu);
|
||||
controller->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairDominatorPlatinum::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
/*--------------------------------------------*\
|
||||
| RGBController_CorsairDominatorPlatinum.h |
|
||||
| |
|
||||
| Corsair Dominator Platinum RGB driver |
|
||||
| |
|
||||
| Erik Gilling (konkers) 9/25/2020 |
|
||||
\*--------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CorsairDominatorPlatinumController.h"
|
||||
|
||||
class RGBController_CorsairDominatorPlatinum : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairDominatorPlatinum(CorsairDominatorPlatinumController* corsair_ptr);
|
||||
~RGBController_CorsairDominatorPlatinum();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairDominatorPlatinumController* corsair;
|
||||
};
|
||||
/*--------------------------------------------*\
|
||||
| RGBController_CorsairDominatorPlatinum.h |
|
||||
| |
|
||||
| Corsair Dominator Platinum RGB driver |
|
||||
| |
|
||||
| Erik Gilling (konkers) 9/25/2020 |
|
||||
\*--------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CorsairDominatorPlatinumController.h"
|
||||
|
||||
class RGBController_CorsairDominatorPlatinum : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairDominatorPlatinum(CorsairDominatorPlatinumController* controller_ptr);
|
||||
~RGBController_CorsairDominatorPlatinum();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairDominatorPlatinumController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,77 +1,76 @@
|
|||
#include "Detector.h"
|
||||
#include "CorsairHydroController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairHydro.h"
|
||||
#include <vector>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Corsair vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Keyboard Hydro Series product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_H115I_PRO_RGB_PID 0x0C13
|
||||
#define CORSAIR_H100I_PRO_RGB_PID 0x0C15
|
||||
#define CORSAIR_H150I_PRO_RGB_PID 0x0C12
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char usb_interface;
|
||||
const char * name;
|
||||
} corsair_hydro_device;
|
||||
|
||||
#define CORSAIR_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const corsair_hydro_device device_list[] =
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Coolers |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
{ CORSAIR_VID, CORSAIR_H100I_PRO_RGB_PID, 0, "Corsair H100i PRO RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_H115I_PRO_RGB_PID, 0, "Corsair H115i PRO RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_H150I_PRO_RGB_PID, 0, "Corsair H150i PRO RGB" },
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairHydroControllers *
|
||||
* *
|
||||
* Tests the USB address to see if a Corsair RGB Cooler controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairHydroControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
libusb_init(NULL);
|
||||
|
||||
#ifdef _WIN32
|
||||
libusb_set_option(NULL, LIBUSB_OPTION_USE_USBDK);
|
||||
#endif
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
|
||||
{
|
||||
libusb_device_handle * dev = libusb_open_device_with_vid_pid(NULL, device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
//Look for Corsair RGB Peripheral
|
||||
if(dev)
|
||||
{
|
||||
libusb_detach_kernel_driver(dev, 0);
|
||||
libusb_claim_interface(dev, 0);
|
||||
|
||||
CorsairHydroController* controller = new CorsairHydroController(dev);//, device_list[device_idx].usb_endpoint);
|
||||
|
||||
RGBController_CorsairHydro* rgb_controller = new RGBController_CorsairHydro(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
} /* DetectCorsairHydroControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers);
|
||||
#include "Detector.h"
|
||||
#include "CorsairHydroController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairHydro.h"
|
||||
#include <vector>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Corsair vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Keyboard Hydro Series product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_H115I_PRO_RGB_PID 0x0C13
|
||||
#define CORSAIR_H100I_PRO_RGB_PID 0x0C15
|
||||
#define CORSAIR_H150I_PRO_RGB_PID 0x0C12
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char usb_interface;
|
||||
const char * name;
|
||||
} corsair_hydro_device;
|
||||
|
||||
#define CORSAIR_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const corsair_hydro_device device_list[] =
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Coolers |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
{ CORSAIR_VID, CORSAIR_H100I_PRO_RGB_PID, 0, "Corsair H100i PRO RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_H115I_PRO_RGB_PID, 0, "Corsair H115i PRO RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_H150I_PRO_RGB_PID, 0, "Corsair H150i PRO RGB" },
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairHydroControllers *
|
||||
* *
|
||||
* Tests the USB address to see if a Corsair RGB Cooler controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairHydroControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
libusb_init(NULL);
|
||||
|
||||
#ifdef _WIN32
|
||||
libusb_set_option(NULL, LIBUSB_OPTION_USE_USBDK);
|
||||
#endif
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
|
||||
{
|
||||
libusb_device_handle * dev = libusb_open_device_with_vid_pid(NULL, device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
//Look for Corsair RGB Peripheral
|
||||
if(dev)
|
||||
{
|
||||
libusb_detach_kernel_driver(dev, 0);
|
||||
libusb_claim_interface(dev, 0);
|
||||
|
||||
CorsairHydroController* controller = new CorsairHydroController(dev);
|
||||
RGBController_CorsairHydro* rgb_controller = new RGBController_CorsairHydro(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
} /* DetectCorsairHydroControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers);
|
||||
|
|
|
|||
|
|
@ -1,143 +1,143 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairHydro.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Hydro Series |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 8/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairHydro.h"
|
||||
|
||||
RGBController_CorsairHydro::RGBController_CorsairHydro(CorsairHydroController* corsair_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Hydro Series Device";
|
||||
version = corsair->GetFirmwareString();
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = corsair->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Blinking;
|
||||
Blinking.name = "Blinking";
|
||||
Blinking.value = 1;
|
||||
Blinking.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Blinking.speed_min = 0x0F;
|
||||
Blinking.speed_max = 0x05;
|
||||
Blinking.speed = 0x0A;
|
||||
Blinking.colors_min = 2;
|
||||
Blinking.colors_max = 2;
|
||||
Blinking.colors.resize(2);
|
||||
modes.push_back(Blinking);
|
||||
|
||||
mode ColorShift;
|
||||
ColorShift.name = "Color Shift";
|
||||
ColorShift.value = 2;
|
||||
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ColorShift.speed_min = 0x46;
|
||||
ColorShift.speed_max = 0x0F;
|
||||
ColorShift.speed = 0x28;
|
||||
ColorShift.colors_min = 2;
|
||||
ColorShift.colors_max = 2;
|
||||
ColorShift.colors.resize(2);
|
||||
modes.push_back(ColorShift);
|
||||
|
||||
mode Pulsing;
|
||||
Pulsing.name = "Pulsing";
|
||||
Pulsing.value = 3;
|
||||
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Pulsing.speed_min = 0x50;
|
||||
Pulsing.speed_max = 0x1E;
|
||||
Pulsing.speed = 0x37;
|
||||
Pulsing.colors_min = 2;
|
||||
Pulsing.colors_max = 2;
|
||||
Pulsing.colors.resize(2);
|
||||
modes.push_back(Pulsing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CorsairHydro::~RGBController_CorsairHydro()
|
||||
{
|
||||
delete corsair;
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "Pump 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;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
led new_led;
|
||||
|
||||
new_led.name = "Pump LED";
|
||||
leds.push_back(new_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::DeviceUpdateLEDs()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::DeviceUpdateMode()
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case 0:
|
||||
corsair->SetFixed(colors);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
corsair->SetBlink(modes[active_mode].colors, modes[active_mode].speed);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
corsair->SetShift(modes[active_mode].colors, modes[active_mode].speed);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
corsair->SetPulse(modes[active_mode].colors, modes[active_mode].speed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairHydro.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Hydro Series |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 8/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairHydro.h"
|
||||
|
||||
RGBController_CorsairHydro::RGBController_CorsairHydro(CorsairHydroController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Hydro Series Device";
|
||||
version = controller->GetFirmwareString();
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Blinking;
|
||||
Blinking.name = "Blinking";
|
||||
Blinking.value = 1;
|
||||
Blinking.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Blinking.speed_min = 0x0F;
|
||||
Blinking.speed_max = 0x05;
|
||||
Blinking.speed = 0x0A;
|
||||
Blinking.colors_min = 2;
|
||||
Blinking.colors_max = 2;
|
||||
Blinking.colors.resize(2);
|
||||
modes.push_back(Blinking);
|
||||
|
||||
mode ColorShift;
|
||||
ColorShift.name = "Color Shift";
|
||||
ColorShift.value = 2;
|
||||
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ColorShift.speed_min = 0x46;
|
||||
ColorShift.speed_max = 0x0F;
|
||||
ColorShift.speed = 0x28;
|
||||
ColorShift.colors_min = 2;
|
||||
ColorShift.colors_max = 2;
|
||||
ColorShift.colors.resize(2);
|
||||
modes.push_back(ColorShift);
|
||||
|
||||
mode Pulsing;
|
||||
Pulsing.name = "Pulsing";
|
||||
Pulsing.value = 3;
|
||||
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Pulsing.speed_min = 0x50;
|
||||
Pulsing.speed_max = 0x1E;
|
||||
Pulsing.speed = 0x37;
|
||||
Pulsing.colors_min = 2;
|
||||
Pulsing.colors_max = 2;
|
||||
Pulsing.colors.resize(2);
|
||||
modes.push_back(Pulsing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CorsairHydro::~RGBController_CorsairHydro()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "Pump 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;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
led new_led;
|
||||
|
||||
new_led.name = "Pump LED";
|
||||
leds.push_back(new_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::DeviceUpdateLEDs()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydro::DeviceUpdateMode()
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case 0:
|
||||
controller->SetFixed(colors);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
controller->SetBlink(modes[active_mode].colors, modes[active_mode].speed);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
controller->SetShift(modes[active_mode].colors, modes[active_mode].speed);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
controller->SetPulse(modes[active_mode].colors, modes[active_mode].speed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairHydro.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Hydro Series |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 8/17/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairHydroController.h"
|
||||
|
||||
class RGBController_CorsairHydro : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairHydro(CorsairHydroController* corsair_ptr);
|
||||
~RGBController_CorsairHydro();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairHydroController* corsair;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairHydro.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Hydro Series |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 8/17/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairHydroController.h"
|
||||
|
||||
class RGBController_CorsairHydro : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairHydro(CorsairHydroController* controller_ptr);
|
||||
~RGBController_CorsairHydro();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairHydroController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,49 +1,49 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| CorsairHydroPlatinumControllerDetect.cpp |
|
||||
| |
|
||||
| Driver for Corsair Hydro Platinum AIO Coolers |
|
||||
| |
|
||||
| Kasper 28th March 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "CorsairHydroPlatinumController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairHydroPlatinum.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Corsair vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_HYDRO_H100I_PLATINUM_PID 0x0c18
|
||||
#define CORSAIR_HYDRO_H100I_PLATINUM_SE_PID 0x0C19
|
||||
#define CORSAIR_HYDRO_H115I_PLATINUM_PID 0x0c17
|
||||
#define CORSAIR_HYDRO_H100I_PRO_XT_PID 0x0c20
|
||||
#define CORSAIR_HYDRO_H115I_PRO_XT_PID 0x0c21
|
||||
#define CORSAIR_HYDRO_H150I_PRO_XT_PID 0x0c22
|
||||
|
||||
void DetectCorsairHydroPlatinumControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
CorsairHydroPlatinumController* controller = new CorsairHydroPlatinumController(dev, info->path);
|
||||
RGBController_CorsairHydroPlatinum* rgb_controller = new RGBController_CorsairHydroPlatinum(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H100i Platinum", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H100I_PLATINUM_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H100i Platinum SE", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H100I_PLATINUM_SE_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H115i Platinum", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H115I_PLATINUM_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H100i Pro XT", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H100I_PRO_XT_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H115i Pro XT", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H115I_PRO_XT_PID );
|
||||
/*-------------------------------------------------------------------*\
|
||||
| CorsairHydroPlatinumControllerDetect.cpp |
|
||||
| |
|
||||
| Driver for Corsair Hydro Platinum AIO Coolers |
|
||||
| |
|
||||
| Kasper 28th March 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "CorsairHydroPlatinumController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairHydroPlatinum.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Corsair vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_HYDRO_H100I_PLATINUM_PID 0x0C18
|
||||
#define CORSAIR_HYDRO_H100I_PLATINUM_SE_PID 0x0C19
|
||||
#define CORSAIR_HYDRO_H115I_PLATINUM_PID 0x0C17
|
||||
#define CORSAIR_HYDRO_H100I_PRO_XT_PID 0x0C20
|
||||
#define CORSAIR_HYDRO_H115I_PRO_XT_PID 0x0C21
|
||||
#define CORSAIR_HYDRO_H150I_PRO_XT_PID 0x0C22
|
||||
|
||||
void DetectCorsairHydroPlatinumControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CorsairHydroPlatinumController* controller = new CorsairHydroPlatinumController(dev, info->path);
|
||||
RGBController_CorsairHydroPlatinum* rgb_controller = new RGBController_CorsairHydroPlatinum(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H100i Platinum", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H100I_PLATINUM_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H100i Platinum SE", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H100I_PLATINUM_SE_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H115i Platinum", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H115I_PLATINUM_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H100i Pro XT", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H100I_PRO_XT_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H115i Pro XT", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H115I_PRO_XT_PID );
|
||||
REGISTER_HID_DETECTOR("Corsair Hydro H150i Pro XT", DetectCorsairHydroPlatinumControllers, CORSAIR_VID, CORSAIR_HYDRO_H150I_PRO_XT_PID );
|
||||
|
|
@ -1,127 +1,127 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CorsairHydroPlatinum.cpp |
|
||||
| |
|
||||
| Driver for Corsair Hydro Platinum AIO Coolers |
|
||||
| |
|
||||
| Kasper 28th March 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairHydroPlatinum.h"
|
||||
|
||||
#define NA 0xFFFFFFFF
|
||||
static unsigned int matrix_map[5][5] =
|
||||
{
|
||||
{ NA, 11, 12, 13, NA },
|
||||
{ 10, NA, 1, NA, 14 },
|
||||
{ 9, 0, NA, 2, 15 },
|
||||
{ 8, NA, 3, NA, 4 },
|
||||
{ NA, 7, 6, 5, NA }
|
||||
};
|
||||
|
||||
RGBController_CorsairHydroPlatinum::RGBController_CorsairHydroPlatinum(CorsairHydroPlatinumController* corsair_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = "Corsair Hydro Platinum Series Device";
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Hydro Platinum Series Device";
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = corsair->GetLocation();
|
||||
version = corsair->GetFirmwareString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
Init_Controller();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::Init_Controller()
|
||||
{
|
||||
zone cpu_block_zone;
|
||||
cpu_block_zone.name = "CPU Block";
|
||||
cpu_block_zone.type = ZONE_TYPE_MATRIX;
|
||||
cpu_block_zone.leds_min = 16;
|
||||
cpu_block_zone.leds_max = 16;
|
||||
cpu_block_zone.leds_count = 16;
|
||||
cpu_block_zone.matrix_map = new matrix_map_type;
|
||||
cpu_block_zone.matrix_map->height = 5;
|
||||
cpu_block_zone.matrix_map->width = 5;
|
||||
cpu_block_zone.matrix_map->map = (unsigned int *)&matrix_map;
|
||||
zones.push_back(cpu_block_zone);
|
||||
|
||||
zone fans_zone;
|
||||
fans_zone.name = "Fans";
|
||||
fans_zone.type = ZONE_TYPE_LINEAR;
|
||||
fans_zone.leds_min = 0;
|
||||
fans_zone.leds_max = 32;
|
||||
fans_zone.leds_count = 0;
|
||||
fans_zone.matrix_map = NULL;
|
||||
zones.push_back(fans_zone);
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
for (unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for (unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name + " " + std::to_string(led_idx);;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::DeviceUpdateLEDs()
|
||||
{
|
||||
corsair->SetupColors(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CorsairHydroPlatinum.cpp |
|
||||
| |
|
||||
| Driver for Corsair Hydro Platinum AIO Coolers |
|
||||
| |
|
||||
| Kasper 28th March 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairHydroPlatinum.h"
|
||||
|
||||
#define NA 0xFFFFFFFF
|
||||
static unsigned int matrix_map[5][5] =
|
||||
{
|
||||
{ NA, 11, 12, 13, NA },
|
||||
{ 10, NA, 1, NA, 14 },
|
||||
{ 9, 0, NA, 2, 15 },
|
||||
{ 8, NA, 3, NA, 4 },
|
||||
{ NA, 7, 6, 5, NA }
|
||||
};
|
||||
|
||||
RGBController_CorsairHydroPlatinum::RGBController_CorsairHydroPlatinum(CorsairHydroPlatinumController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Corsair Hydro Platinum Series Device";
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Hydro Platinum Series Device";
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = controller->GetLocation();
|
||||
version = controller->GetFirmwareString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
Init_Controller();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::Init_Controller()
|
||||
{
|
||||
zone cpu_block_zone;
|
||||
cpu_block_zone.name = "CPU Block";
|
||||
cpu_block_zone.type = ZONE_TYPE_MATRIX;
|
||||
cpu_block_zone.leds_min = 16;
|
||||
cpu_block_zone.leds_max = 16;
|
||||
cpu_block_zone.leds_count = 16;
|
||||
cpu_block_zone.matrix_map = new matrix_map_type;
|
||||
cpu_block_zone.matrix_map->height = 5;
|
||||
cpu_block_zone.matrix_map->width = 5;
|
||||
cpu_block_zone.matrix_map->map = (unsigned int *)&matrix_map;
|
||||
zones.push_back(cpu_block_zone);
|
||||
|
||||
zone fans_zone;
|
||||
fans_zone.name = "Fans";
|
||||
fans_zone.type = ZONE_TYPE_LINEAR;
|
||||
fans_zone.leds_min = 0;
|
||||
fans_zone.leds_max = 32;
|
||||
fans_zone.leds_count = 0;
|
||||
fans_zone.matrix_map = NULL;
|
||||
zones.push_back(fans_zone);
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
for (unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for (unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name + " " + std::to_string(led_idx);;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->SetupColors(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CorsairHydroPlatinum.h |
|
||||
| |
|
||||
| Driver for Corsair Hydro Platinum AIO Coolers |
|
||||
| |
|
||||
| Kasper 28th March 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairHydroPlatinumController.h"
|
||||
|
||||
class RGBController_CorsairHydroPlatinum : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairHydroPlatinum(CorsairHydroPlatinumController* corsair_ptr);
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairHydroPlatinumController* corsair;
|
||||
|
||||
void Init_Controller();
|
||||
};
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CorsairHydroPlatinum.h |
|
||||
| |
|
||||
| Driver for Corsair Hydro Platinum AIO Coolers |
|
||||
| |
|
||||
| Kasper 28th March 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairHydroPlatinumController.h"
|
||||
|
||||
class RGBController_CorsairHydroPlatinum : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairHydroPlatinum(CorsairHydroPlatinumController* controller_ptr);
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairHydroPlatinumController* controller;
|
||||
|
||||
void Init_Controller();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,43 +1,44 @@
|
|||
#include "Detector.h"
|
||||
#include "CorsairLightingNodeController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairLightingNode.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
#define CORSAIR_LIGHTING_NODE_CORE_PID 0x0C1A
|
||||
#define CORSAIR_LIGHTING_NODE_PRO_PID 0x0C0B
|
||||
#define CORSAIR_COMMANDER_PRO_PID 0x0C10
|
||||
#define CORSAIR_LS100_PID 0x0C1E
|
||||
#define CORSAIR_1000D_OBSIDIAN_PID 0x1D00
|
||||
#define CORSAIR_SPEC_OMEGA_RGB_PID 0x1D04
|
||||
#define CORSAIR_LT100_PID 0x0C23
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairLightingNodeControllers *
|
||||
* *
|
||||
* Detect devices supported by the Corsair Lighting Node Pro driver *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairLightingNodeControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
{
|
||||
CorsairLightingNodeController* controller = new CorsairLightingNodeController(dev, info->path);
|
||||
RGBController_CorsairLightingNode* rgb_controller = new RGBController_CorsairLightingNode(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectCorsairLightingNodeControllers() */
|
||||
|
||||
REGISTER_HID_DETECTOR("Corsair Lighting Node Core", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LIGHTING_NODE_CORE_PID); // 1 channel
|
||||
REGISTER_HID_DETECTOR("Corsair Lighting Node Pro", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LIGHTING_NODE_PRO_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair Commander Pro", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_COMMANDER_PRO_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair LS100 Lighting Kit", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LS100_PID); // 1 channel
|
||||
REGISTER_HID_DETECTOR("Corsair 1000D Obsidian", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_1000D_OBSIDIAN_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair SPEC OMEGA RGB", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_SPEC_OMEGA_RGB_PID); // 2 channels
|
||||
#include "Detector.h"
|
||||
#include "CorsairLightingNodeController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairLightingNode.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
#define CORSAIR_LIGHTING_NODE_CORE_PID 0x0C1A
|
||||
#define CORSAIR_LIGHTING_NODE_PRO_PID 0x0C0B
|
||||
#define CORSAIR_COMMANDER_PRO_PID 0x0C10
|
||||
#define CORSAIR_LS100_PID 0x0C1E
|
||||
#define CORSAIR_1000D_OBSIDIAN_PID 0x1D00
|
||||
#define CORSAIR_SPEC_OMEGA_RGB_PID 0x1D04
|
||||
#define CORSAIR_LT100_PID 0x0C23
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairLightingNodeControllers *
|
||||
* *
|
||||
* Detect devices supported by the Corsair Lighting Node Pro driver *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairLightingNodeControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CorsairLightingNodeController* controller = new CorsairLightingNodeController(dev, info->path);
|
||||
RGBController_CorsairLightingNode* rgb_controller = new RGBController_CorsairLightingNode(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectCorsairLightingNodeControllers() */
|
||||
|
||||
REGISTER_HID_DETECTOR("Corsair Lighting Node Core", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LIGHTING_NODE_CORE_PID); // 1 channel
|
||||
REGISTER_HID_DETECTOR("Corsair Lighting Node Pro", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LIGHTING_NODE_PRO_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair Commander Pro", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_COMMANDER_PRO_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair LS100 Lighting Kit", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LS100_PID); // 1 channel
|
||||
REGISTER_HID_DETECTOR("Corsair 1000D Obsidian", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_1000D_OBSIDIAN_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair SPEC OMEGA RGB", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_SPEC_OMEGA_RGB_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair LT100", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LT100_PID); // 2 channels
|
||||
|
|
@ -10,17 +10,17 @@
|
|||
#include "RGBController_CorsairLightingNode.h"
|
||||
|
||||
|
||||
RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLightingNodeController* corsair_ptr)
|
||||
RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLightingNodeController* controller_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Corsair Lighting Node Device";
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Lighting Node Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
version = corsair->GetFirmwareString();
|
||||
location = corsair->GetLocationString();
|
||||
serial = corsair->GetSerialString();
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetLocationString();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -202,7 +202,7 @@ RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLigh
|
|||
|
||||
RGBController_CorsairLightingNode::~RGBController_CorsairLightingNode()
|
||||
{
|
||||
delete corsair;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairLightingNode::SetupZones()
|
||||
|
|
@ -241,8 +241,8 @@ void RGBController_CorsairLightingNode::SetupZones()
|
|||
| maximum number of LEDs the Corsair Commander Pro |
|
||||
| can support is 200. |
|
||||
\*-------------------------------------------------*/
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 204;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 204;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
|
|
@ -289,20 +289,20 @@ void RGBController_CorsairLightingNode::DeviceUpdateLEDs()
|
|||
{
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
corsair->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
|
||||
controller->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CorsairLightingNode::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
corsair->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
|
||||
controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_CorsairLightingNode::UpdateSingleLED(int led)
|
||||
{
|
||||
unsigned int channel = leds_channel[led];
|
||||
|
||||
corsair->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
|
||||
controller->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_CorsairLightingNode::SetCustomMode()
|
||||
|
|
@ -340,30 +340,30 @@ void RGBController_CorsairLightingNode::DeviceUpdateMode()
|
|||
}
|
||||
}
|
||||
|
||||
corsair->SetChannelEffect(channel,
|
||||
zones[channel].leds_count,
|
||||
modes[active_mode].value,
|
||||
modes[active_mode].speed,
|
||||
direction,
|
||||
random,
|
||||
mode_colors[0],
|
||||
mode_colors[1],
|
||||
mode_colors[2],
|
||||
mode_colors[3],
|
||||
mode_colors[4],
|
||||
mode_colors[5],
|
||||
mode_colors[6],
|
||||
mode_colors[7],
|
||||
mode_colors[8]);
|
||||
controller->SetChannelEffect(channel,
|
||||
zones[channel].leds_count,
|
||||
modes[active_mode].value,
|
||||
modes[active_mode].speed,
|
||||
direction,
|
||||
random,
|
||||
mode_colors[0],
|
||||
mode_colors[1],
|
||||
mode_colors[2],
|
||||
mode_colors[3],
|
||||
mode_colors[4],
|
||||
mode_colors[5],
|
||||
mode_colors[6],
|
||||
mode_colors[7],
|
||||
mode_colors[8]);
|
||||
}
|
||||
}
|
||||
|
||||
if(modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS)
|
||||
{
|
||||
corsair->SetBrightness(modes[active_mode].brightness);
|
||||
controller->SetBrightness(modes[active_mode].brightness);
|
||||
}
|
||||
else
|
||||
{
|
||||
corsair->SetBrightness(100);
|
||||
controller->SetBrightness(100);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairLightingNode.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Lighting Node Pro |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/12/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairLightingNodeController.h"
|
||||
|
||||
class RGBController_CorsairLightingNode : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairLightingNode(CorsairLightingNodeController* corsair_ptr);
|
||||
~RGBController_CorsairLightingNode();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairLightingNodeController* corsair;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairLightingNode.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Lighting Node Pro |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/12/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairLightingNodeController.h"
|
||||
|
||||
class RGBController_CorsairLightingNode : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairLightingNode(CorsairLightingNodeController* controller_ptr);
|
||||
~RGBController_CorsairLightingNode();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairLightingNodeController* controller;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void DetectCorsairK55RGBPROControllers(hid_device_info* info, const std::string&
|
|||
|
||||
if(dev)
|
||||
{
|
||||
CorsairK55RGBPROController* controller = new CorsairK55RGBPROController(dev, info->path);
|
||||
CorsairK55RGBPROController* controller = new CorsairK55RGBPROController(dev, info->path);
|
||||
controller->SetName(name);
|
||||
RGBController_CorsairK55RGBPRO* rgb_controller = new RGBController_CorsairK55RGBPRO(controller);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
|
|
|||
|
|
@ -218,19 +218,19 @@ typedef struct
|
|||
matrix_map_type* matrix;
|
||||
} led_zone_layout;
|
||||
|
||||
RGBController_CorsairK100::RGBController_CorsairK100(CorsairK100Controller* corsair_ptr)
|
||||
RGBController_CorsairK100::RGBController_CorsairK100(CorsairK100Controller* controller_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = corsair->GetName();
|
||||
name = controller->GetName();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair K100 Keyboard Device";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
version = corsair->GetFirmwareString();
|
||||
location = corsair->GetDeviceLocation();
|
||||
serial = corsair->GetSerialString();
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
logical_layout = corsair->GetKeyboardType();
|
||||
logical_layout = controller->GetKeyboardType();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -240,6 +240,7 @@ RGBController_CorsairK100::RGBController_CorsairK100(CorsairK100Controller* cors
|
|||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| The Corsair K100 requires a packet within |
|
||||
| 1 minutes of sending the lighting change in order |
|
||||
|
|
@ -270,7 +271,7 @@ RGBController_CorsairK100::~RGBController_CorsairK100()
|
|||
}
|
||||
}
|
||||
|
||||
delete corsair;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairK100::SetupZones()
|
||||
|
|
@ -333,17 +334,17 @@ void RGBController_CorsairK100::DeviceUpdateLEDs()
|
|||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairK100::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairK100::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairK100::SetCustomMode()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
class RGBController_CorsairK100 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairK100(CorsairK100Controller* corsair_ptr);
|
||||
RGBController_CorsairK100(CorsairK100Controller* controller_ptr);
|
||||
~RGBController_CorsairK100();
|
||||
|
||||
void SetupZones();
|
||||
|
|
@ -28,11 +28,11 @@ public:
|
|||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
CorsairK100Controller* corsair;
|
||||
CorsairKeyboardType logical_layout;
|
||||
CorsairK100Controller* controller;
|
||||
CorsairKeyboardType logical_layout;
|
||||
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@
|
|||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
RGBController_CorsairK55RGBPRO::RGBController_CorsairK55RGBPRO(CorsairK55RGBPROController* corsair_ptr)
|
||||
RGBController_CorsairK55RGBPRO::RGBController_CorsairK55RGBPRO(CorsairK55RGBPROController* controller_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = corsair->GetName();
|
||||
name = controller->GetName();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair K55 RGB PRO Keyboard Device";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
version = corsair->GetFirmwareString();
|
||||
location = corsair->GetDeviceLocation();
|
||||
serial = corsair->GetSerialString();
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -59,7 +59,7 @@ RGBController_CorsairK55RGBPRO::~RGBController_CorsairK55RGBPRO()
|
|||
}
|
||||
}
|
||||
|
||||
delete corsair;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairK55RGBPRO::SetupZones()
|
||||
|
|
@ -96,17 +96,17 @@ void RGBController_CorsairK55RGBPRO::DeviceUpdateLEDs()
|
|||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairK55RGBPRO::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairK55RGBPRO::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairK55RGBPRO::SetCustomMode()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
class RGBController_CorsairK55RGBPRO : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairK55RGBPRO(CorsairK55RGBPROController* corsair_ptr);
|
||||
RGBController_CorsairK55RGBPRO(CorsairK55RGBPROController* controller_ptr);
|
||||
~RGBController_CorsairK55RGBPRO();
|
||||
|
||||
void SetupZones();
|
||||
|
|
@ -22,10 +22,10 @@ public:
|
|||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
CorsairK55RGBPROController* corsair;
|
||||
CorsairK55RGBPROController* controller;
|
||||
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -753,20 +753,20 @@ static const char* corsair_harpoon_pro_leds[] =
|
|||
"",
|
||||
};
|
||||
|
||||
RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripheralController* corsair_ptr)
|
||||
RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripheralController* controller_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = corsair->GetName();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair RGB Peripheral Device";
|
||||
type = corsair->GetDeviceType();
|
||||
version = corsair->GetFirmwareString();
|
||||
location = corsair->GetDeviceLocation();
|
||||
serial = corsair->GetSerialString();
|
||||
name = controller->GetName();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair RGB Peripheral Device";
|
||||
type = controller->GetDeviceType();
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
physical_layout = corsair->GetPhysicalLayout();
|
||||
logical_layout = corsair->GetLogicalLayout();
|
||||
physical_layout = controller->GetPhysicalLayout();
|
||||
logical_layout = controller->GetLogicalLayout();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -791,7 +791,7 @@ RGBController_CorsairPeripheral::~RGBController_CorsairPeripheral()
|
|||
}
|
||||
}
|
||||
|
||||
delete corsair;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairPeripheral::SetupZones()
|
||||
|
|
@ -1049,17 +1049,17 @@ void RGBController_CorsairPeripheral::ResizeZone(int /*zone*/, int /*new_size*/)
|
|||
|
||||
void RGBController_CorsairPeripheral::DeviceUpdateLEDs()
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairPeripheral::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairPeripheral::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairPeripheral::SetCustomMode()
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairPeripheral.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair RGB |
|
||||
| keyboard, mouse, and mousemat devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/9/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairPeripheralController.h"
|
||||
|
||||
class RGBController_CorsairPeripheral : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairPeripheral(CorsairPeripheralController* corsair_ptr);
|
||||
~RGBController_CorsairPeripheral();
|
||||
|
||||
int physical_layout;
|
||||
int logical_layout;
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairPeripheralController* corsair;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairPeripheral.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair RGB |
|
||||
| keyboard, mouse, and mousemat devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/9/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairPeripheralController.h"
|
||||
|
||||
class RGBController_CorsairPeripheral : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairPeripheral(CorsairPeripheralController* controller_ptr);
|
||||
~RGBController_CorsairPeripheral();
|
||||
|
||||
int physical_layout;
|
||||
int logical_layout;
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairPeripheralController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,132 +1,76 @@
|
|||
#include "Detector.h"
|
||||
#include "CorsairVengeanceController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairVengeance.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForCorsairVengeanceController *
|
||||
* *
|
||||
* Tests the given address to see if a Corsair controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForCorsairVengeanceController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
for (int i = 0xA0; i < 0xB0; i++)
|
||||
{
|
||||
res = bus->i2c_smbus_read_byte_data(address, i);
|
||||
|
||||
if (res != 0xBA)
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForCorsairVengeanceController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairVengeanceControllers *
|
||||
* *
|
||||
* Detect Corsair controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairVengeanceControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
{
|
||||
CorsairVengeanceController* new_corsair;
|
||||
RGBController_CorsairVengeance* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
|
||||
{
|
||||
// Check for Corsair controller at 0x58
|
||||
if (TestForCorsairVengeanceController(busses[bus], 0x58))
|
||||
{
|
||||
new_corsair = new CorsairVengeanceController(busses[bus], 0x58);
|
||||
new_controller = new RGBController_CorsairVengeance(new_corsair);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x59
|
||||
if (TestForCorsairVengeanceController(busses[bus], 0x59))
|
||||
{
|
||||
new_corsair = new CorsairVengeanceController(busses[bus], 0x59);
|
||||
new_controller = new RGBController_CorsairVengeance(new_corsair);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5A
|
||||
if (TestForCorsairVengeanceController(busses[bus], 0x5A))
|
||||
{
|
||||
new_corsair = new CorsairVengeanceController(busses[bus], 0x5A);
|
||||
new_controller = new RGBController_CorsairVengeance(new_corsair);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5B
|
||||
if (TestForCorsairVengeanceController(busses[bus], 0x5B))
|
||||
{
|
||||
new_corsair = new CorsairVengeanceController(busses[bus], 0x5B);
|
||||
new_controller = new RGBController_CorsairVengeance(new_corsair);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5C
|
||||
if (TestForCorsairVengeanceController(busses[bus], 0x5C))
|
||||
{
|
||||
new_corsair = new CorsairVengeanceController(busses[bus], 0x5C);
|
||||
new_controller = new RGBController_CorsairVengeance(new_corsair);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5D
|
||||
if (TestForCorsairVengeanceController(busses[bus], 0x5D))
|
||||
{
|
||||
new_corsair = new CorsairVengeanceController(busses[bus], 0x5D);
|
||||
new_controller = new RGBController_CorsairVengeance(new_corsair);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5E
|
||||
if (TestForCorsairVengeanceController(busses[bus], 0x5E))
|
||||
{
|
||||
new_corsair = new CorsairVengeanceController(busses[bus], 0x5E);
|
||||
new_controller = new RGBController_CorsairVengeance(new_corsair);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5F
|
||||
if (TestForCorsairVengeanceController(busses[bus], 0x5F))
|
||||
{
|
||||
new_corsair = new CorsairVengeanceController(busses[bus], 0x5F);
|
||||
new_controller = new RGBController_CorsairVengeance(new_corsair);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectCorsairVengeanceControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("Corsair Vengeance", DetectCorsairVengeanceControllers);
|
||||
#include "Detector.h"
|
||||
#include "CorsairVengeanceController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairVengeance.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForCorsairVengeanceController *
|
||||
* *
|
||||
* Tests the given address to see if a Corsair controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForCorsairVengeanceController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
for (int i = 0xA0; i < 0xB0; i++)
|
||||
{
|
||||
res = bus->i2c_smbus_read_byte_data(address, i);
|
||||
|
||||
if (res != 0xBA)
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForCorsairVengeanceController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairVengeanceControllers *
|
||||
* *
|
||||
* Detect Corsair controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairVengeanceControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
{
|
||||
for(unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
|
||||
{
|
||||
for(unsigned char addr = 0x58; addr <= 0x5F; addr++)
|
||||
{
|
||||
if(TestForCorsairVengeanceController(busses[bus], addr))
|
||||
{
|
||||
CorsairVengeanceController* new_controller = new CorsairVengeanceController(busses[bus], addr);
|
||||
RGBController_CorsairVengeance* new_rgbcontroller = new RGBController_CorsairVengeance(new_controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(new_rgbcontroller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectCorsairVengeanceControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("Corsair Vengeance", DetectCorsairVengeanceControllers);
|
||||
|
|
|
|||
|
|
@ -1,113 +1,113 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairVengeance.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairVengeance.h"
|
||||
|
||||
RGBController_CorsairVengeance::RGBController_CorsairVengeance(CorsairVengeanceController* corsair_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Vengeance RGB Device";
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CORSAIR_VENGEANCE_RGB_MODE_SINGLE;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Fade;
|
||||
Fade.name = "Fade";
|
||||
Fade.value = CORSAIR_VENGEANCE_RGB_MODE_FADE;
|
||||
Fade.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Fade.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Fade);
|
||||
|
||||
mode Pulse;
|
||||
Pulse.name = "Pulse";
|
||||
Pulse.value = CORSAIR_VENGEANCE_RGB_MODE_PULSE;
|
||||
Pulse.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Pulse.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Pulse);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CorsairVengeance::~RGBController_CorsairVengeance()
|
||||
{
|
||||
delete corsair;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a single zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone new_zone;
|
||||
new_zone.name = "Corsair Zone";
|
||||
new_zone.type = ZONE_TYPE_SINGLE;
|
||||
new_zone.leds_min = corsair->GetLEDCount();
|
||||
new_zone.leds_max = corsair->GetLEDCount();
|
||||
new_zone.leds_count = corsair->GetLEDCount();
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Corsair LED";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::DeviceUpdateLEDs()
|
||||
{
|
||||
RGBColor color = colors[0];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
corsair->SetLEDColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::DeviceUpdateMode()
|
||||
{
|
||||
corsair->SetMode(modes[active_mode].value);
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairVengeance.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairVengeance.h"
|
||||
|
||||
RGBController_CorsairVengeance::RGBController_CorsairVengeance(CorsairVengeanceController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Vengeance RGB Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CORSAIR_VENGEANCE_RGB_MODE_SINGLE;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Fade;
|
||||
Fade.name = "Fade";
|
||||
Fade.value = CORSAIR_VENGEANCE_RGB_MODE_FADE;
|
||||
Fade.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Fade.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Fade);
|
||||
|
||||
mode Pulse;
|
||||
Pulse.name = "Pulse";
|
||||
Pulse.value = CORSAIR_VENGEANCE_RGB_MODE_PULSE;
|
||||
Pulse.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Pulse.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Pulse);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CorsairVengeance::~RGBController_CorsairVengeance()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a single zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone new_zone;
|
||||
new_zone.name = "Corsair Zone";
|
||||
new_zone.type = ZONE_TYPE_SINGLE;
|
||||
new_zone.leds_min = controller->GetLEDCount();
|
||||
new_zone.leds_max = controller->GetLEDCount();
|
||||
new_zone.leds_count = controller->GetLEDCount();
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Corsair LED";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::DeviceUpdateLEDs()
|
||||
{
|
||||
RGBColor color = colors[0];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetLEDColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::DeviceUpdateMode()
|
||||
{
|
||||
controller->SetMode(modes[active_mode].value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairVengeance.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CorsairVengeanceController.h"
|
||||
|
||||
class RGBController_CorsairVengeance : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairVengeance(CorsairVengeanceController* corsair_ptr);
|
||||
~RGBController_CorsairVengeance();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairVengeanceController* corsair;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairVengeance.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CorsairVengeanceController.h"
|
||||
|
||||
class RGBController_CorsairVengeance : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairVengeance(CorsairVengeanceController* controller_ptr);
|
||||
~RGBController_CorsairVengeance();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairVengeanceController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -74,74 +74,21 @@ void DetectCorsairVengeanceProControllers(std::vector<i2c_smbus_interface*> &bus
|
|||
CorsairVengeanceProController* new_corsair_pro;
|
||||
RGBController_CorsairVengeancePro* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
for(unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
LOG_DEBUG("[%s] Testing bus %d", CORSAIR_VENGEANCE_RGB_PRO_NAME, bus);
|
||||
|
||||
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
|
||||
{
|
||||
// Check for Corsair controller at 0x58
|
||||
if (TestForCorsairVengeanceProController(busses[bus], 0x58))
|
||||
for(unsigned char addr = 0x58; addr <= 0x5F; addr++)
|
||||
{
|
||||
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x58);
|
||||
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x59
|
||||
if (TestForCorsairVengeanceProController(busses[bus], 0x59))
|
||||
{
|
||||
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x59);
|
||||
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5A
|
||||
if (TestForCorsairVengeanceProController(busses[bus], 0x5A))
|
||||
{
|
||||
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5A);
|
||||
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5B
|
||||
if (TestForCorsairVengeanceProController(busses[bus], 0x5B))
|
||||
{
|
||||
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5B);
|
||||
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5C
|
||||
if (TestForCorsairVengeanceProController(busses[bus], 0x5C))
|
||||
{
|
||||
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5C);
|
||||
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5D
|
||||
if (TestForCorsairVengeanceProController(busses[bus], 0x5D))
|
||||
{
|
||||
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5D);
|
||||
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5E
|
||||
if (TestForCorsairVengeanceProController(busses[bus], 0x5E))
|
||||
{
|
||||
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5E);
|
||||
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5F
|
||||
if (TestForCorsairVengeanceProController(busses[bus], 0x5F))
|
||||
{
|
||||
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5F);
|
||||
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
if(TestForCorsairVengeanceProController(busses[bus], addr))
|
||||
{
|
||||
CorsairVengeanceProController* new_controller = new CorsairVengeanceProController(busses[bus], addr);
|
||||
RGBController_CorsairVengeancePro* new_rgbcontroller = new RGBController_CorsairVengeancePro(new_controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(new_rgbcontroller);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,308 +1,308 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairVengeancePro.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance Pro RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairVengeancePro.h"
|
||||
|
||||
RGBController_CorsairVengeancePro::RGBController_CorsairVengeancePro(CorsairVengeanceProController* corsair_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Vengeance Pro RGB Device";
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = CORSAIR_PRO_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.speed_min = 0;
|
||||
Direct.speed_max = 0;
|
||||
Direct.speed = 0;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CORSAIR_PRO_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.speed_min = 0;
|
||||
Static.speed_max = 0;
|
||||
Static.speed = 0;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode ColorShift;
|
||||
ColorShift.name = "Color Shift";
|
||||
ColorShift.value = CORSAIR_PRO_MODE_COLOR_SHIFT;
|
||||
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
ColorShift.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorShift.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
ColorShift.colors_min = 2;
|
||||
ColorShift.colors_max = 2;
|
||||
ColorShift.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ColorShift.colors.resize(2);
|
||||
modes.push_back(ColorShift);
|
||||
|
||||
mode ColorPulse;
|
||||
ColorPulse.name = "Color Pulse";
|
||||
ColorPulse.value = CORSAIR_PRO_MODE_COLOR_PULSE;
|
||||
ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
ColorPulse.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorPulse.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
ColorPulse.colors_min = 2;
|
||||
ColorPulse.colors_max = 2;
|
||||
ColorPulse.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorPulse.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ColorPulse.colors.resize(2);
|
||||
modes.push_back(ColorPulse);
|
||||
|
||||
mode RainbowWave;
|
||||
RainbowWave.name = "Rainbow Wave";
|
||||
RainbowWave.value = CORSAIR_PRO_MODE_RAINBOW_WAVE;
|
||||
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD;
|
||||
RainbowWave.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
RainbowWave.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
RainbowWave.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
RainbowWave.direction = MODE_DIRECTION_DOWN;
|
||||
RainbowWave.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(RainbowWave);
|
||||
|
||||
mode ColorWave;
|
||||
ColorWave.name = "Color Wave";
|
||||
ColorWave.value = CORSAIR_PRO_MODE_COLOR_WAVE;
|
||||
ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
ColorWave.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorWave.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
ColorWave.colors_min = 2;
|
||||
ColorWave.colors_max = 2;
|
||||
ColorWave.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorWave.direction = MODE_DIRECTION_DOWN;
|
||||
ColorWave.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ColorWave.colors.resize(2);
|
||||
modes.push_back(ColorWave);
|
||||
|
||||
mode Visor;
|
||||
Visor.name = "Visor";
|
||||
Visor.value = CORSAIR_PRO_MODE_VISOR;
|
||||
Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_HV | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Visor.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Visor.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Visor.colors_min = 2;
|
||||
Visor.colors_max = 2;
|
||||
Visor.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Visor.direction = MODE_DIRECTION_VERTICAL;
|
||||
Visor.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Visor.colors.resize(2);
|
||||
modes.push_back(Visor);
|
||||
|
||||
mode Rain;
|
||||
Rain.name = "Rain";
|
||||
Rain.value = CORSAIR_PRO_MODE_RAIN;
|
||||
Rain.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Rain.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Rain.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Rain.colors_min = 2;
|
||||
Rain.colors_max = 2;
|
||||
Rain.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Rain.direction = MODE_DIRECTION_DOWN;
|
||||
Rain.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Rain.colors.resize(2);
|
||||
modes.push_back(Rain);
|
||||
|
||||
mode Marquee;
|
||||
Marquee.name = "Marquee";
|
||||
Marquee.value = CORSAIR_PRO_MODE_MARQUEE;
|
||||
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Marquee.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Marquee.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Marquee.colors_min = 1;
|
||||
Marquee.colors_max = 1;
|
||||
Marquee.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Marquee.colors.resize(1);
|
||||
modes.push_back(Marquee);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = CORSAIR_PRO_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED;
|
||||
Rainbow.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Rainbow.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Rainbow.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Sequential;
|
||||
Sequential.name = "Sequential";
|
||||
Sequential.value = CORSAIR_PRO_MODE_SEQUENTIAL;
|
||||
Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Sequential.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Sequential.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Sequential.colors_min = 1;
|
||||
Sequential.colors_max = 1;
|
||||
Sequential.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Sequential.direction = MODE_DIRECTION_DOWN;
|
||||
Sequential.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Sequential.colors.resize(1);
|
||||
modes.push_back(Sequential);
|
||||
|
||||
SetupZones();
|
||||
|
||||
active_mode = 9;
|
||||
}
|
||||
|
||||
RGBController_CorsairVengeancePro::~RGBController_CorsairVengeancePro()
|
||||
{
|
||||
delete corsair;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone new_zone;
|
||||
new_zone.name = "Corsair Pro Zone";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = corsair->GetLEDCount();
|
||||
new_zone.leds_max = corsair->GetLEDCount();
|
||||
new_zone.leds_count = corsair->GetLEDCount();
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Corsair Pro LED ";
|
||||
new_led->name.append(std::to_string(led_idx));
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::DeviceUpdateLEDs()
|
||||
{
|
||||
for (std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
corsair->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
|
||||
corsair->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::UpdateSingleLED(int led)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
corsair->SetLEDColor(led, red, grn, blu);
|
||||
corsair->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::DeviceUpdateMode()
|
||||
{
|
||||
unsigned int corsair_direction = 0;
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
unsigned char mode_colors[6];
|
||||
|
||||
switch(modes[active_mode].direction)
|
||||
{
|
||||
case MODE_DIRECTION_LEFT:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_LEFT;
|
||||
break;
|
||||
case MODE_DIRECTION_RIGHT:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_RIGHT;
|
||||
break;
|
||||
case MODE_DIRECTION_UP:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_UP;
|
||||
break;
|
||||
case MODE_DIRECTION_DOWN:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_DOWN;
|
||||
break;
|
||||
case MODE_DIRECTION_HORIZONTAL:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_HORIZONTAL;
|
||||
break;
|
||||
case MODE_DIRECTION_VERTICAL:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_VERTICAL;
|
||||
break;
|
||||
}
|
||||
|
||||
mode_colors[0] = 0;
|
||||
mode_colors[1] = 0;
|
||||
mode_colors[2] = 0;
|
||||
mode_colors[3] = 0;
|
||||
mode_colors[4] = 0;
|
||||
mode_colors[5] = 0;
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
mode_colors[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
mode_colors[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
mode_colors[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
if(modes[active_mode].colors.size() == 2)
|
||||
{
|
||||
mode_colors[3] = RGBGetRValue(modes[active_mode].colors[1]);
|
||||
mode_colors[4] = RGBGetGValue(modes[active_mode].colors[1]);
|
||||
mode_colors[5] = RGBGetBValue(modes[active_mode].colors[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (modes[active_mode].name == "Direct")
|
||||
{
|
||||
corsair->SetDirect(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
corsair->SetDirect(false);
|
||||
}
|
||||
|
||||
corsair->SetEffect(modes[active_mode].value,
|
||||
modes[active_mode].speed,
|
||||
corsair_direction,
|
||||
random,
|
||||
mode_colors[0],
|
||||
mode_colors[1],
|
||||
mode_colors[2],
|
||||
mode_colors[3],
|
||||
mode_colors[4],
|
||||
mode_colors[5]);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(15));
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairVengeancePro.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance Pro RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairVengeancePro.h"
|
||||
|
||||
RGBController_CorsairVengeancePro::RGBController_CorsairVengeancePro(CorsairVengeanceProController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Vengeance Pro RGB Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = CORSAIR_PRO_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.speed_min = 0;
|
||||
Direct.speed_max = 0;
|
||||
Direct.speed = 0;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CORSAIR_PRO_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.speed_min = 0;
|
||||
Static.speed_max = 0;
|
||||
Static.speed = 0;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode ColorShift;
|
||||
ColorShift.name = "Color Shift";
|
||||
ColorShift.value = CORSAIR_PRO_MODE_COLOR_SHIFT;
|
||||
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
ColorShift.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorShift.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
ColorShift.colors_min = 2;
|
||||
ColorShift.colors_max = 2;
|
||||
ColorShift.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ColorShift.colors.resize(2);
|
||||
modes.push_back(ColorShift);
|
||||
|
||||
mode ColorPulse;
|
||||
ColorPulse.name = "Color Pulse";
|
||||
ColorPulse.value = CORSAIR_PRO_MODE_COLOR_PULSE;
|
||||
ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
ColorPulse.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorPulse.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
ColorPulse.colors_min = 2;
|
||||
ColorPulse.colors_max = 2;
|
||||
ColorPulse.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorPulse.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ColorPulse.colors.resize(2);
|
||||
modes.push_back(ColorPulse);
|
||||
|
||||
mode RainbowWave;
|
||||
RainbowWave.name = "Rainbow Wave";
|
||||
RainbowWave.value = CORSAIR_PRO_MODE_RAINBOW_WAVE;
|
||||
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD;
|
||||
RainbowWave.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
RainbowWave.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
RainbowWave.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
RainbowWave.direction = MODE_DIRECTION_DOWN;
|
||||
RainbowWave.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(RainbowWave);
|
||||
|
||||
mode ColorWave;
|
||||
ColorWave.name = "Color Wave";
|
||||
ColorWave.value = CORSAIR_PRO_MODE_COLOR_WAVE;
|
||||
ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
ColorWave.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorWave.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
ColorWave.colors_min = 2;
|
||||
ColorWave.colors_max = 2;
|
||||
ColorWave.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
ColorWave.direction = MODE_DIRECTION_DOWN;
|
||||
ColorWave.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ColorWave.colors.resize(2);
|
||||
modes.push_back(ColorWave);
|
||||
|
||||
mode Visor;
|
||||
Visor.name = "Visor";
|
||||
Visor.value = CORSAIR_PRO_MODE_VISOR;
|
||||
Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_HV | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Visor.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Visor.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Visor.colors_min = 2;
|
||||
Visor.colors_max = 2;
|
||||
Visor.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Visor.direction = MODE_DIRECTION_VERTICAL;
|
||||
Visor.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Visor.colors.resize(2);
|
||||
modes.push_back(Visor);
|
||||
|
||||
mode Rain;
|
||||
Rain.name = "Rain";
|
||||
Rain.value = CORSAIR_PRO_MODE_RAIN;
|
||||
Rain.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Rain.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Rain.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Rain.colors_min = 2;
|
||||
Rain.colors_max = 2;
|
||||
Rain.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Rain.direction = MODE_DIRECTION_DOWN;
|
||||
Rain.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Rain.colors.resize(2);
|
||||
modes.push_back(Rain);
|
||||
|
||||
mode Marquee;
|
||||
Marquee.name = "Marquee";
|
||||
Marquee.value = CORSAIR_PRO_MODE_MARQUEE;
|
||||
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Marquee.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Marquee.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Marquee.colors_min = 1;
|
||||
Marquee.colors_max = 1;
|
||||
Marquee.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Marquee.colors.resize(1);
|
||||
modes.push_back(Marquee);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = CORSAIR_PRO_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED;
|
||||
Rainbow.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Rainbow.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Rainbow.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Sequential;
|
||||
Sequential.name = "Sequential";
|
||||
Sequential.value = CORSAIR_PRO_MODE_SEQUENTIAL;
|
||||
Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Sequential.speed_min = CORSAIR_PRO_SPEED_SLOW;
|
||||
Sequential.speed_max = CORSAIR_PRO_SPEED_FAST;
|
||||
Sequential.colors_min = 1;
|
||||
Sequential.colors_max = 1;
|
||||
Sequential.speed = CORSAIR_PRO_SPEED_SLOW;
|
||||
Sequential.direction = MODE_DIRECTION_DOWN;
|
||||
Sequential.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Sequential.colors.resize(1);
|
||||
modes.push_back(Sequential);
|
||||
|
||||
SetupZones();
|
||||
|
||||
active_mode = 9;
|
||||
}
|
||||
|
||||
RGBController_CorsairVengeancePro::~RGBController_CorsairVengeancePro()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone new_zone;
|
||||
new_zone.name = "Corsair Pro Zone";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = controller->GetLEDCount();
|
||||
new_zone.leds_max = controller->GetLEDCount();
|
||||
new_zone.leds_count = controller->GetLEDCount();
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Corsair Pro LED ";
|
||||
new_led->name.append(std::to_string(led_idx));
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
controller->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
|
||||
controller->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::UpdateSingleLED(int led)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetLEDColor(led, red, grn, blu);
|
||||
controller->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::DeviceUpdateMode()
|
||||
{
|
||||
unsigned int corsair_direction = 0;
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
unsigned char mode_colors[6];
|
||||
|
||||
switch(modes[active_mode].direction)
|
||||
{
|
||||
case MODE_DIRECTION_LEFT:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_LEFT;
|
||||
break;
|
||||
case MODE_DIRECTION_RIGHT:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_RIGHT;
|
||||
break;
|
||||
case MODE_DIRECTION_UP:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_UP;
|
||||
break;
|
||||
case MODE_DIRECTION_DOWN:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_DOWN;
|
||||
break;
|
||||
case MODE_DIRECTION_HORIZONTAL:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_HORIZONTAL;
|
||||
break;
|
||||
case MODE_DIRECTION_VERTICAL:
|
||||
corsair_direction = CORSAIR_PRO_DIRECTION_VERTICAL;
|
||||
break;
|
||||
}
|
||||
|
||||
mode_colors[0] = 0;
|
||||
mode_colors[1] = 0;
|
||||
mode_colors[2] = 0;
|
||||
mode_colors[3] = 0;
|
||||
mode_colors[4] = 0;
|
||||
mode_colors[5] = 0;
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
mode_colors[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
mode_colors[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
mode_colors[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
if(modes[active_mode].colors.size() == 2)
|
||||
{
|
||||
mode_colors[3] = RGBGetRValue(modes[active_mode].colors[1]);
|
||||
mode_colors[4] = RGBGetGValue(modes[active_mode].colors[1]);
|
||||
mode_colors[5] = RGBGetBValue(modes[active_mode].colors[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (modes[active_mode].name == "Direct")
|
||||
{
|
||||
controller->SetDirect(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SetDirect(false);
|
||||
}
|
||||
|
||||
controller->SetEffect(modes[active_mode].value,
|
||||
modes[active_mode].speed,
|
||||
corsair_direction,
|
||||
random,
|
||||
mode_colors[0],
|
||||
mode_colors[1],
|
||||
mode_colors[2],
|
||||
mode_colors[3],
|
||||
mode_colors[4],
|
||||
mode_colors[5]);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(15));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairVengeancePro.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance Pro RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CorsairVengeanceProController.h"
|
||||
|
||||
class RGBController_CorsairVengeancePro : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairVengeancePro(CorsairVengeanceProController* corsair_ptr);
|
||||
~RGBController_CorsairVengeancePro();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairVengeanceProController* corsair;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairVengeancePro.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance Pro RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CorsairVengeanceProController.h"
|
||||
|
||||
class RGBController_CorsairVengeancePro : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairVengeancePro(CorsairVengeanceProController* controller_ptr);
|
||||
~RGBController_CorsairVengeancePro();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairVengeanceProController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,50 +1,51 @@
|
|||
#include "Detector.h"
|
||||
#include "CorsairWirelessController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairWireless.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Corsair vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Keyboard product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_K57_RGB_WIRED_PID 0x1B6E
|
||||
#define CORSAIR_K57_RGB_WIRELESS_PID 0x1B62
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairWirelessControllers *
|
||||
* *
|
||||
* Tests the USB address to see if a Corsair RGB Keyboard controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairWirelessControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
{
|
||||
CorsairWirelessController* controller = new CorsairWirelessController(dev, info->path);
|
||||
controller->SetName(name);
|
||||
|
||||
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
|
||||
{
|
||||
RGBController_CorsairWireless* rgb_controller = new RGBController_CorsairWireless(controller);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
}
|
||||
} /* DetectCorsairWirelessControllers() */
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_IPU("Corsair K57 RGB (Wired)", DetectCorsairWirelessControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRED_PID, 1, 0xFF42, 1);
|
||||
//REGISTER_HID_DETECTOR_IPU("Corsair K57 RGB (Wireless)", DetectCorsairWirelessControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRELESS_PID, 1, 0xFF42, 1);
|
||||
#include "Detector.h"
|
||||
#include "CorsairWirelessController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairWireless.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Corsair vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Keyboard product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_K57_RGB_WIRED_PID 0x1B6E
|
||||
#define CORSAIR_K57_RGB_WIRELESS_PID 0x1B62
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairWirelessControllers *
|
||||
* *
|
||||
* Tests the USB address to see if a Corsair RGB Keyboard controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairWirelessControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CorsairWirelessController* controller = new CorsairWirelessController(dev, info->path);
|
||||
controller->SetName(name);
|
||||
|
||||
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
|
||||
{
|
||||
RGBController_CorsairWireless* rgb_controller = new RGBController_CorsairWireless(controller);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
}
|
||||
} /* DetectCorsairWirelessControllers() */
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_IPU("Corsair K57 RGB (Wired)", DetectCorsairWirelessControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRED_PID, 1, 0xFF42, 1);
|
||||
//REGISTER_HID_DETECTOR_IPU("Corsair K57 RGB (Wireless)", DetectCorsairWirelessControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRELESS_PID, 1, 0xFF42, 1);
|
||||
|
|
|
|||
|
|
@ -179,17 +179,17 @@ static const char* led_names[] =
|
|||
"Key: G6",
|
||||
};
|
||||
|
||||
RGBController_CorsairWireless::RGBController_CorsairWireless(CorsairWirelessController* corsair_ptr)
|
||||
RGBController_CorsairWireless::RGBController_CorsairWireless(CorsairWirelessController* controller_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = corsair->GetName();
|
||||
name = controller->GetName();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair RGB Peripheral Device";
|
||||
type = corsair->GetDeviceType();
|
||||
version = corsair->GetFirmwareString();
|
||||
location = corsair->GetDeviceLocation();
|
||||
serial = corsair->GetSerialString();
|
||||
type = controller->GetDeviceType();
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -218,6 +218,7 @@ RGBController_CorsairWireless::~RGBController_CorsairWireless()
|
|||
keepalive_thread_run = false;
|
||||
keepalive_thread->join();
|
||||
delete keepalive_thread;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
|
|
@ -229,7 +230,7 @@ RGBController_CorsairWireless::~RGBController_CorsairWireless()
|
|||
}
|
||||
}
|
||||
|
||||
delete corsair;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairWireless::SetupZones()
|
||||
|
|
@ -274,7 +275,7 @@ void RGBController_CorsairWireless::SetupZones()
|
|||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = led_names[led_idx];
|
||||
new_led.name = led_names[led_idx];
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
|
@ -293,17 +294,17 @@ void RGBController_CorsairWireless::DeviceUpdateLEDs()
|
|||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairWireless::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairWireless::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
corsair->SetLEDs(colors);
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_CorsairWireless::SetCustomMode()
|
||||
|
|
|
|||
|
|
@ -1,41 +1,41 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairWireless.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair RGB |
|
||||
| wireless keyboard devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/8/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairWirelessController.h"
|
||||
|
||||
class RGBController_CorsairWireless : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairWireless(CorsairWirelessController* corsair_ptr);
|
||||
~RGBController_CorsairWireless();
|
||||
|
||||
int physical_layout;
|
||||
int logical_layout;
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
CorsairWirelessController* corsair;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairWireless.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair RGB |
|
||||
| wireless keyboard devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/8/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairWirelessController.h"
|
||||
|
||||
class RGBController_CorsairWireless : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairWireless(CorsairWirelessController* controller_ptr);
|
||||
~RGBController_CorsairWireless();
|
||||
|
||||
int physical_layout;
|
||||
int logical_layout;
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
CorsairWirelessController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,30 +1,31 @@
|
|||
#include "CreativeSoundBlasterXG6Controller.h"
|
||||
#include "RGBController_CreativeSoundBlasterXG6.h"
|
||||
#include "Detector.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Creative vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CREATIVE_VID 0x041E
|
||||
/*-----------------------------------------------------*\
|
||||
| SoundCards |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CREATIVE_SOUNDBLASTERX_G6_PID 0x3256
|
||||
|
||||
void DetectCreativeDevice(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
CreativeSoundBlasterXG6Controller* controller = new CreativeSoundBlasterXG6Controller(dev, info->path);
|
||||
RGBController_CreativeSoundBlasterXG6* rgb_controller = new RGBController_CreativeSoundBlasterXG6(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Sound Cards |
|
||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_I("Creative SoundBlasterX G6", DetectCreativeDevice, CREATIVE_VID, CREATIVE_SOUNDBLASTERX_G6_PID, 4);
|
||||
#include "CreativeSoundBlasterXG6Controller.h"
|
||||
#include "RGBController_CreativeSoundBlasterXG6.h"
|
||||
#include "Detector.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Creative vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CREATIVE_VID 0x041E
|
||||
/*-----------------------------------------------------*\
|
||||
| SoundCards |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CREATIVE_SOUNDBLASTERX_G6_PID 0x3256
|
||||
|
||||
void DetectCreativeDevice(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CreativeSoundBlasterXG6Controller* controller = new CreativeSoundBlasterXG6Controller(dev, info->path);
|
||||
RGBController_CreativeSoundBlasterXG6* rgb_controller = new RGBController_CreativeSoundBlasterXG6(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Sound Cards |
|
||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_I("Creative SoundBlasterX G6", DetectCreativeDevice, CREATIVE_VID, CREATIVE_SOUNDBLASTERX_G6_PID, 4);
|
||||
|
|
|
|||
|
|
@ -1,81 +1,81 @@
|
|||
#include "RGBController_CreativeSoundBlasterXG6.h"
|
||||
|
||||
RGBController_CreativeSoundBlasterXG6::RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* creative_device)
|
||||
{
|
||||
creative = creative_device;
|
||||
|
||||
name = "Creative SoundBlasterX G6 Device";
|
||||
vendor = "Creative";
|
||||
type = DEVICE_TYPE_HEADSET;
|
||||
description = "Creative SoundBlasterX G6 Device";
|
||||
location = creative_device->GetDeviceLocation();
|
||||
serial = "";
|
||||
|
||||
mode Static;
|
||||
Static.name = "Direct";
|
||||
Static.value = 0;
|
||||
Static.flags = MODE_COLORS_PER_LED;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CreativeSoundBlasterXG6::~RGBController_CreativeSoundBlasterXG6()
|
||||
{
|
||||
delete creative;
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::SetupZones()
|
||||
{
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
logo_zone.leds_min = 1;
|
||||
logo_zone.leds_max = 1;
|
||||
logo_zone.leds_count = 1;
|
||||
logo_zone.matrix_map = NULL;
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
creative->SetLedColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
#include "RGBController_CreativeSoundBlasterXG6.h"
|
||||
|
||||
RGBController_CreativeSoundBlasterXG6::RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Creative SoundBlasterX G6 Device";
|
||||
vendor = "Creative";
|
||||
type = DEVICE_TYPE_HEADSET;
|
||||
description = "Creative SoundBlasterX G6 Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = "";
|
||||
|
||||
mode Static;
|
||||
Static.name = "Direct";
|
||||
Static.value = 0;
|
||||
Static.flags = MODE_COLORS_PER_LED;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CreativeSoundBlasterXG6::~RGBController_CreativeSoundBlasterXG6()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::SetupZones()
|
||||
{
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
logo_zone.leds_min = 1;
|
||||
logo_zone.leds_max = 1;
|
||||
logo_zone.leds_count = 1;
|
||||
logo_zone.matrix_map = NULL;
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
controller->SetLedColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CreativeSoundBlasterXG6Controller.h"
|
||||
|
||||
class RGBController_CreativeSoundBlasterXG6: public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* creative_device);
|
||||
~RGBController_CreativeSoundBlasterXG6();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CreativeSoundBlasterXG6Controller* creative;
|
||||
};
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CreativeSoundBlasterXG6Controller.h"
|
||||
|
||||
class RGBController_CreativeSoundBlasterXG6: public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* controller_ptr);
|
||||
~RGBController_CreativeSoundBlasterXG6();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CreativeSoundBlasterXG6Controller* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -161,9 +161,6 @@ void CrucialRegisterWrite(i2c_smbus_interface* bus, unsigned char dev, unsigned
|
|||
|
||||
void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
{
|
||||
CrucialController* new_crucial;
|
||||
RGBController_Crucial* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
int address_list_idx = -1;
|
||||
|
|
@ -214,9 +211,10 @@ void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses)
|
|||
{
|
||||
if (TestForCrucialController(busses[bus], crucial_addresses[address_list_idx]))
|
||||
{
|
||||
new_crucial = new CrucialController(busses[bus], crucial_addresses[address_list_idx]);
|
||||
new_controller = new RGBController_Crucial(new_crucial);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
CrucialController* controller = new CrucialController(busses[bus], crucial_addresses[address_list_idx]);
|
||||
RGBController_Crucial* rgb_controller = new RGBController_Crucial(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@
|
|||
|
||||
#include "RGBController_Crucial.h"
|
||||
|
||||
RGBController_Crucial::RGBController_Crucial(CrucialController * crucial_ptr)
|
||||
RGBController_Crucial::RGBController_Crucial(CrucialController* controller_ptr)
|
||||
{
|
||||
crucial = crucial_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Crucial DRAM";
|
||||
vendor = "Crucial";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Crucial DRAM Device";
|
||||
version = crucial->GetDeviceVersion();
|
||||
location = crucial->GetDeviceLocation();
|
||||
version = controller->GetDeviceVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -116,7 +116,7 @@ RGBController_Crucial::RGBController_Crucial(CrucialController * crucial_ptr)
|
|||
|
||||
RGBController_Crucial::~RGBController_Crucial()
|
||||
{
|
||||
delete crucial;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_Crucial::SetupZones()
|
||||
|
|
@ -139,7 +139,7 @@ void RGBController_Crucial::SetupZones()
|
|||
for(std::size_t led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "DRAM LED ";
|
||||
new_led.name = "DRAM LED ";
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
|
@ -158,15 +158,15 @@ void RGBController_Crucial::DeviceUpdateLEDs()
|
|||
{
|
||||
if(modes[active_mode].value == 0xFFFF)
|
||||
{
|
||||
crucial->SetAllColorsDirect(&colors[0]);
|
||||
controller->SetAllColorsDirect(&colors[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
crucial->SetAllColorsEffect(&colors[0]);
|
||||
controller->SetAllColorsEffect(&colors[0]);
|
||||
|
||||
if(modes[active_mode].value == CRUCIAL_MODE_STATIC)
|
||||
{
|
||||
crucial->SetMode(modes[active_mode].value);
|
||||
controller->SetMode(modes[active_mode].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -190,14 +190,14 @@ void RGBController_Crucial::DeviceUpdateMode()
|
|||
{
|
||||
if(modes[active_mode].value == 0xFFFF)
|
||||
{
|
||||
crucial->SetMode(CRUCIAL_MODE_STATIC);
|
||||
controller->SetMode(CRUCIAL_MODE_STATIC);
|
||||
return;
|
||||
}
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
|
||||
{
|
||||
crucial->SetAllColorsEffect(&colors[0]);
|
||||
controller->SetAllColorsEffect(&colors[0]);
|
||||
}
|
||||
|
||||
crucial->SetMode(modes[active_mode].value);
|
||||
controller->SetMode(modes[active_mode].value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_Crucial.h |
|
||||
| |
|
||||
| Generic RGB Interface for Crucial |
|
||||
| Ballistix RGB controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/19/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CrucialController.h"
|
||||
|
||||
class RGBController_Crucial : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Crucial(CrucialController* crucial_ptr);
|
||||
~RGBController_Crucial();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CrucialController* crucial;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Crucial.h |
|
||||
| |
|
||||
| Generic RGB Interface for Crucial |
|
||||
| Ballistix RGB controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/19/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CrucialController.h"
|
||||
|
||||
class RGBController_Crucial : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Crucial(CrucialController* controller_ptr);
|
||||
~RGBController_Crucial();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CrucialController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,346 +1,346 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_DasKeyboard.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Das Keyboard |
|
||||
| RGB keyboard devices |
|
||||
| |
|
||||
| Frank Niessen (denk_mal) 12/16/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_DasKeyboard.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
//0xFFFFFFFF indicates an unused entry in matrix
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
// US Layout TODO: mus be checked/corrected
|
||||
static unsigned int matrix_map_us[7][21] =
|
||||
{
|
||||
{NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 126, NA, NA, NA},
|
||||
{ 5, NA, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 127, 128, 129, 130},
|
||||
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124},
|
||||
{ 3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 7, 87, 93, 99, 105, 111, 117, 123},
|
||||
{ 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, NA, 80, NA, NA, NA, 104, 110, 116, NA},
|
||||
{ 1, NA, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 79, NA, NA, 91, NA, 103, 109, 115, 122},
|
||||
{ 0, 6, 12, NA, NA, NA, 36, NA, NA, NA, 60, 66, 72, 78, 84, 90, 96, 102, NA, 114, NA}
|
||||
};
|
||||
|
||||
// EU Layout
|
||||
static unsigned int matrix_map_eu[7][21] =
|
||||
{
|
||||
{NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 126, NA, NA, NA},
|
||||
{ 5, NA, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 127, 128, 129, 130},
|
||||
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124},
|
||||
{ 3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, NA, 87, 93, 99, 105, 111, 117, 123},
|
||||
{ 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 81, 80, NA, NA, NA, 104, 110, 116, NA},
|
||||
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 79, NA, NA, 91, NA, 103, 109, 115, 122},
|
||||
{ 0, 6, 12, NA, NA, NA, 36, NA, NA, NA, 60, 66, 72, 78, 84, 90, 96, 102, NA, 114, NA}
|
||||
};
|
||||
|
||||
static const char *zone_names[] =
|
||||
{
|
||||
"Keyboard"
|
||||
};
|
||||
|
||||
static zone_type zone_types[] =
|
||||
{
|
||||
ZONE_TYPE_MATRIX,
|
||||
};
|
||||
|
||||
static const unsigned int zone_sizes[] =
|
||||
{
|
||||
131
|
||||
};
|
||||
|
||||
// UK Layout
|
||||
static const char *led_names[] =
|
||||
{
|
||||
"Key: Left Control",
|
||||
"Key: Left Shift",
|
||||
"Key: Caps Lock",
|
||||
"Key: Tab",
|
||||
"Key: `",
|
||||
"Key: Escape",
|
||||
"Key: Left Windows",
|
||||
"Key: \\ (ANSI)",
|
||||
"Key: A",
|
||||
"Key: Q",
|
||||
"Key: 1",
|
||||
"Undefined",
|
||||
"Key: Left Alt",
|
||||
"Key: Z",
|
||||
"Key: S",
|
||||
"Key: W",
|
||||
"Key: 2",
|
||||
"Key: F1",
|
||||
"Undefined",
|
||||
"Key: X",
|
||||
"Key: D",
|
||||
"Key: E",
|
||||
"Key: 3",
|
||||
"Key: F2",
|
||||
"Undefined",
|
||||
"Key: C",
|
||||
"Key: F",
|
||||
"Key: R",
|
||||
"Key: 4",
|
||||
"Key: F3",
|
||||
"Undefined",
|
||||
"Key: V",
|
||||
"Key: G",
|
||||
"Key: T",
|
||||
"Key: 5",
|
||||
"Key: F4",
|
||||
"Key: Space",
|
||||
"Key: B",
|
||||
"Key: H",
|
||||
"Key: Y",
|
||||
"Key: 6",
|
||||
"Key: F5",
|
||||
"Undefined",
|
||||
"Key: N",
|
||||
"Key: J",
|
||||
"Key: U",
|
||||
"Key: 7",
|
||||
"Key: F6",
|
||||
"Undefined",
|
||||
"Key: M",
|
||||
"Key: K",
|
||||
"Key: I",
|
||||
"Key: 8",
|
||||
"Key: F7",
|
||||
"Undefined",
|
||||
"Key: ,",
|
||||
"Key: L",
|
||||
"Key: O",
|
||||
"Key: 9",
|
||||
"Key: F8",
|
||||
"Key: Right Alt",
|
||||
"Key: .",
|
||||
"Key: ;",
|
||||
"Key: P",
|
||||
"Key: 0",
|
||||
"Key: F9",
|
||||
"Key: Right Windows",
|
||||
"Key: /",
|
||||
"Key: '",
|
||||
"Key: [",
|
||||
"Key: -",
|
||||
"Key: F10",
|
||||
"Key: Menu",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: ]",
|
||||
"Key: =",
|
||||
"Key: F11",
|
||||
"Key: Right Control",
|
||||
"Key: Right Shift",
|
||||
"Key: Enter",
|
||||
"Key: #",
|
||||
"Key: Backspace",
|
||||
"Key: F12",
|
||||
"Key: Left Arrow",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: Delete",
|
||||
"Key: Insert",
|
||||
"Key: Print Screen",
|
||||
"Key: Down Arrow",
|
||||
"Key: Up Arrow",
|
||||
"Undefined",
|
||||
"Key: End",
|
||||
"Key: Home",
|
||||
"Key: Scroll Lock",
|
||||
"Key: Right Arrow",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: Page Down",
|
||||
"Key: Page Up",
|
||||
"Key: Pause/Break",
|
||||
"Key: Number Pad 0",
|
||||
"Key: Number Pad 1",
|
||||
"Key: Number Pad 4",
|
||||
"Key: Number Pad 7",
|
||||
"Key: Num Lock",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: Number Pad 2",
|
||||
"Key: Number Pad 5",
|
||||
"Key: Number Pad 8",
|
||||
"Key: Number Pad /",
|
||||
"Undefined",
|
||||
"Key: Number Pad .",
|
||||
"Key: Number Pad 3",
|
||||
"Key: Number Pad 6",
|
||||
"Key: Number Pad 9",
|
||||
"Key: Number Pad *",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: Number Pad Enter",
|
||||
"Key: Number Pad +",
|
||||
"Key: Number Pad -",
|
||||
"Undefined",
|
||||
"Key: Sleep",
|
||||
"Key: Brightness",
|
||||
"Key: Media Play/Pause",
|
||||
"Key: Media Next",
|
||||
"Key: Q-Button"
|
||||
};
|
||||
|
||||
RGBController_DasKeyboard::RGBController_DasKeyboard(DasKeyboardController *das_ptr)
|
||||
{
|
||||
das = das_ptr;
|
||||
|
||||
for(unsigned int ii = 0; ii < zone_sizes[0]; ii++)
|
||||
{
|
||||
double_buffer.push_back(-1);
|
||||
}
|
||||
|
||||
updateDevice = true;
|
||||
|
||||
name = "Das Keyboard Device";
|
||||
vendor = "Metadot";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Das Keyboard Device";
|
||||
location = das->GetDeviceLocation();
|
||||
serial = das->GetSerialString();
|
||||
version = das->GetVersionString();
|
||||
|
||||
modes.resize(4);
|
||||
modes[0].name = "Direct";
|
||||
modes[0].value = DAS_KEYBOARD_MODE_DIRECT;
|
||||
modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[0].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes[1].name = "Flashing";
|
||||
modes[1].value = DAS_KEYBOARD_MODE_FLASHING;
|
||||
modes[1].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[1].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes[2].name = "Breathing";
|
||||
modes[2].value = DAS_KEYBOARD_MODE_BREATHING;
|
||||
modes[2].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[2].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes[3].name = "Spectrum Cycle";
|
||||
modes[3].value = DAS_KEYBOARD_MODE_SPECTRUM_CYCLE;
|
||||
modes[3].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[3].color_mode = MODE_COLORS_PER_LED;
|
||||
}
|
||||
|
||||
RGBController_DasKeyboard::~RGBController_DasKeyboard()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int zone_size = zones.size();
|
||||
|
||||
for(unsigned int zone_index = 0; zone_index < zone_size; zone_index++)
|
||||
{
|
||||
delete zones[zone_index].matrix_map;
|
||||
}
|
||||
|
||||
delete das;
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int total_led_count = 0;
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
new_zone.type = zone_types[zone_idx];
|
||||
new_zone.leds_min = zone_sizes[zone_idx];
|
||||
new_zone.leds_max = zone_sizes[zone_idx];
|
||||
new_zone.leds_count = zone_sizes[zone_idx];
|
||||
new_zone.matrix_map = new matrix_map_type;
|
||||
new_zone.matrix_map->height = 7;
|
||||
new_zone.matrix_map->width = 21;
|
||||
|
||||
if(das->GetLayoutString() == "US")
|
||||
{
|
||||
new_zone.matrix_map->map = (unsigned int *) &matrix_map_us;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.matrix_map->map = (unsigned int *) &matrix_map_eu;
|
||||
}
|
||||
|
||||
zones.push_back(new_zone);
|
||||
|
||||
total_led_count += zone_sizes[zone_idx];
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
updateDevice = false;
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
UpdateSingleLED(static_cast<int>(led_idx));
|
||||
}
|
||||
|
||||
updateDevice = true;
|
||||
|
||||
das->SendApply();
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::UpdateSingleLED(int led)
|
||||
{
|
||||
mode selected_mode = modes[active_mode];
|
||||
|
||||
if(double_buffer[led] == colors[led])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
das->SendColors(led, selected_mode.value,
|
||||
RGBGetRValue(colors[led]),
|
||||
RGBGetGValue(colors[led]),
|
||||
RGBGetBValue(colors[led]));
|
||||
|
||||
double_buffer[led] = colors[led];
|
||||
|
||||
if(updateDevice)
|
||||
{
|
||||
das->SendApply();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::DeviceUpdateMode()
|
||||
{
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_DasKeyboard.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Das Keyboard |
|
||||
| RGB keyboard devices |
|
||||
| |
|
||||
| Frank Niessen (denk_mal) 12/16/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_DasKeyboard.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
//0xFFFFFFFF indicates an unused entry in matrix
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
// US Layout TODO: mus be checked/corrected
|
||||
static unsigned int matrix_map_us[7][21] =
|
||||
{
|
||||
{NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 126, NA, NA, NA},
|
||||
{ 5, NA, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 127, 128, 129, 130},
|
||||
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124},
|
||||
{ 3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 7, 87, 93, 99, 105, 111, 117, 123},
|
||||
{ 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, NA, 80, NA, NA, NA, 104, 110, 116, NA},
|
||||
{ 1, NA, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 79, NA, NA, 91, NA, 103, 109, 115, 122},
|
||||
{ 0, 6, 12, NA, NA, NA, 36, NA, NA, NA, 60, 66, 72, 78, 84, 90, 96, 102, NA, 114, NA}
|
||||
};
|
||||
|
||||
// EU Layout
|
||||
static unsigned int matrix_map_eu[7][21] =
|
||||
{
|
||||
{NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 126, NA, NA, NA},
|
||||
{ 5, NA, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 127, 128, 129, 130},
|
||||
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124},
|
||||
{ 3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, NA, 87, 93, 99, 105, 111, 117, 123},
|
||||
{ 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 81, 80, NA, NA, NA, 104, 110, 116, NA},
|
||||
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 79, NA, NA, 91, NA, 103, 109, 115, 122},
|
||||
{ 0, 6, 12, NA, NA, NA, 36, NA, NA, NA, 60, 66, 72, 78, 84, 90, 96, 102, NA, 114, NA}
|
||||
};
|
||||
|
||||
static const char *zone_names[] =
|
||||
{
|
||||
"Keyboard"
|
||||
};
|
||||
|
||||
static zone_type zone_types[] =
|
||||
{
|
||||
ZONE_TYPE_MATRIX,
|
||||
};
|
||||
|
||||
static const unsigned int zone_sizes[] =
|
||||
{
|
||||
131
|
||||
};
|
||||
|
||||
// UK Layout
|
||||
static const char *led_names[] =
|
||||
{
|
||||
"Key: Left Control",
|
||||
"Key: Left Shift",
|
||||
"Key: Caps Lock",
|
||||
"Key: Tab",
|
||||
"Key: `",
|
||||
"Key: Escape",
|
||||
"Key: Left Windows",
|
||||
"Key: \\ (ANSI)",
|
||||
"Key: A",
|
||||
"Key: Q",
|
||||
"Key: 1",
|
||||
"Undefined",
|
||||
"Key: Left Alt",
|
||||
"Key: Z",
|
||||
"Key: S",
|
||||
"Key: W",
|
||||
"Key: 2",
|
||||
"Key: F1",
|
||||
"Undefined",
|
||||
"Key: X",
|
||||
"Key: D",
|
||||
"Key: E",
|
||||
"Key: 3",
|
||||
"Key: F2",
|
||||
"Undefined",
|
||||
"Key: C",
|
||||
"Key: F",
|
||||
"Key: R",
|
||||
"Key: 4",
|
||||
"Key: F3",
|
||||
"Undefined",
|
||||
"Key: V",
|
||||
"Key: G",
|
||||
"Key: T",
|
||||
"Key: 5",
|
||||
"Key: F4",
|
||||
"Key: Space",
|
||||
"Key: B",
|
||||
"Key: H",
|
||||
"Key: Y",
|
||||
"Key: 6",
|
||||
"Key: F5",
|
||||
"Undefined",
|
||||
"Key: N",
|
||||
"Key: J",
|
||||
"Key: U",
|
||||
"Key: 7",
|
||||
"Key: F6",
|
||||
"Undefined",
|
||||
"Key: M",
|
||||
"Key: K",
|
||||
"Key: I",
|
||||
"Key: 8",
|
||||
"Key: F7",
|
||||
"Undefined",
|
||||
"Key: ,",
|
||||
"Key: L",
|
||||
"Key: O",
|
||||
"Key: 9",
|
||||
"Key: F8",
|
||||
"Key: Right Alt",
|
||||
"Key: .",
|
||||
"Key: ;",
|
||||
"Key: P",
|
||||
"Key: 0",
|
||||
"Key: F9",
|
||||
"Key: Right Windows",
|
||||
"Key: /",
|
||||
"Key: '",
|
||||
"Key: [",
|
||||
"Key: -",
|
||||
"Key: F10",
|
||||
"Key: Menu",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: ]",
|
||||
"Key: =",
|
||||
"Key: F11",
|
||||
"Key: Right Control",
|
||||
"Key: Right Shift",
|
||||
"Key: Enter",
|
||||
"Key: #",
|
||||
"Key: Backspace",
|
||||
"Key: F12",
|
||||
"Key: Left Arrow",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: Delete",
|
||||
"Key: Insert",
|
||||
"Key: Print Screen",
|
||||
"Key: Down Arrow",
|
||||
"Key: Up Arrow",
|
||||
"Undefined",
|
||||
"Key: End",
|
||||
"Key: Home",
|
||||
"Key: Scroll Lock",
|
||||
"Key: Right Arrow",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: Page Down",
|
||||
"Key: Page Up",
|
||||
"Key: Pause/Break",
|
||||
"Key: Number Pad 0",
|
||||
"Key: Number Pad 1",
|
||||
"Key: Number Pad 4",
|
||||
"Key: Number Pad 7",
|
||||
"Key: Num Lock",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: Number Pad 2",
|
||||
"Key: Number Pad 5",
|
||||
"Key: Number Pad 8",
|
||||
"Key: Number Pad /",
|
||||
"Undefined",
|
||||
"Key: Number Pad .",
|
||||
"Key: Number Pad 3",
|
||||
"Key: Number Pad 6",
|
||||
"Key: Number Pad 9",
|
||||
"Key: Number Pad *",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Undefined",
|
||||
"Key: Number Pad Enter",
|
||||
"Key: Number Pad +",
|
||||
"Key: Number Pad -",
|
||||
"Undefined",
|
||||
"Key: Sleep",
|
||||
"Key: Brightness",
|
||||
"Key: Media Play/Pause",
|
||||
"Key: Media Next",
|
||||
"Key: Q-Button"
|
||||
};
|
||||
|
||||
RGBController_DasKeyboard::RGBController_DasKeyboard(DasKeyboardController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
for(unsigned int ii = 0; ii < zone_sizes[0]; ii++)
|
||||
{
|
||||
double_buffer.push_back(-1);
|
||||
}
|
||||
|
||||
updateDevice = true;
|
||||
|
||||
name = "Das Keyboard Device";
|
||||
vendor = "Metadot";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Das Keyboard Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetVersionString();
|
||||
|
||||
modes.resize(4);
|
||||
modes[0].name = "Direct";
|
||||
modes[0].value = DAS_KEYBOARD_MODE_DIRECT;
|
||||
modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[0].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes[1].name = "Flashing";
|
||||
modes[1].value = DAS_KEYBOARD_MODE_FLASHING;
|
||||
modes[1].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[1].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes[2].name = "Breathing";
|
||||
modes[2].value = DAS_KEYBOARD_MODE_BREATHING;
|
||||
modes[2].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[2].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes[3].name = "Spectrum Cycle";
|
||||
modes[3].value = DAS_KEYBOARD_MODE_SPECTRUM_CYCLE;
|
||||
modes[3].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[3].color_mode = MODE_COLORS_PER_LED;
|
||||
}
|
||||
|
||||
RGBController_DasKeyboard::~RGBController_DasKeyboard()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int zone_size = zones.size();
|
||||
|
||||
for(unsigned int zone_index = 0; zone_index < zone_size; zone_index++)
|
||||
{
|
||||
delete zones[zone_index].matrix_map;
|
||||
}
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int total_led_count = 0;
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
new_zone.type = zone_types[zone_idx];
|
||||
new_zone.leds_min = zone_sizes[zone_idx];
|
||||
new_zone.leds_max = zone_sizes[zone_idx];
|
||||
new_zone.leds_count = zone_sizes[zone_idx];
|
||||
new_zone.matrix_map = new matrix_map_type;
|
||||
new_zone.matrix_map->height = 7;
|
||||
new_zone.matrix_map->width = 21;
|
||||
|
||||
if(controller->GetLayoutString() == "US")
|
||||
{
|
||||
new_zone.matrix_map->map = (unsigned int *) &matrix_map_us;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.matrix_map->map = (unsigned int *) &matrix_map_eu;
|
||||
}
|
||||
|
||||
zones.push_back(new_zone);
|
||||
|
||||
total_led_count += zone_sizes[zone_idx];
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
updateDevice = false;
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
UpdateSingleLED(static_cast<int>(led_idx));
|
||||
}
|
||||
|
||||
updateDevice = true;
|
||||
|
||||
controller->SendApply();
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::UpdateSingleLED(int led)
|
||||
{
|
||||
mode selected_mode = modes[active_mode];
|
||||
|
||||
if(double_buffer[led] == colors[led])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
controller->SendColors(led, selected_mode.value,
|
||||
RGBGetRValue(colors[led]),
|
||||
RGBGetGValue(colors[led]),
|
||||
RGBGetBValue(colors[led]));
|
||||
|
||||
double_buffer[led] = colors[led];
|
||||
|
||||
if(updateDevice)
|
||||
{
|
||||
controller->SendApply();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_DasKeyboard::DeviceUpdateMode()
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +1,49 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_DasKeyboard.h |
|
||||
| |
|
||||
| Generic RGB Interface for Das Keyboard |
|
||||
| RGB keyboard devices |
|
||||
| |
|
||||
| Frank Niessen (denk_mal) 12/16/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "DasKeyboardController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
DAS_KEYBOARD_MODE_DIRECT = 0x01,
|
||||
DAS_KEYBOARD_MODE_FLASHING = 0x1F,
|
||||
DAS_KEYBOARD_MODE_BREATHING = 0x08,
|
||||
DAS_KEYBOARD_MODE_SPECTRUM_CYCLE = 0x14
|
||||
};
|
||||
|
||||
|
||||
class RGBController_DasKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_DasKeyboard(DasKeyboardController *das_ptr);
|
||||
|
||||
~RGBController_DasKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
|
||||
void UpdateZoneLEDs(int zone);
|
||||
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
DasKeyboardController *das;
|
||||
|
||||
std::vector<RGBColor> double_buffer;
|
||||
bool updateDevice;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_DasKeyboard.h |
|
||||
| |
|
||||
| Generic RGB Interface for Das Keyboard |
|
||||
| RGB keyboard devices |
|
||||
| |
|
||||
| Frank Niessen (denk_mal) 12/16/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "DasKeyboardController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
DAS_KEYBOARD_MODE_DIRECT = 0x01,
|
||||
DAS_KEYBOARD_MODE_FLASHING = 0x1F,
|
||||
DAS_KEYBOARD_MODE_BREATHING = 0x08,
|
||||
DAS_KEYBOARD_MODE_SPECTRUM_CYCLE = 0x14
|
||||
};
|
||||
|
||||
|
||||
class RGBController_DasKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_DasKeyboard(DasKeyboardController* controller_ptr);
|
||||
~RGBController_DasKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
|
||||
void UpdateZoneLEDs(int zone);
|
||||
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
DasKeyboardController* controller;
|
||||
|
||||
std::vector<RGBColor> double_buffer;
|
||||
bool updateDevice;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@
|
|||
void DetectDuckyKeyboardControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
|
||||
if(dev)
|
||||
{
|
||||
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path, info->product_id);
|
||||
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path, info->product_id);
|
||||
RGBController_DuckyKeyboard* rgb_controller = new RGBController_DuckyKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
|
|
|||
|
|
@ -185,16 +185,16 @@ static const char *led_names[] =
|
|||
"Key: Number Pad Enter",
|
||||
};
|
||||
|
||||
RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController* ducky_ptr)
|
||||
RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController* controller_ptr)
|
||||
{
|
||||
ducky = ducky_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Ducky Keyboard Device";
|
||||
vendor = "Ducky";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Ducky Keyboard Device";
|
||||
location = ducky->GetDeviceLocation();
|
||||
serial = ducky->GetSerialString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -219,7 +219,7 @@ RGBController_DuckyKeyboard::~RGBController_DuckyKeyboard()
|
|||
}
|
||||
}
|
||||
|
||||
delete ducky;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_DuckyKeyboard::SetupZones()
|
||||
|
|
@ -234,7 +234,7 @@ void RGBController_DuckyKeyboard::SetupZones()
|
|||
unsigned int matrix_width = 0;
|
||||
unsigned int* matrix_map_ptr = NULL;
|
||||
|
||||
switch(ducky->GetUSBPID())
|
||||
switch(controller->GetUSBPID())
|
||||
{
|
||||
case DUCKY_SHINE_7_ONE_2_RGB_PID:
|
||||
zone_size = zone_sizes[zone_idx];
|
||||
|
|
@ -292,7 +292,7 @@ void RGBController_DuckyKeyboard::DeviceUpdateLEDs()
|
|||
colordata[(color_idx*3)+2] = RGBGetBValue(colors[color_idx]);
|
||||
}
|
||||
|
||||
ducky->SendColors(colordata, sizeof(colordata));
|
||||
controller->SendColors(colordata, sizeof(colordata));
|
||||
}
|
||||
|
||||
void RGBController_DuckyKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_DuckyKeyboard.h |
|
||||
| |
|
||||
| Generic RGB Interface for Ducky RGB |
|
||||
| keyboard devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/4/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "DuckyKeyboardController.h"
|
||||
|
||||
class RGBController_DuckyKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_DuckyKeyboard(DuckyKeyboardController* ducky_ptr);
|
||||
~RGBController_DuckyKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
DuckyKeyboardController* ducky;
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_DuckyKeyboard.h |
|
||||
| |
|
||||
| Generic RGB Interface for Ducky RGB |
|
||||
| keyboard devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/4/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "DuckyKeyboardController.h"
|
||||
|
||||
class RGBController_DuckyKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_DuckyKeyboard(DuckyKeyboardController* controller_ptr);
|
||||
~RGBController_DuckyKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
DuckyKeyboardController* controller;
|
||||
};
|
||||
|
|
@ -1,31 +1,31 @@
|
|||
#include "Detector.h"
|
||||
#include "EKController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_EKController.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define EK_VID 0x0483
|
||||
#define EK_LOOP_CONNECT 0x5750
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectEKControllers *
|
||||
* *
|
||||
* Tests the USB address to see if any EK Controllers exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectEKControllers(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
EKController* controller = new EKController(dev, info->path);
|
||||
RGBController_EKController* rgb_controller = new RGBController_EKController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
info = info->next;
|
||||
} /* DetectEKControllers() */
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("EK Loop Connect", DetectEKControllers, EK_VID, EK_LOOP_CONNECT, 0, 0xFFA0, 1);
|
||||
#include "Detector.h"
|
||||
#include "EKController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_EKController.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define EK_VID 0x0483
|
||||
#define EK_LOOP_CONNECT 0x5750
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectEKControllers *
|
||||
* *
|
||||
* Tests the USB address to see if any EK Controllers exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectEKControllers(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
EKController* controller = new EKController(dev, info->path);
|
||||
RGBController_EKController* rgb_controller = new RGBController_EKController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectEKControllers() */
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("EK Loop Connect", DetectEKControllers, EK_VID, EK_LOOP_CONNECT, 0, 0xFFA0, 1);
|
||||
|
|
|
|||
|
|
@ -1,174 +1,175 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_EKController.cpp |
|
||||
| |
|
||||
| Driver for EK Loop Connect |
|
||||
| |
|
||||
| Chris M (Dr_No) 16th Jul 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_EKController.h"
|
||||
|
||||
RGBController_EKController::RGBController_EKController(EKController* _dev)
|
||||
{
|
||||
EK_dev = _dev;
|
||||
|
||||
name = EK_dev->GetDeviceName();
|
||||
vendor = "EK";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = EK_dev->GetDeviceName();
|
||||
version = "1.0";
|
||||
serial = EK_dev->GetSerial();
|
||||
location = EK_dev->GetLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = EK_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 = EK_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.speed_min = EK_SPEED_SLOWEST;
|
||||
Breathing.speed_max = EK_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Fading;
|
||||
Fading.name = "Fading";
|
||||
Fading.value = EK_MODE_FADING;
|
||||
Fading.flags = MODE_FLAG_HAS_SPEED;
|
||||
Fading.speed_min = EK_SPEED_SLOWEST;
|
||||
Fading.speed_max = EK_SPEED_FASTEST;
|
||||
Fading.color_mode = MODE_COLORS_NONE;
|
||||
Fading.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Fading);
|
||||
|
||||
mode Marquee;
|
||||
Marquee.name = "Marquee";
|
||||
Marquee.value = EK_MODE_MARQUEE;
|
||||
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Marquee.speed_min = EK_SPEED_SLOWEST;
|
||||
Marquee.speed_max = EK_SPEED_FASTEST;
|
||||
Marquee.color_mode = MODE_COLORS_PER_LED;
|
||||
Marquee.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Marquee);
|
||||
|
||||
mode Covering_Marquee;
|
||||
Covering_Marquee.name = "Covering Marquee";
|
||||
Covering_Marquee.value = EK_MODE_COVERING_MARQUEE;
|
||||
Covering_Marquee.flags = MODE_FLAG_HAS_SPEED;
|
||||
Covering_Marquee.speed_min = EK_SPEED_SLOWEST;
|
||||
Covering_Marquee.speed_max = EK_SPEED_FASTEST;
|
||||
Covering_Marquee.color_mode = MODE_COLORS_NONE;
|
||||
Covering_Marquee.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Covering_Marquee);
|
||||
|
||||
mode Pulse;
|
||||
Pulse.name = "Pulse";
|
||||
Pulse.value = EK_MODE_PULSE;
|
||||
Pulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Pulse.speed_min = EK_SPEED_SLOWEST;
|
||||
Pulse.speed_max = EK_SPEED_FASTEST;
|
||||
Pulse.color_mode = MODE_COLORS_PER_LED;
|
||||
Pulse.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Pulse);
|
||||
|
||||
mode Spectrum_Wave;
|
||||
Spectrum_Wave.name = "Spectrum_Wave";
|
||||
Spectrum_Wave.value = EK_MODE_SPECTRUM_WAVE;
|
||||
Spectrum_Wave.flags = MODE_FLAG_HAS_SPEED;
|
||||
Spectrum_Wave.speed_min = EK_SPEED_SLOWEST;
|
||||
Spectrum_Wave.speed_max = EK_SPEED_FASTEST;
|
||||
Spectrum_Wave.color_mode = MODE_COLORS_NONE;
|
||||
Spectrum_Wave.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Spectrum_Wave);
|
||||
|
||||
mode Alternating;
|
||||
Alternating.name = "Alternating";
|
||||
Alternating.value = EK_MODE_ALTERNATING;
|
||||
Alternating.flags = MODE_FLAG_HAS_SPEED;
|
||||
Alternating.speed_min = EK_SPEED_SLOWEST;
|
||||
Alternating.speed_max = EK_SPEED_FASTEST;
|
||||
Alternating.color_mode = MODE_COLORS_PER_LED;
|
||||
Alternating.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Alternating);
|
||||
|
||||
mode Candle;
|
||||
Candle.name = "Candle";
|
||||
Candle.value = EK_MODE_CANDLE;
|
||||
Candle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Candle.speed_min = EK_SPEED_SLOWEST;
|
||||
Candle.speed_max = EK_SPEED_FASTEST;
|
||||
Candle.color_mode = MODE_COLORS_PER_LED;
|
||||
Candle.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Candle);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_EKController::~RGBController_EKController()
|
||||
{
|
||||
delete EK_dev;
|
||||
}
|
||||
|
||||
void RGBController_EKController::SetupZones()
|
||||
{
|
||||
zone EK_zone;
|
||||
EK_zone.name = "Loop Connect";
|
||||
EK_zone.type = ZONE_TYPE_SINGLE;
|
||||
EK_zone.leds_min = 1;
|
||||
EK_zone.leds_max = 1;
|
||||
EK_zone.leds_count = 1;
|
||||
EK_zone.matrix_map = NULL;
|
||||
zones.push_back(EK_zone);
|
||||
|
||||
led EK_led;
|
||||
EK_led.name = "EK LED";
|
||||
leds.push_back(EK_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_EKController::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| ToDo |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_EKController::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
EK_dev->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_EKController::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
RGBColor color = colors[zone];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
EK_dev->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_EKController::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_EKController::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_EKController::DeviceUpdateMode()
|
||||
{
|
||||
EK_dev->SetMode(modes[active_mode].value, modes[active_mode].speed);
|
||||
}
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_EKController.cpp |
|
||||
| |
|
||||
| Driver for EK Loop Connect |
|
||||
| |
|
||||
| Chris M (Dr_No) 16th Jul 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_EKController.h"
|
||||
|
||||
RGBController_EKController::RGBController_EKController(EKController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "EK";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = controller->GetDeviceName();
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = EK_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 = EK_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.speed_min = EK_SPEED_SLOWEST;
|
||||
Breathing.speed_max = EK_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Fading;
|
||||
Fading.name = "Fading";
|
||||
Fading.value = EK_MODE_FADING;
|
||||
Fading.flags = MODE_FLAG_HAS_SPEED;
|
||||
Fading.speed_min = EK_SPEED_SLOWEST;
|
||||
Fading.speed_max = EK_SPEED_FASTEST;
|
||||
Fading.color_mode = MODE_COLORS_NONE;
|
||||
Fading.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Fading);
|
||||
|
||||
mode Marquee;
|
||||
Marquee.name = "Marquee";
|
||||
Marquee.value = EK_MODE_MARQUEE;
|
||||
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Marquee.speed_min = EK_SPEED_SLOWEST;
|
||||
Marquee.speed_max = EK_SPEED_FASTEST;
|
||||
Marquee.color_mode = MODE_COLORS_PER_LED;
|
||||
Marquee.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Marquee);
|
||||
|
||||
mode Covering_Marquee;
|
||||
Covering_Marquee.name = "Covering Marquee";
|
||||
Covering_Marquee.value = EK_MODE_COVERING_MARQUEE;
|
||||
Covering_Marquee.flags = MODE_FLAG_HAS_SPEED;
|
||||
Covering_Marquee.speed_min = EK_SPEED_SLOWEST;
|
||||
Covering_Marquee.speed_max = EK_SPEED_FASTEST;
|
||||
Covering_Marquee.color_mode = MODE_COLORS_NONE;
|
||||
Covering_Marquee.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Covering_Marquee);
|
||||
|
||||
mode Pulse;
|
||||
Pulse.name = "Pulse";
|
||||
Pulse.value = EK_MODE_PULSE;
|
||||
Pulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Pulse.speed_min = EK_SPEED_SLOWEST;
|
||||
Pulse.speed_max = EK_SPEED_FASTEST;
|
||||
Pulse.color_mode = MODE_COLORS_PER_LED;
|
||||
Pulse.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Pulse);
|
||||
|
||||
mode Spectrum_Wave;
|
||||
Spectrum_Wave.name = "Spectrum_Wave";
|
||||
Spectrum_Wave.value = EK_MODE_SPECTRUM_WAVE;
|
||||
Spectrum_Wave.flags = MODE_FLAG_HAS_SPEED;
|
||||
Spectrum_Wave.speed_min = EK_SPEED_SLOWEST;
|
||||
Spectrum_Wave.speed_max = EK_SPEED_FASTEST;
|
||||
Spectrum_Wave.color_mode = MODE_COLORS_NONE;
|
||||
Spectrum_Wave.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Spectrum_Wave);
|
||||
|
||||
mode Alternating;
|
||||
Alternating.name = "Alternating";
|
||||
Alternating.value = EK_MODE_ALTERNATING;
|
||||
Alternating.flags = MODE_FLAG_HAS_SPEED;
|
||||
Alternating.speed_min = EK_SPEED_SLOWEST;
|
||||
Alternating.speed_max = EK_SPEED_FASTEST;
|
||||
Alternating.color_mode = MODE_COLORS_PER_LED;
|
||||
Alternating.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Alternating);
|
||||
|
||||
mode Candle;
|
||||
Candle.name = "Candle";
|
||||
Candle.value = EK_MODE_CANDLE;
|
||||
Candle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Candle.speed_min = EK_SPEED_SLOWEST;
|
||||
Candle.speed_max = EK_SPEED_FASTEST;
|
||||
Candle.color_mode = MODE_COLORS_PER_LED;
|
||||
Candle.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Candle);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_EKController::~RGBController_EKController()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_EKController::SetupZones()
|
||||
{
|
||||
zone EK_zone;
|
||||
EK_zone.name = "Loop Connect";
|
||||
EK_zone.type = ZONE_TYPE_SINGLE;
|
||||
EK_zone.leds_min = 1;
|
||||
EK_zone.leds_max = 1;
|
||||
EK_zone.leds_count = 1;
|
||||
EK_zone.matrix_map = NULL;
|
||||
zones.push_back(EK_zone);
|
||||
|
||||
led EK_led;
|
||||
EK_led.name = "EK LED";
|
||||
leds.push_back(EK_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_EKController::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| ToDo |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_EKController::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
controller->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_EKController::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
RGBColor color = colors[zone];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_EKController::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_EKController::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_EKController::DeviceUpdateMode()
|
||||
{
|
||||
controller->SetMode(modes[active_mode].value, modes[active_mode].speed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_EKController.h |
|
||||
| |
|
||||
| Driver for EK Loop Connect |
|
||||
| |
|
||||
| Chris M (Dr_No) 16th Jul 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RGBCONTROLLER_EKCONTROLLER_H
|
||||
#define RGBCONTROLLER_EKCONTROLLER_H
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "Controllers/EKController/EKController.h"
|
||||
|
||||
class RGBController_EKController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_EKController(EKController *_dev);
|
||||
~RGBController_EKController();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
EKController* EK_dev;
|
||||
};
|
||||
|
||||
#endif // RGBCONTROLLER_EKCONTROLLER_H
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_EKController.h |
|
||||
| |
|
||||
| Driver for EK Loop Connect |
|
||||
| |
|
||||
| Chris M (Dr_No) 16th Jul 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RGBCONTROLLER_EKCONTROLLER_H
|
||||
#define RGBCONTROLLER_EKCONTROLLER_H
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "Controllers/EKController/EKController.h"
|
||||
|
||||
class RGBController_EKController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_EKController(EKController* controller_ptr);
|
||||
~RGBController_EKController();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
EKController* controller;
|
||||
};
|
||||
|
||||
#endif // RGBCONTROLLER_EKCONTROLLER_H
|
||||
|
|
|
|||
|
|
@ -30,9 +30,10 @@
|
|||
void DetectEVisionKeyboards(hid_device_info* info, const std::string& /*name*/)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
|
||||
if(dev)
|
||||
{
|
||||
EVisionKeyboardController* controller = new EVisionKeyboardController(dev, info->path);
|
||||
EVisionKeyboardController* controller = new EVisionKeyboardController(dev, info->path);
|
||||
RGBController_EVisionKeyboard* rgb_controller = new RGBController_EVisionKeyboard(controller);
|
||||
rgb_controller->name = "EVision Keyboard";
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
|
|
|||
|
|
@ -1,74 +1,73 @@
|
|||
#include "Detector.h"
|
||||
#include "EspurnaController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Espurna.h"
|
||||
#include "SettingsManager.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectEspurnaControllers *
|
||||
* *
|
||||
* Detect devices supported by the Espurna driver *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectEspurnaControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
EspurnaController* new_espurna;
|
||||
RGBController_Espurna* new_controller;
|
||||
json espurna_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Espurna settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
espurna_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("EspurnaDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Espurna settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(espurna_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < espurna_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
std::string ip;
|
||||
std::string port;
|
||||
std::string apikey;
|
||||
|
||||
if(espurna_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
ip = espurna_settings["devices"][device_idx]["ip"];
|
||||
}
|
||||
|
||||
if(espurna_settings["devices"][device_idx].contains("port"))
|
||||
{
|
||||
if(espurna_settings["devices"][device_idx]["port"].type() == json::value_t::string)
|
||||
{
|
||||
port = espurna_settings["devices"][device_idx]["port"];
|
||||
}
|
||||
else
|
||||
{
|
||||
port = std::to_string((unsigned int)espurna_settings["devices"][device_idx]["port"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(espurna_settings["devices"][device_idx].contains("apikey"))
|
||||
{
|
||||
apikey = espurna_settings["devices"][device_idx]["apikey"];
|
||||
}
|
||||
|
||||
std::string value = ip + "," + port + "," + apikey;
|
||||
|
||||
new_espurna = new EspurnaController();
|
||||
new_espurna->Initialize((char *)value.c_str());
|
||||
|
||||
new_controller = new RGBController_Espurna(new_espurna);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectEspurnaControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Espurna", DetectEspurnaControllers);
|
||||
#include "Detector.h"
|
||||
#include "EspurnaController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Espurna.h"
|
||||
#include "SettingsManager.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectEspurnaControllers *
|
||||
* *
|
||||
* Detect devices supported by the Espurna driver *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectEspurnaControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
json espurna_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Espurna settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
espurna_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("EspurnaDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Espurna settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(espurna_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < espurna_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
std::string ip;
|
||||
std::string port;
|
||||
std::string apikey;
|
||||
|
||||
if(espurna_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
ip = espurna_settings["devices"][device_idx]["ip"];
|
||||
}
|
||||
|
||||
if(espurna_settings["devices"][device_idx].contains("port"))
|
||||
{
|
||||
if(espurna_settings["devices"][device_idx]["port"].type() == json::value_t::string)
|
||||
{
|
||||
port = espurna_settings["devices"][device_idx]["port"];
|
||||
}
|
||||
else
|
||||
{
|
||||
port = std::to_string((unsigned int)espurna_settings["devices"][device_idx]["port"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(espurna_settings["devices"][device_idx].contains("apikey"))
|
||||
{
|
||||
apikey = espurna_settings["devices"][device_idx]["apikey"];
|
||||
}
|
||||
|
||||
std::string value = ip + "," + port + "," + apikey;
|
||||
|
||||
EspurnaController* controller = new EspurnaController();
|
||||
controller->Initialize((char *)value.c_str());
|
||||
|
||||
RGBController_Espurna* rgb_controller = new RGBController_Espurna(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectEspurnaControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Espurna", DetectEspurnaControllers);
|
||||
|
|
|
|||
|
|
@ -1,84 +1,84 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_Espurna.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Espurna |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/20/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_Espurna.h"
|
||||
|
||||
RGBController_Espurna::RGBController_Espurna(EspurnaController* espurna_ptr)
|
||||
{
|
||||
espurna = espurna_ptr;
|
||||
|
||||
name = "Espurna";
|
||||
type = DEVICE_TYPE_LIGHT;
|
||||
description = "Espurna Device";
|
||||
location = espurna->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_Espurna::~RGBController_Espurna()
|
||||
{
|
||||
delete espurna;
|
||||
}
|
||||
|
||||
void RGBController_Espurna::SetupZones()
|
||||
{
|
||||
zone led_zone;
|
||||
led_zone.name = "RGB Light";
|
||||
led_zone.type = ZONE_TYPE_SINGLE;
|
||||
led_zone.leds_min = 1;
|
||||
led_zone.leds_max = 1;
|
||||
led_zone.leds_count = 1;
|
||||
led_zone.matrix_map = NULL;
|
||||
zones.push_back(led_zone);
|
||||
|
||||
led new_led;
|
||||
new_led.name = "RGB Light";
|
||||
|
||||
leds.push_back(new_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_Espurna::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_Espurna::DeviceUpdateLEDs()
|
||||
{
|
||||
espurna->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_Espurna::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
espurna->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_Espurna::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
espurna->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_Espurna::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_Espurna::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Espurna.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Espurna |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/20/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_Espurna.h"
|
||||
|
||||
RGBController_Espurna::RGBController_Espurna(EspurnaController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Espurna";
|
||||
type = DEVICE_TYPE_LIGHT;
|
||||
description = "Espurna Device";
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_Espurna::~RGBController_Espurna()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_Espurna::SetupZones()
|
||||
{
|
||||
zone led_zone;
|
||||
led_zone.name = "RGB Light";
|
||||
led_zone.type = ZONE_TYPE_SINGLE;
|
||||
led_zone.leds_min = 1;
|
||||
led_zone.leds_max = 1;
|
||||
led_zone.leds_count = 1;
|
||||
led_zone.matrix_map = NULL;
|
||||
zones.push_back(led_zone);
|
||||
|
||||
led new_led;
|
||||
new_led.name = "RGB Light";
|
||||
|
||||
leds.push_back(new_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_Espurna::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_Espurna::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_Espurna::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_Espurna::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_Espurna::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_Espurna::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_Espurna.h |
|
||||
| |
|
||||
| Generic RGB Interface for Espurna |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 9/11/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "EspurnaController.h"
|
||||
|
||||
class RGBController_Espurna : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Espurna(EspurnaController* espurna_ptr);
|
||||
~RGBController_Espurna();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
EspurnaController* espurna;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Espurna.h |
|
||||
| |
|
||||
| Generic RGB Interface for Espurna |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 9/11/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "EspurnaController.h"
|
||||
|
||||
class RGBController_Espurna : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Espurna(EspurnaController* controller_ptr);
|
||||
~RGBController_Espurna();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
EspurnaController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,45 +1,42 @@
|
|||
#include "Detector.h"
|
||||
#include "FanBusController.h"
|
||||
#include "RGBController_FanBus.h"
|
||||
|
||||
void DetectFanBusControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
FanBusInterface* new_interface;
|
||||
FanBusController* new_controller;
|
||||
RGBController_FanBus* new_rgbcontroller;
|
||||
|
||||
json fanbus_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get LED Strip settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
fanbus_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("FanBusDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the LEDStrip settings contains devices, process|
|
||||
\*-------------------------------------------------*/
|
||||
if(fanbus_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < fanbus_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
if(fanbus_settings["devices"][device_idx].contains("port"))
|
||||
{
|
||||
std::string port_val = fanbus_settings["devices"][device_idx]["port"];
|
||||
|
||||
new_interface = new FanBusInterface(port_val.c_str());
|
||||
|
||||
std::vector<unsigned char> detected_controllers = new_interface->DetectControllers();
|
||||
|
||||
for(unsigned int controller_idx = 0; controller_idx < detected_controllers.size(); controller_idx++)
|
||||
{
|
||||
new_controller = new FanBusController(new_interface, detected_controllers[controller_idx]);
|
||||
new_rgbcontroller = new RGBController_FanBus(new_controller);
|
||||
|
||||
rgb_controllers.push_back(new_rgbcontroller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_DETECTOR("FanBus", DetectFanBusControllers);
|
||||
#include "Detector.h"
|
||||
#include "FanBusController.h"
|
||||
#include "RGBController_FanBus.h"
|
||||
|
||||
void DetectFanBusControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
FanBusInterface* new_interface;
|
||||
json fanbus_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get LED Strip settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
fanbus_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("FanBusDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the LEDStrip settings contains devices, process|
|
||||
\*-------------------------------------------------*/
|
||||
if(fanbus_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < fanbus_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
if(fanbus_settings["devices"][device_idx].contains("port"))
|
||||
{
|
||||
std::string port_val = fanbus_settings["devices"][device_idx]["port"];
|
||||
|
||||
new_interface = new FanBusInterface(port_val.c_str());
|
||||
|
||||
std::vector<unsigned char> detected_controllers = new_interface->DetectControllers();
|
||||
|
||||
for(unsigned int controller_idx = 0; controller_idx < detected_controllers.size(); controller_idx++)
|
||||
{
|
||||
FanBusController* controller = new FanBusController(new_interface, detected_controllers[controller_idx]);
|
||||
RGBController_FanBus* rgb_controller = new RGBController_FanBus(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_DETECTOR("FanBus", DetectFanBusControllers);
|
||||
|
|
|
|||
|
|
@ -111,26 +111,24 @@ void DetectGainwardGPUControllers(std::vector<i2c_smbus_interface*> &busses)
|
|||
case RGB_V1:
|
||||
{
|
||||
LOG_DEBUG(GPU_DETECT_MESSAGE, "Gainward v1", bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
|
||||
GainwardGPUv1Controller* new_GainwardGPU;
|
||||
RGBController_GainwardGPUv1* new_controller;
|
||||
|
||||
new_GainwardGPU = new GainwardGPUv1Controller(busses[bus], 0x08);
|
||||
new_controller = new RGBController_GainwardGPUv1(new_GainwardGPU);
|
||||
new_controller->name = device_list[dev_idx].name;
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
GainwardGPUv1Controller* controller = new GainwardGPUv1Controller(busses[bus], 0x08);
|
||||
RGBController_GainwardGPUv1* rgb_controller = new RGBController_GainwardGPUv1(controller);
|
||||
rgb_controller->name = device_list[dev_idx].name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
break;
|
||||
|
||||
case RGB_V2:
|
||||
{
|
||||
LOG_DEBUG(GPU_DETECT_MESSAGE, "Gainward v2", bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
|
||||
GainwardGPUv2Controller* new_GainwardGPU;
|
||||
RGBController_GainwardGPUv2* new_controller;
|
||||
|
||||
new_GainwardGPU = new GainwardGPUv2Controller(busses[bus], 0x49);
|
||||
new_controller = new RGBController_GainwardGPUv2(new_GainwardGPU);
|
||||
new_controller->name = device_list[dev_idx].name;
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
GainwardGPUv2Controller* controller = new GainwardGPUv2Controller(busses[bus], 0x49);
|
||||
RGBController_GainwardGPUv2* rgb_controller = new RGBController_GainwardGPUv2(controller);
|
||||
rgb_controller->name = device_list[dev_idx].name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,113 +1,112 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPUv1.cpp |
|
||||
| |
|
||||
| Driver for Gainward RGB v1 on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_GainwardGPUv1.h"
|
||||
|
||||
int RGBController_GainwardGPUv1::GetDeviceMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
return(active_mode);
|
||||
}
|
||||
|
||||
RGBController_GainwardGPUv1::RGBController_GainwardGPUv1(GainwardGPUv1Controller * gainward_gpu_ptr)
|
||||
{
|
||||
gainward_gpu = gainward_gpu_ptr;
|
||||
|
||||
name = "Gainward GPU";
|
||||
vendor = "Gainward";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "Gainward GTX GPU";
|
||||
version = "";
|
||||
location = gainward_gpu->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 1;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_GainwardGPUv1::~RGBController_GainwardGPUv1()
|
||||
{
|
||||
delete gainward_gpu;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone gainward_gpu_zone;
|
||||
gainward_gpu_zone.name = "GPU";
|
||||
gainward_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
gainward_gpu_zone.leds_min = 1;
|
||||
gainward_gpu_zone.leds_max = 1;
|
||||
gainward_gpu_zone.leds_count = 1;
|
||||
gainward_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(gainward_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led gainward_gpu_led;
|
||||
gainward_gpu_led.name = "GPU";
|
||||
leds.push_back(gainward_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = gainward_gpu->GetLEDRed();
|
||||
unsigned char grn = gainward_gpu->GetLEDGreen();
|
||||
unsigned char blu = gainward_gpu->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::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]);
|
||||
|
||||
gainward_gpu->SetLEDColors(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPUv1.cpp |
|
||||
| |
|
||||
| Driver for Gainward RGB v1 on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_GainwardGPUv1.h"
|
||||
|
||||
int RGBController_GainwardGPUv1::GetDeviceMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
return(active_mode);
|
||||
}
|
||||
|
||||
RGBController_GainwardGPUv1::RGBController_GainwardGPUv1(GainwardGPUv1Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Gainward GPU";
|
||||
vendor = "Gainward";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "Gainward GTX GPU";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 1;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_GainwardGPUv1::~RGBController_GainwardGPUv1()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone gainward_gpu_zone;
|
||||
gainward_gpu_zone.name = "GPU";
|
||||
gainward_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
gainward_gpu_zone.leds_min = 1;
|
||||
gainward_gpu_zone.leds_max = 1;
|
||||
gainward_gpu_zone.leds_count = 1;
|
||||
gainward_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(gainward_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led gainward_gpu_led;
|
||||
gainward_gpu_led.name = "GPU";
|
||||
leds.push_back(gainward_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = controller->GetLEDRed();
|
||||
unsigned char grn = controller->GetLEDGreen();
|
||||
unsigned char blu = controller->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::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]);
|
||||
|
||||
controller->SetLEDColors(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv1::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPU.h |
|
||||
| |
|
||||
| Driver for Gainward RGB v1 on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GainwardGPUv1Controller.h"
|
||||
|
||||
class RGBController_GainwardGPUv1 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GainwardGPUv1(GainwardGPUv1Controller* gainward_gpu_ptr);
|
||||
~RGBController_GainwardGPUv1();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GainwardGPUv1Controller* gainward_gpu;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPU.h |
|
||||
| |
|
||||
| Driver for Gainward RGB v1 on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GainwardGPUv1Controller.h"
|
||||
|
||||
class RGBController_GainwardGPUv1 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GainwardGPUv1(GainwardGPUv1Controller* controller_ptr);
|
||||
~RGBController_GainwardGPUv1();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GainwardGPUv1Controller* controller;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,185 +1,184 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPUv2.cpp |
|
||||
| |
|
||||
| Driver for Gainward RGB v2 on GPUs |
|
||||
| |
|
||||
| KundaPanda 01/04/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_GainwardGPUv2.h"
|
||||
|
||||
RGBController_GainwardGPUv2::RGBController_GainwardGPUv2(GainwardGPUv2Controller* gainward_gpu_ptr)
|
||||
{
|
||||
gainward_gpu = gainward_gpu_ptr;
|
||||
|
||||
name = "Gainward GPU";
|
||||
vendor = "Gainward";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "Gainward RTX GPU";
|
||||
version = "";
|
||||
location = gainward_gpu->GetDeviceLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = GAINWARD_V2_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathe;
|
||||
Breathe.name = "Breathing";
|
||||
Breathe.value = GAINWARD_V2_MODE_STATIC;
|
||||
Breathe.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathe.speed_max = 0x000a;
|
||||
Breathe.speed_min = 0x1324;
|
||||
Breathe.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathe.colors_min = 2;
|
||||
Breathe.colors_max = 2;
|
||||
Breathe.colors.resize(2);
|
||||
modes.push_back(Breathe);
|
||||
|
||||
mode RainbowWave;
|
||||
RainbowWave.name = "Rainbow Wave";
|
||||
RainbowWave.value = GAINWARD_V2_MODE_CYCLE;
|
||||
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
RainbowWave.speed_max = 0x0;
|
||||
RainbowWave.speed_min = 0xF;
|
||||
RainbowWave.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(RainbowWave);
|
||||
|
||||
mode Strobe;
|
||||
Strobe.name = "Strobe";
|
||||
Strobe.value = GAINWARD_V2_MODE_STROBE;
|
||||
Strobe.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Strobe.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Strobe.colors_min = 1;
|
||||
Strobe.colors_max = 1;
|
||||
Strobe.colors.resize(1);
|
||||
Strobe.speed_max = 0x0;
|
||||
Strobe.speed_min = 0xF;
|
||||
modes.push_back(Strobe);
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-------------------------*\
|
||||
| Initialize active mode |
|
||||
\*-------------------------*/
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
RGBController_GainwardGPUv2::~RGBController_GainwardGPUv2()
|
||||
{
|
||||
delete gainward_gpu;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone gainward_gpu_zone;
|
||||
gainward_gpu_zone.name = "GPU";
|
||||
gainward_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
gainward_gpu_zone.leds_min = 1;
|
||||
gainward_gpu_zone.leds_max = 1;
|
||||
gainward_gpu_zone.leds_count = 1;
|
||||
gainward_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(gainward_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led gainward_gpu_led;
|
||||
gainward_gpu_led.name = "GPU";
|
||||
leds.push_back(gainward_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = gainward_gpu->GetLEDRed();
|
||||
unsigned char grn = gainward_gpu->GetLEDGreen();
|
||||
unsigned char blu = gainward_gpu->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::DeviceUpdateLEDs()
|
||||
{
|
||||
for(unsigned int color : colors)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
gainward_gpu->SetLEDColors(red, grn, blu);
|
||||
gainward_gpu->SetMode(GAINWARD_V2_MODE_STATIC, 0x2);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::DeviceUpdateMode()
|
||||
{
|
||||
mode current_mode = modes[(unsigned int)active_mode];
|
||||
switch (active_mode)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
gainward_gpu->SetBreathingSpeed(current_mode.speed);
|
||||
|
||||
unsigned char r1 = RGBGetRValue(current_mode.colors[0]);
|
||||
unsigned char g1 = RGBGetGValue(current_mode.colors[0]);
|
||||
unsigned char b1 = RGBGetBValue(current_mode.colors[0]);
|
||||
gainward_gpu->SetLEDColors(r1, g1, b1);
|
||||
|
||||
unsigned char r2 = RGBGetRValue(current_mode.colors[1]);
|
||||
unsigned char g2 = RGBGetGValue(current_mode.colors[1]);
|
||||
unsigned char b2 = RGBGetBValue(current_mode.colors[1]);
|
||||
gainward_gpu->SetLEDColors(r2, g2, b2, GAINWARD_V2_COLOR_REGISTER_SECONDARY);
|
||||
gainward_gpu->SetMode(GAINWARD_V2_MODE_STATIC, 0x2, GAINWARD_V2_STATIC_BREATHING);
|
||||
}
|
||||
break;
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Case 3 intentionally falls through to case 2 |
|
||||
\*---------------------------------------------*/
|
||||
case 3:
|
||||
{
|
||||
unsigned char r = RGBGetRValue(current_mode.colors[0]);
|
||||
unsigned char g = RGBGetGValue(current_mode.colors[0]);
|
||||
unsigned char b = RGBGetBValue(current_mode.colors[0]);
|
||||
gainward_gpu->SetLEDColors(r, g, b, GAINWARD_V2_COLOR_REGISTER_TERTIARY);
|
||||
}
|
||||
|
||||
case 2:
|
||||
gainward_gpu->SetMode((unsigned char)(current_mode.value), (unsigned char)(current_mode.speed));
|
||||
gainward_gpu->SetDirection(current_mode.direction);
|
||||
break;
|
||||
|
||||
default:
|
||||
gainward_gpu->SetMode((unsigned char)(current_mode.value), (unsigned char)(current_mode.speed));
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPUv2.cpp |
|
||||
| |
|
||||
| Driver for Gainward RGB v2 on GPUs |
|
||||
| |
|
||||
| KundaPanda 01/04/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_GainwardGPUv2.h"
|
||||
|
||||
RGBController_GainwardGPUv2::RGBController_GainwardGPUv2(GainwardGPUv2Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Gainward GPU";
|
||||
vendor = "Gainward";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "Gainward RTX GPU";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = GAINWARD_V2_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathe;
|
||||
Breathe.name = "Breathing";
|
||||
Breathe.value = GAINWARD_V2_MODE_STATIC;
|
||||
Breathe.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathe.speed_max = 0x000a;
|
||||
Breathe.speed_min = 0x1324;
|
||||
Breathe.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathe.colors_min = 2;
|
||||
Breathe.colors_max = 2;
|
||||
Breathe.colors.resize(2);
|
||||
modes.push_back(Breathe);
|
||||
|
||||
mode RainbowWave;
|
||||
RainbowWave.name = "Rainbow Wave";
|
||||
RainbowWave.value = GAINWARD_V2_MODE_CYCLE;
|
||||
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
RainbowWave.speed_max = 0x0;
|
||||
RainbowWave.speed_min = 0xF;
|
||||
RainbowWave.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(RainbowWave);
|
||||
|
||||
mode Strobe;
|
||||
Strobe.name = "Strobe";
|
||||
Strobe.value = GAINWARD_V2_MODE_STROBE;
|
||||
Strobe.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Strobe.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Strobe.colors_min = 1;
|
||||
Strobe.colors_max = 1;
|
||||
Strobe.colors.resize(1);
|
||||
Strobe.speed_max = 0x0;
|
||||
Strobe.speed_min = 0xF;
|
||||
modes.push_back(Strobe);
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-------------------------*\
|
||||
| Initialize active mode |
|
||||
\*-------------------------*/
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
RGBController_GainwardGPUv2::~RGBController_GainwardGPUv2()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone gainward_gpu_zone;
|
||||
gainward_gpu_zone.name = "GPU";
|
||||
gainward_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
gainward_gpu_zone.leds_min = 1;
|
||||
gainward_gpu_zone.leds_max = 1;
|
||||
gainward_gpu_zone.leds_count = 1;
|
||||
gainward_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(gainward_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led gainward_gpu_led;
|
||||
gainward_gpu_led.name = "GPU";
|
||||
leds.push_back(gainward_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = controller->GetLEDRed();
|
||||
unsigned char grn = controller->GetLEDGreen();
|
||||
unsigned char blu = controller->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::DeviceUpdateLEDs()
|
||||
{
|
||||
for(unsigned int color : colors)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetLEDColors(red, grn, blu);
|
||||
controller->SetMode(GAINWARD_V2_MODE_STATIC, 0x2);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPUv2::DeviceUpdateMode()
|
||||
{
|
||||
mode current_mode = modes[(unsigned int)active_mode];
|
||||
switch (active_mode)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
controller->SetBreathingSpeed(current_mode.speed);
|
||||
|
||||
unsigned char r1 = RGBGetRValue(current_mode.colors[0]);
|
||||
unsigned char g1 = RGBGetGValue(current_mode.colors[0]);
|
||||
unsigned char b1 = RGBGetBValue(current_mode.colors[0]);
|
||||
controller->SetLEDColors(r1, g1, b1);
|
||||
|
||||
unsigned char r2 = RGBGetRValue(current_mode.colors[1]);
|
||||
unsigned char g2 = RGBGetGValue(current_mode.colors[1]);
|
||||
unsigned char b2 = RGBGetBValue(current_mode.colors[1]);
|
||||
controller->SetLEDColors(r2, g2, b2, GAINWARD_V2_COLOR_REGISTER_SECONDARY);
|
||||
controller->SetMode(GAINWARD_V2_MODE_STATIC, 0x2, GAINWARD_V2_STATIC_BREATHING);
|
||||
}
|
||||
break;
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Case 3 intentionally falls through to case 2 |
|
||||
\*---------------------------------------------*/
|
||||
case 3:
|
||||
{
|
||||
unsigned char r = RGBGetRValue(current_mode.colors[0]);
|
||||
unsigned char g = RGBGetGValue(current_mode.colors[0]);
|
||||
unsigned char b = RGBGetBValue(current_mode.colors[0]);
|
||||
controller->SetLEDColors(r, g, b, GAINWARD_V2_COLOR_REGISTER_TERTIARY);
|
||||
}
|
||||
|
||||
case 2:
|
||||
controller->SetMode((unsigned char)(current_mode.value), (unsigned char)(current_mode.speed));
|
||||
controller->SetDirection(current_mode.direction);
|
||||
break;
|
||||
|
||||
default:
|
||||
controller->SetMode((unsigned char)(current_mode.value), (unsigned char)(current_mode.speed));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPUv2.h |
|
||||
| |
|
||||
| Driver for Gainward RGB v2 on GPUs |
|
||||
| |
|
||||
| KundaPanda 01/04/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GainwardGPUv2Controller.h"
|
||||
|
||||
class RGBController_GainwardGPUv2 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GainwardGPUv2(GainwardGPUv2Controller* gainward_gpu_ptr);
|
||||
~RGBController_GainwardGPUv2();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GainwardGPUv2Controller* gainward_gpu;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPUv2.h |
|
||||
| |
|
||||
| Driver for Gainward RGB v2 on GPUs |
|
||||
| |
|
||||
| KundaPanda 01/04/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GainwardGPUv2Controller.h"
|
||||
|
||||
class RGBController_GainwardGPUv2 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GainwardGPUv2(GainwardGPUv2Controller* controller_ptr);
|
||||
~RGBController_GainwardGPUv2();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GainwardGPUv2Controller* controller;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue