mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-07-19 09:41:59 -04:00
Rename NodePro to LightingNode
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
| Adam Honse (calcprogrammer1@gmail.com), 1/12/2020 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "CorsairNodeProController.h"
|
||||
#include "CorsairLightingNodeController.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
@@ -41,12 +41,12 @@ static void Sleep(unsigned int milliseconds)
|
||||
|
||||
THREAD keepalive_thread(void *param)
|
||||
{
|
||||
CorsairNodeProController* corsair = static_cast<CorsairNodeProController*>(param);
|
||||
CorsairLightingNodeController* corsair = static_cast<CorsairLightingNodeController*>(param);
|
||||
corsair->KeepaliveThread();
|
||||
THREADRETURN
|
||||
}
|
||||
|
||||
CorsairNodeProController::CorsairNodeProController(libusb_device_handle* dev_handle, unsigned int dev_endpoint)
|
||||
CorsairLightingNodeController::CorsairLightingNodeController(libusb_device_handle* dev_handle, unsigned int dev_endpoint)
|
||||
{
|
||||
dev = dev_handle;
|
||||
endpoint = dev_endpoint;
|
||||
@@ -68,11 +68,11 @@ CorsairNodeProController::CorsairNodeProController(libusb_device_handle* dev_han
|
||||
#endif
|
||||
}
|
||||
|
||||
CorsairNodeProController::~CorsairNodeProController()
|
||||
CorsairLightingNodeController::~CorsairLightingNodeController()
|
||||
{
|
||||
}
|
||||
|
||||
void CorsairNodeProController::KeepaliveThread()
|
||||
void CorsairLightingNodeController::KeepaliveThread()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ void CorsairNodeProController::KeepaliveThread()
|
||||
}
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SetChannelEffect(unsigned char channel,
|
||||
void CorsairLightingNodeController::SetChannelEffect(unsigned char channel,
|
||||
unsigned char num_leds,
|
||||
unsigned char mode,
|
||||
unsigned char speed,
|
||||
@@ -111,7 +111,7 @@ void CorsairNodeProController::SetChannelEffect(unsigned char channel,
|
||||
/*-----------------------------------------------------*\
|
||||
| Set Port State packet |
|
||||
\*-----------------------------------------------------*/
|
||||
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE);
|
||||
SendPortState(channel, CORSAIR_LIGHTING_NODE_PORT_STATE_HARDWARE);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set Effect Configuration packet |
|
||||
@@ -145,7 +145,7 @@ void CorsairNodeProController::SetChannelEffect(unsigned char channel,
|
||||
SendCommit();
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
|
||||
void CorsairLightingNodeController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
|
||||
{
|
||||
unsigned char color_data[50];
|
||||
unsigned char pkt_max;
|
||||
@@ -153,7 +153,7 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
/*-----------------------------------------------------*\
|
||||
| Send Port State packet |
|
||||
\*-----------------------------------------------------*/
|
||||
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE);
|
||||
SendPortState(channel, CORSAIR_LIGHTING_NODE_PORT_STATE_SOFTWARE);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send red channel packet 1 |
|
||||
@@ -170,7 +170,7 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
color_data[idx] = RGBGetRValue(colors[idx]);
|
||||
}
|
||||
|
||||
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
|
||||
SendDirect(channel, 0, pkt_max, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_RED, color_data);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send red channel packet 2 if necessary |
|
||||
@@ -189,7 +189,7 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
color_data[idx] = RGBGetRValue(colors[idx+50]);
|
||||
}
|
||||
|
||||
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
|
||||
SendDirect(channel, 50, pkt_max, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_RED, color_data);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -207,7 +207,7 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
color_data[idx] = RGBGetGValue(colors[idx]);
|
||||
}
|
||||
|
||||
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
|
||||
SendDirect(channel, 0, pkt_max, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_GREEN, color_data);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send green channel packet 2 if necessary |
|
||||
@@ -226,7 +226,7 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
color_data[idx] = RGBGetGValue(colors[idx+50]);
|
||||
}
|
||||
|
||||
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
|
||||
SendDirect(channel, 50, pkt_max, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_GREEN, color_data);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -244,7 +244,7 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
color_data[idx] = RGBGetBValue(colors[idx]);
|
||||
}
|
||||
|
||||
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
|
||||
SendDirect(channel, 0, pkt_max, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_BLUE, color_data);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send blue channel packet 2 if necessary |
|
||||
@@ -263,7 +263,7 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
color_data[idx] = RGBGetBValue(colors[idx+50]);
|
||||
}
|
||||
|
||||
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
|
||||
SendDirect(channel, 50, pkt_max, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_BLUE, color_data);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -276,7 +276,7 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
void CorsairNodeProController::SendDirect
|
||||
void CorsairLightingNodeController::SendDirect
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char start,
|
||||
@@ -296,7 +296,7 @@ void CorsairNodeProController::SendDirect
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_DIRECT;
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_DIRECT;
|
||||
usb_buf[0x01] = channel;
|
||||
usb_buf[0x02] = start;
|
||||
usb_buf[0x03] = count;
|
||||
@@ -313,7 +313,7 @@ void CorsairNodeProController::SendDirect
|
||||
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendCommit()
|
||||
void CorsairLightingNodeController::SendCommit()
|
||||
{
|
||||
int actual;
|
||||
unsigned char usb_buf[64];
|
||||
@@ -326,7 +326,7 @@ void CorsairNodeProController::SendCommit()
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Commit packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_COMMIT;
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_COMMIT;
|
||||
usb_buf[0x01] = 0xFF;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -335,7 +335,7 @@ void CorsairNodeProController::SendCommit()
|
||||
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendBegin
|
||||
void CorsairLightingNodeController::SendBegin
|
||||
(
|
||||
unsigned char channel
|
||||
)
|
||||
@@ -351,7 +351,7 @@ void CorsairNodeProController::SendBegin
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Begin packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_BEGIN;
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_BEGIN;
|
||||
usb_buf[0x01] = channel;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -360,7 +360,7 @@ void CorsairNodeProController::SendBegin
|
||||
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendEffectConfig
|
||||
void CorsairLightingNodeController::SendEffectConfig
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char count,
|
||||
@@ -394,7 +394,7 @@ void CorsairNodeProController::SendEffectConfig
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Effect Config packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG;
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_EFFECT_CONFIG;
|
||||
usb_buf[0x01] = channel;
|
||||
usb_buf[0x02] = count * 10;
|
||||
usb_buf[0x03] = led_type;
|
||||
@@ -437,12 +437,12 @@ void CorsairNodeProController::SendEffectConfig
|
||||
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendTemperature()
|
||||
void CorsairLightingNodeController::SendTemperature()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendReset
|
||||
void CorsairLightingNodeController::SendReset
|
||||
(
|
||||
unsigned char channel
|
||||
)
|
||||
@@ -458,7 +458,7 @@ void CorsairNodeProController::SendReset
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Reset packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_RESET;
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_RESET;
|
||||
usb_buf[0x01] = channel;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -467,7 +467,7 @@ void CorsairNodeProController::SendReset
|
||||
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendPortState
|
||||
void CorsairLightingNodeController::SendPortState
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char state
|
||||
@@ -484,7 +484,7 @@ void CorsairNodeProController::SendPortState
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Port State packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE;
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_PORT_STATE;
|
||||
usb_buf[0x01] = channel;
|
||||
usb_buf[0x02] = state;
|
||||
|
||||
@@ -494,17 +494,17 @@ void CorsairNodeProController::SendPortState
|
||||
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendBrightness()
|
||||
void CorsairLightingNodeController::SendBrightness()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendLEDCount()
|
||||
void CorsairLightingNodeController::SendLEDCount()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CorsairNodeProController::SendProtocol()
|
||||
void CorsairLightingNodeController::SendProtocol()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Definitions for Corsair Lighting Node Pro |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com), 1/12/2020 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <vector>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_DIRECT = 0x32, /* Direct mode LED update packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_COMMIT = 0x33, /* Commit changes packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_BEGIN = 0x34, /* Begin effect packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_EFFECT_CONFIG = 0x35, /* Effect mode configuration packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_TEMPERATURE = 0x36, /* Update temperature value packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_RESET = 0x37, /* Reset channel packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_PORT_STATE = 0x38, /* Set port state packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_BRIGHTNESS = 0x39, /* Set brightness packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_LED_COUNT = 0x3A, /* Set LED count packet */
|
||||
CORSAIR_LIGHTING_NODE_PACKET_ID_PROTOCOL = 0x3B, /* Set protocol packet */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_RED = 0x00, /* Red channel for direct update */
|
||||
CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_GREEN = 0x01, /* Green channel for direct update */
|
||||
CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_BLUE = 0x02, /* Blue channel for direct update */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_LIGHTING_NODE_PORT_STATE_HARDWARE = 0x01, /* Effect hardware control of channel */
|
||||
CORSAIR_LIGHTING_NODE_PORT_STATE_SOFTWARE = 0x02, /* Direct software control of channel */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_LIGHTING_NODE_LED_TYPE_LED_STRIP = 0x0A, /* Corsair LED Strip Type */
|
||||
CORSAIR_LIGHTING_NODE_LED_TYPE_HD_FAN = 0x0C, /* Corsair HD-series Fan Type */
|
||||
CORSAIR_LIGHTING_NODE_LED_TYPE_SP_FAN = 0x01, /* Corsair SP-series Fan Type */
|
||||
CORSAIR_LIGHTING_NODE_LED_TYPE_ML_FAN = 0x02, /* Corsair ML-series Fan Type */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_LIGHTING_NODE_CHANNEL_1 = 0x00, /* Channel 1 */
|
||||
CORSAIR_LIGHTING_NODE_CHANNEL_2 = 0x01, /* Channel 2 */
|
||||
CORSAIR_LIGHTING_NODE_NUM_CHANNELS = 0x02, /* Number of channels */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_LIGHTING_NODE_SPEED_FAST = 0x00, /* Fast speed */
|
||||
CORSAIR_LIGHTING_NODE_SPEED_MEDIUM = 0x01, /* Medium speed */
|
||||
CORSAIR_LIGHTING_NODE_SPEED_SLOW = 0x02, /* Slow speed */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_LIGHTING_NODE_MODE_RAINBOW_WAVE = 0x00, /* Rainbow Wave mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_COLOR_SHIFT = 0x01, /* Color Shift mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_COLOR_PULSE = 0x02, /* Color Pulse mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_COLOR_WAVE = 0x03, /* Color Wave mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_STATIC = 0x04, /* Static mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_TEMPERATURE = 0x05, /* Temperature mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_VISOR = 0x06, /* Visor mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_MARQUEE = 0x07, /* Marquee mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_BLINK = 0x08, /* Blink mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_SEQUENTIAL = 0x09, /* Sequential mode */
|
||||
CORSAIR_LIGHTING_NODE_MODE_RAINBOW = 0x0A, /* Rainbow mode */
|
||||
};
|
||||
|
||||
class CorsairLightingNodeController
|
||||
{
|
||||
public:
|
||||
CorsairLightingNodeController(libusb_device_handle* dev_handle, unsigned int dev_endpoint);
|
||||
~CorsairLightingNodeController();
|
||||
|
||||
unsigned int GetStripsOnChannel(unsigned int channel);
|
||||
|
||||
void SetChannelEffect(unsigned char channel,
|
||||
unsigned char num_leds,
|
||||
unsigned char mode,
|
||||
unsigned char speed,
|
||||
unsigned char direction,
|
||||
bool random,
|
||||
unsigned char red1,
|
||||
unsigned char grn1,
|
||||
unsigned char blu1,
|
||||
unsigned char red2,
|
||||
unsigned char grn2,
|
||||
unsigned char blu2,
|
||||
unsigned char red3,
|
||||
unsigned char grn3,
|
||||
unsigned char blu3
|
||||
);
|
||||
|
||||
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
|
||||
unsigned int channel_leds[CORSAIR_LIGHTING_NODE_NUM_CHANNELS];
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
libusb_device_handle* dev;
|
||||
unsigned int endpoint;
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char start,
|
||||
unsigned char count,
|
||||
unsigned char color_channel,
|
||||
unsigned char* color_data
|
||||
);
|
||||
|
||||
void SendCommit();
|
||||
|
||||
void SendBegin
|
||||
(
|
||||
unsigned char channel
|
||||
);
|
||||
|
||||
void SendEffectConfig
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char count,
|
||||
unsigned char led_type,
|
||||
unsigned char mode,
|
||||
unsigned char speed,
|
||||
unsigned char direction,
|
||||
unsigned char change_style,
|
||||
unsigned char color_0_red,
|
||||
unsigned char color_0_green,
|
||||
unsigned char color_0_blue,
|
||||
unsigned char color_1_red,
|
||||
unsigned char color_1_green,
|
||||
unsigned char color_1_blue,
|
||||
unsigned char color_2_red,
|
||||
unsigned char color_2_green,
|
||||
unsigned char color_2_blue,
|
||||
unsigned short temperature_0,
|
||||
unsigned short temperature_1,
|
||||
unsigned short temperature_2
|
||||
);
|
||||
|
||||
void SendTemperature();
|
||||
|
||||
void SendReset
|
||||
(
|
||||
unsigned char channel
|
||||
);
|
||||
|
||||
void SendPortState
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char state
|
||||
);
|
||||
|
||||
void SendBrightness();
|
||||
|
||||
void SendLEDCount();
|
||||
|
||||
void SendProtocol();
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CorsairNodeProController.h"
|
||||
#include "CorsairLightingNodeController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairNodePro.h"
|
||||
#include "RGBController_CorsairLightingNode.h"
|
||||
#include <vector>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
@@ -34,13 +34,13 @@ static const corsair_node_device device_list[6] =
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairNodeProControllers *
|
||||
* DetectCorsairLightingNodeControllers *
|
||||
* *
|
||||
* Detect devices supported by the Corsair Lighting Node Pro driver *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairNodeProControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
libusb_context * ctx;
|
||||
libusb_init(&ctx);
|
||||
@@ -55,13 +55,13 @@ void DetectCorsairNodeProControllers(std::vector<RGBController*> &rgb_controller
|
||||
libusb_detach_kernel_driver(dev, 0);
|
||||
libusb_claim_interface(dev, 0);
|
||||
|
||||
CorsairNodeProController* controller = new CorsairNodeProController(dev, device_list[device_idx].usb_endpoint);
|
||||
CorsairLightingNodeController* controller = new CorsairLightingNodeController(dev, device_list[device_idx].usb_endpoint);
|
||||
|
||||
RGBController_CorsairNodePro* rgb_controller = new RGBController_CorsairNodePro(controller);
|
||||
RGBController_CorsairLightingNode* rgb_controller = new RGBController_CorsairLightingNode(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
} /* DetectCorsairNodeProControllers() */
|
||||
} /* DetectCorsairLightingNodeControllers() */
|
||||
@@ -1,175 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Definitions for Corsair Lighting Node Pro |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com), 1/12/2020 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <vector>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_DIRECT = 0x32, /* Direct mode LED update packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_COMMIT = 0x33, /* Commit changes packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_BEGIN = 0x34, /* Begin effect packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG = 0x35, /* Effect mode configuration packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_TEMPERATURE = 0x36, /* Update temperature value packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_RESET = 0x37, /* Reset channel packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE = 0x38, /* Set port state packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_BRIGHTNESS = 0x39, /* Set brightness packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_LED_COUNT = 0x3A, /* Set LED count packet */
|
||||
CORSAIR_CMDR_PRO_PACKET_ID_PROTOCOL = 0x3B, /* Set protocol packet */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED = 0x00, /* Red channel for direct update */
|
||||
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN = 0x01, /* Green channel for direct update */
|
||||
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE = 0x02, /* Blue channel for direct update */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE = 0x01, /* Effect hardware control of channel */
|
||||
CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE = 0x02, /* Direct software control of channel */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP = 0x0A, /* Corsair LED Strip Type */
|
||||
CORSAIR_CMDR_PRO_LED_TYPE_HD_FAN = 0x0C, /* Corsair HD-series Fan Type */
|
||||
CORSAIR_CMDR_PRO_LED_TYPE_SP_FAN = 0x01, /* Corsair SP-series Fan Type */
|
||||
CORSAIR_CMDR_PRO_LED_TYPE_ML_FAN = 0x02, /* Corsair ML-series Fan Type */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_CMDR_PRO_CHANNEL_1 = 0x00, /* Channel 1 */
|
||||
CORSAIR_CMDR_PRO_CHANNEL_2 = 0x01, /* Channel 2 */
|
||||
CORSAIR_CMDR_PRO_NUM_CHANNELS = 0x02, /* Number of channels */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_CMDR_PRO_SPEED_FAST = 0x00, /* Fast speed */
|
||||
CORSAIR_CMDR_PRO_SPEED_MEDIUM = 0x01, /* Medium speed */
|
||||
CORSAIR_CMDR_PRO_SPEED_SLOW = 0x02, /* Slow speed */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_CMDR_PRO_MODE_RAINBOW_WAVE = 0x00, /* Rainbow Wave mode */
|
||||
CORSAIR_CMDR_PRO_MODE_COLOR_SHIFT = 0x01, /* Color Shift mode */
|
||||
CORSAIR_CMDR_PRO_MODE_COLOR_PULSE = 0x02, /* Color Pulse mode */
|
||||
CORSAIR_CMDR_PRO_MODE_COLOR_WAVE = 0x03, /* Color Wave mode */
|
||||
CORSAIR_CMDR_PRO_MODE_STATIC = 0x04, /* Static mode */
|
||||
CORSAIR_CMDR_PRO_MODE_TEMPERATURE = 0x05, /* Temperature mode */
|
||||
CORSAIR_CMDR_PRO_MODE_VISOR = 0x06, /* Visor mode */
|
||||
CORSAIR_CMDR_PRO_MODE_MARQUEE = 0x07, /* Marquee mode */
|
||||
CORSAIR_CMDR_PRO_MODE_BLINK = 0x08, /* Blink mode */
|
||||
CORSAIR_CMDR_PRO_MODE_SEQUENTIAL = 0x09, /* Sequential mode */
|
||||
CORSAIR_CMDR_PRO_MODE_RAINBOW = 0x0A, /* Rainbow mode */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_NODE_PRO_CHANNEL_1 = 0x00, /* Channel 1 */
|
||||
CORSAIR_NODE_PRO_CHANNEL_2 = 0x01, /* Channel 2 */
|
||||
CORSAIR_NODE_PRO_NUM_CHANNELS = 0x02 /* Number of channels */
|
||||
};
|
||||
|
||||
class CorsairNodeProController
|
||||
{
|
||||
public:
|
||||
CorsairNodeProController(libusb_device_handle* dev_handle, unsigned int dev_endpoint);
|
||||
~CorsairNodeProController();
|
||||
|
||||
unsigned int GetStripsOnChannel(unsigned int channel);
|
||||
|
||||
void SetChannelEffect(unsigned char channel,
|
||||
unsigned char num_leds,
|
||||
unsigned char mode,
|
||||
unsigned char speed,
|
||||
unsigned char direction,
|
||||
bool random,
|
||||
unsigned char red1,
|
||||
unsigned char grn1,
|
||||
unsigned char blu1,
|
||||
unsigned char red2,
|
||||
unsigned char grn2,
|
||||
unsigned char blu2,
|
||||
unsigned char red3,
|
||||
unsigned char grn3,
|
||||
unsigned char blu3
|
||||
);
|
||||
|
||||
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
|
||||
unsigned int channel_leds[CORSAIR_NODE_PRO_NUM_CHANNELS];
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
libusb_device_handle* dev;
|
||||
unsigned int endpoint;
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char start,
|
||||
unsigned char count,
|
||||
unsigned char color_channel,
|
||||
unsigned char* color_data
|
||||
);
|
||||
|
||||
void SendCommit();
|
||||
|
||||
void SendBegin
|
||||
(
|
||||
unsigned char channel
|
||||
);
|
||||
|
||||
void SendEffectConfig
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char count,
|
||||
unsigned char led_type,
|
||||
unsigned char mode,
|
||||
unsigned char speed,
|
||||
unsigned char direction,
|
||||
unsigned char change_style,
|
||||
unsigned char color_0_red,
|
||||
unsigned char color_0_green,
|
||||
unsigned char color_0_blue,
|
||||
unsigned char color_1_red,
|
||||
unsigned char color_1_green,
|
||||
unsigned char color_1_blue,
|
||||
unsigned char color_2_red,
|
||||
unsigned char color_2_green,
|
||||
unsigned char color_2_blue,
|
||||
unsigned short temperature_0,
|
||||
unsigned short temperature_1,
|
||||
unsigned short temperature_2
|
||||
);
|
||||
|
||||
void SendTemperature();
|
||||
|
||||
void SendReset
|
||||
(
|
||||
unsigned char channel
|
||||
);
|
||||
|
||||
void SendPortState
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char state
|
||||
);
|
||||
|
||||
void SendBrightness();
|
||||
|
||||
void SendLEDCount();
|
||||
|
||||
void SendProtocol();
|
||||
};
|
||||
Reference in New Issue
Block a user