Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,286 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| CorsairHydroController.cpp |
|
||||
| |
|
||||
| Driver for Corsair Hydro Series coolers |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 17 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include "CorsairHydroController.h"
|
||||
|
||||
CorsairHydroController::CorsairHydroController(libusb_device_handle* dev_handle, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
name = dev_name;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in location string with USB ID |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_device_descriptor descriptor;
|
||||
libusb_get_device_descriptor(libusb_get_device(dev_handle), &descriptor);
|
||||
|
||||
std::stringstream location_stream;
|
||||
location_stream << std::hex << std::setfill('0') << std::setw(4) << descriptor.idVendor << ":" << std::hex << std::setfill('0') << std::setw(4) << descriptor.idProduct;
|
||||
location = location_stream.str();
|
||||
|
||||
SendInit();
|
||||
|
||||
SendFirmwareRequest();
|
||||
}
|
||||
|
||||
CorsairHydroController::~CorsairHydroController()
|
||||
{
|
||||
if(dev)
|
||||
{
|
||||
libusb_close(dev);
|
||||
}
|
||||
}
|
||||
|
||||
std::string CorsairHydroController::GetFirmwareString()
|
||||
{
|
||||
return(firmware_version);
|
||||
}
|
||||
|
||||
std::string CorsairHydroController::GetLocation()
|
||||
{
|
||||
return("USB: " + location);
|
||||
}
|
||||
|
||||
std::string CorsairHydroController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
void CorsairHydroController::SetBlink
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
unsigned char speed
|
||||
)
|
||||
{
|
||||
SendColors(colors);
|
||||
SendSpeed(speed);
|
||||
SendApplyBlink();
|
||||
}
|
||||
|
||||
void CorsairHydroController::SetFixed
|
||||
(
|
||||
std::vector<RGBColor> & colors
|
||||
)
|
||||
{
|
||||
SendColors(colors);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fixed mode seems to just be shift mode with the same |
|
||||
| value for both colors |
|
||||
\*-----------------------------------------------------*/
|
||||
SendApplyShift();
|
||||
}
|
||||
|
||||
void CorsairHydroController::SetPulse
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
unsigned char speed
|
||||
)
|
||||
{
|
||||
SendColors(colors);
|
||||
SendSpeed(speed);
|
||||
SendApplyPulse();
|
||||
}
|
||||
|
||||
void CorsairHydroController::SetShift
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
unsigned char speed
|
||||
)
|
||||
{
|
||||
SendColors(colors);
|
||||
SendSpeed(speed);
|
||||
SendApplyShift();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
void CorsairHydroController::SendApplyBlink()
|
||||
{
|
||||
unsigned char usb_buf[3];
|
||||
int actual;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Apply Blink packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0] = 0x58;
|
||||
usb_buf[1] = 0x01;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
|
||||
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
|
||||
}
|
||||
|
||||
void CorsairHydroController::SendApplyPulse()
|
||||
{
|
||||
unsigned char usb_buf[3];
|
||||
int actual;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Apply Pulse packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0] = 0x52;
|
||||
usb_buf[1] = 0x01;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
|
||||
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
|
||||
}
|
||||
|
||||
void CorsairHydroController::SendApplyShift()
|
||||
{
|
||||
unsigned char usb_buf[3];
|
||||
int actual;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Apply Shift packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0] = 0x55;
|
||||
usb_buf[1] = 0x01;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
|
||||
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
|
||||
}
|
||||
|
||||
void CorsairHydroController::SendFirmwareRequest()
|
||||
{
|
||||
unsigned char usb_buf[8];
|
||||
int actual;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Firmware Request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0] = 0xAA;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_bulk_transfer(dev, 0x01, usb_buf, 1, &actual, 1000);
|
||||
libusb_bulk_transfer(dev, 0x81, usb_buf, 7, &actual, 1000);
|
||||
|
||||
firmware_version = std::to_string(usb_buf[3]) + "." + std::to_string(usb_buf[4]) + "." + std::to_string(usb_buf[5]) + "." + std::to_string(usb_buf[6]);
|
||||
}
|
||||
|
||||
void CorsairHydroController::SendColors
|
||||
(
|
||||
std::vector<RGBColor> & colors
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[23];
|
||||
int actual;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Send Colors packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0] = 0x56;
|
||||
usb_buf[1] = (unsigned char)colors.size();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in colors from vector |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
|
||||
{
|
||||
usb_buf[(color_idx * 3) + 2] = RGBGetRValue(colors[color_idx]);
|
||||
usb_buf[(color_idx * 3) + 3] = RGBGetGValue(colors[color_idx]);
|
||||
usb_buf[(color_idx * 3) + 4] = RGBGetBValue(colors[color_idx]);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If the color vector only has one entry, duplicate it, as |
|
||||
| the controller appears to require two colors in order to |
|
||||
| update. |
|
||||
\*---------------------------------------------------------*/
|
||||
if((color_idx == 0) && colors.size() == 1)
|
||||
{
|
||||
usb_buf[1] = (unsigned char)colors.size() + 1;
|
||||
usb_buf[(color_idx * 3) + 5] = RGBGetRValue(colors[color_idx]);
|
||||
usb_buf[(color_idx * 3) + 6] = RGBGetGValue(colors[color_idx]);
|
||||
usb_buf[(color_idx * 3) + 7] = RGBGetBValue(colors[color_idx]);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_bulk_transfer(dev, 0x01, usb_buf, 2 + (usb_buf[1] * 3), &actual, 1000);
|
||||
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
|
||||
}
|
||||
|
||||
void CorsairHydroController::SendInit()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_control_transfer( dev, 0x40, 0x00, 0xffff, 0x0000, NULL, 0, 0 );
|
||||
libusb_control_transfer( dev, 0x40, 0x02, 0x0002, 0x0000, NULL, 0, 0 );
|
||||
}
|
||||
|
||||
void CorsairHydroController::SendSpeed
|
||||
(
|
||||
unsigned char speed
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[3];
|
||||
int actual;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Send Speed packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0] = 0x53;
|
||||
usb_buf[1] = speed;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
|
||||
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| CorsairHydroController.h |
|
||||
| |
|
||||
| Driver for Corsair Hydro Series coolers |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 17 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <libusb.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_HYDRO_CMD_READ_PUMP_SPEED = 0x31,
|
||||
CORSAIR_HYDRO_CMD_WRITE_PUMP_MODE = 0x32,
|
||||
CORSAIR_HYDRO_CMD_READ_PUMP_MODE = 0x33,
|
||||
CORSAIR_HYDRO_CMD_READ_FAN_SPEED = 0x41,
|
||||
CORSAIR_HYDRO_CMD_READ_AIO_TEMP = 0xA9,
|
||||
CORSAIR_HYDRO_CMD_READ_FIRMWARE = 0xAA,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_HYDRO_PUMP_MODE_QUIET = 0x00,
|
||||
CORSAIR_HYDRO_PUMP_MODE_BALANCED = 0x01,
|
||||
CORSAIR_HYDRO_PUMP_MODE_PERFORMANCE = 0x02,
|
||||
};
|
||||
|
||||
class CorsairHydroController
|
||||
{
|
||||
public:
|
||||
CorsairHydroController(libusb_device_handle* dev_handle, std::string dev_name);
|
||||
~CorsairHydroController();
|
||||
|
||||
unsigned char GetFanPercent(unsigned char fan_channel);
|
||||
|
||||
unsigned short GetFanRPM(unsigned char fan_channel);
|
||||
|
||||
std::string GetFirmwareString();
|
||||
std::string GetLocation();
|
||||
std::string GetNameString();
|
||||
|
||||
void SetBlink
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
unsigned char speed
|
||||
);
|
||||
|
||||
void SetFixed
|
||||
(
|
||||
std::vector<RGBColor> & colors
|
||||
);
|
||||
|
||||
void SetPulse
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
unsigned char speed
|
||||
);
|
||||
|
||||
void SetShift
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
unsigned char speed
|
||||
);
|
||||
|
||||
private:
|
||||
libusb_device_handle* dev;
|
||||
std::string firmware_version;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SendApplyBlink();
|
||||
void SendApplyPulse();
|
||||
void SendApplyShift();
|
||||
|
||||
void SendColors
|
||||
(
|
||||
std::vector<RGBColor> & colors
|
||||
);
|
||||
|
||||
void SendFirmwareRequest();
|
||||
|
||||
void SendInit();
|
||||
|
||||
void SendSpeed
|
||||
(
|
||||
unsigned char speed
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| CorsairHydroControllerDetect.cpp |
|
||||
| |
|
||||
| Detector for Corsair Hydro Series coolers |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 17 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <libusb.h>
|
||||
#include "Detector.h"
|
||||
#include "CorsairHydroController.h"
|
||||
#include "RGBController_CorsairHydro.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()
|
||||
{
|
||||
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].name);
|
||||
RGBController_CorsairHydro* rgb_controller = new RGBController_CorsairHydro(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
} /* DetectCorsairHydroControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers);
|
||||
/*---------------------------------------------------------------------------------------------------------*\
|
||||
| Entries for dynamic UDEV rules |
|
||||
| |
|
||||
| DUMMY_DEVICE_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers, 0x1B1C, 0x0C12 ) |
|
||||
| DUMMY_DEVICE_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers, 0x1B1C, 0x0C13 ) |
|
||||
| DUMMY_DEVICE_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers, 0x1B1C, 0x0C15 ) |
|
||||
\*---------------------------------------------------------------------------------------------------------*/
|
||||
@@ -0,0 +1,152 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_CorsairHydro.cpp |
|
||||
| |
|
||||
| RGBController for Corsair Hydro Series coolers |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 18 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairHydro.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Corsair Hydro
|
||||
@category Cooler
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectCorsairHydroControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_CorsairHydro::RGBController_CorsairHydro(CorsairHydroController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
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::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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_CorsairHydro.h |
|
||||
| |
|
||||
| RGBController for Corsair Hydro Series coolers |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 17 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#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 DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairHydroController* controller;
|
||||
};
|
||||
Reference in New Issue
Block a user