Move RGBController files for device controllers into the Controllers directory

This commit is contained in:
Adam Honse 2020-09-29 20:54:04 +00:00
parent 278d6b0d00
commit f3ccaf1a2b
130 changed files with 543 additions and 537 deletions

View file

@ -1,515 +0,0 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_Dummy.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <fstream>
#include <iostream>
#include <string>
#ifndef WIN32
#include <unistd.h>
#include <dirent.h>
#else
#include <windows.h>
#endif
#ifndef WIN32
#define LPSTR char *
#define strtok_s strtok_r
#endif
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int debug_keyboard_matrix_map[6][23] =
{ { 0, NA, 16, 30, 44, 54, NA, 65, 75, 84, 95, NA, 8, 23 , 38, 6 , 22, 36, 49, NA, NA, NA, NA },
{ 1, 17, 31, 45, 55, 66, 76, 85, 96, 9, 24, NA, 39, 7 , 37, NA , 60, 70, 80, 52, 63, 73, 82 },
{ 2, NA, 18, 32, 46, 56, NA, 67, 77, 86, 97, 10, 25, 40 , 90, 101, 50, 61, 71, 51, 62, 72, 93 },
{ 3, NA, 19, 33, 47, 57, NA, 68, 78, 87, 98, 11, 26, 41 , 28, 14 , NA, NA, NA, 92, 103, 53, NA },
{ 4, 20, 34, 48, 58, 69, NA, 79, NA, 88, 99, 12, 27, 42 , 81, NA , NA, 102, NA, 64, 74, 83, 104 },
{ 5, 21, 35, NA, NA, NA, NA, 59, NA, NA, NA, NA, 89, 100, 13, 91 , 15, 29, 43, 94, NA, 105, NA } };
static const char *led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Key: F12",
"Key: =",
"Key: F9",
"Key: 9",
"Key: O",
"Key: L",
"Key: ,",
"Key: Menu",
"Key: Enter (ISO)",
"Key: Left Arrow",
"Key: F1",
"Key: 1",
"Key: Q",
"Key: A",
"Key: \\ (ISO)",
"Key: Left Windows",
"Key: Print Screen",
"Key: F10",
"Key: 0",
"Key: P",
"Key: ;",
"Key: .",
"Key: Enter",
"Key: Down Arrow",
"Key: F2",
"Key: 2",
"Key: W",
"Key: S",
"Key: Z",
"Key: Left Alt",
"Key: Scroll Lock",
"Key: Backspace",
"Key: F11",
"Key: -",
"Key: [",
"Key: '",
"Key: /",
"Key: Right Arrow",
"Key: F3",
"Key: 3",
"Key: E",
"Key: D",
"Key: X",
"Key: Pause/Break",
"Key: Delete",
"Key: Number Pad 7",
"Key: Num Lock",
"Key: Number Pad 6",
"Key: F4",
"Key: 4",
"Key: R",
"Key: F",
"Key: C",
"Key: Space",
"Key: Insert",
"Key: End",
"Key: Number Pad 8",
"Key: Number Pad /",
"Key: Number Pad 1",
"Key: F5",
"Key: 5",
"Key: T",
"Key: G",
"Key: V",
"Key: Home",
"Key: Page Down",
"Key: Number Pad 9",
"Key: Number Pad *",
"Key: Number Pad 2",
"Key: F6",
"Key: 6",
"Key: Y",
"Key: H",
"Key: B",
"Key: Page Up",
"Key: Right Shift",
"Key: Number Pad -",
"Key: Number Pad 3",
"Key: F7",
"Key: 7",
"Key: U",
"Key: J",
"Key: N",
"Key: Right Alt",
"Key: ]",
"Key: Right Control",
"Key: Number Pad 4",
"Key: Number Pad +",
"Key: Number Pad 0",
"Key: F8",
"Key: 8",
"Key: I",
"Key: K",
"Key: M",
"Key: Right Windows",
"Key: \\ (ANSI)",
"Key: Up Arrow",
"Key: Number Pad 5",
"Key: Number Pad Enter",
"Key: Number Pad .",
"RGB Strip 1",
"RGB Strip 2",
"RGB Strip 3",
"RGB Strip 4",
"RGB Strip 5",
"RGB Strip 6",
"RGB Strip 7",
"RGB Strip 8",
"RGB Strip 9",
"RGB Strip 10",
"RGB Strip 11",
"RGB Strip 12",
"RGB Strip 13",
"RGB Strip 14",
"RGB Strip 15",
"RGB Strip 16",
"RGB Strip 17",
"RGB Strip 18",
"Key: Media Previous",
"Key: Media Play/Pause",
"Key: Media Next",
"Key: Media Mute"
};
/******************************************************************************************\
* *
* DetectDebugControllers *
* *
* Add dummy controllers based on debug.txt *
* *
\******************************************************************************************/
void DetectDebugControllers(std::vector<RGBController*> &rgb_controllers)
{
std::ifstream infile;
//Open settings file
infile.open("debug.txt");
if (infile.good())
{
for (std::string line; std::getline(infile, line); )
{
if (line == "")
{
continue;
}
if ((line[0] != ';') && (line[0] != '#') && (line[0] != '/'))
{
char * argument;
char * value;
value = (char *)line.c_str();
argument = strtok_s(value, "=", &value);
//Strip off new line characters if present
argument = strtok(argument, "\r\n");
value = strtok(value, "\r\n");
if(argument)
{
if (strcmp(argument, "debug_motherboard") == 0)
{
/*---------------------------------------------------------*\
| Create a dummy motherboard |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_motherboard = new RGBController_Dummy();
dummy_motherboard->name = "Debug Motherboard";
dummy_motherboard->type = DEVICE_TYPE_MOTHERBOARD;
dummy_motherboard->description = "Debug Motherboard Device";
dummy_motherboard->location = "Debug Motherboard Location";
dummy_motherboard->version = "Debug Motherboard Version";
dummy_motherboard->serial = "Debug Motherboard Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy motherboard |
\*---------------------------------------------------------*/
mode dummy_motherboard_direct_mode;
dummy_motherboard_direct_mode.name = "Direct";
dummy_motherboard_direct_mode.value = 0;
dummy_motherboard_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_motherboard_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_motherboard->modes.push_back(dummy_motherboard_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy motherboard |
\*---------------------------------------------------------*/
zone dummy_motherboard_single_zone;
dummy_motherboard_single_zone.name = "Single Zone";
dummy_motherboard_single_zone.type = ZONE_TYPE_SINGLE;
dummy_motherboard_single_zone.leds_min = 1;
dummy_motherboard_single_zone.leds_max = 1;
dummy_motherboard_single_zone.leds_count = 1;
dummy_motherboard_single_zone.matrix_map = NULL;
dummy_motherboard->zones.push_back(dummy_motherboard_single_zone);
led dummy_motherboard_single_led;
dummy_motherboard_single_led.name = "Single LED";
dummy_motherboard->leds.push_back(dummy_motherboard_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy motherboard |
\*---------------------------------------------------------*/
zone dummy_motherboard_linear_zone;
dummy_motherboard_linear_zone.name = "Linear Zone";
dummy_motherboard_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_motherboard_linear_zone.leds_min = 10;
dummy_motherboard_linear_zone.leds_max = 10;
dummy_motherboard_linear_zone.leds_count = 10;
dummy_motherboard_linear_zone.matrix_map = NULL;
dummy_motherboard->zones.push_back(dummy_motherboard_linear_zone);
for(std::size_t led_idx = 0; led_idx < 10; led_idx++)
{
led dummy_motherboard_linear_led;
dummy_motherboard_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_motherboard->leds.push_back(dummy_motherboard_linear_led);
}
dummy_motherboard->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy motherboard onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_motherboard);
}
else if(strcmp(argument, "debug_dram") == 0)
{
/*---------------------------------------------------------*\
| Create a dummy DRAM |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_dram = new RGBController_Dummy();
dummy_dram->name = "Debug DRAM";
dummy_dram->type = DEVICE_TYPE_DRAM;
dummy_dram->description = "Debug DRAM Device";
dummy_dram->location = "Debug DRAM Location";
dummy_dram->version = "Debug DRAM Version";
dummy_dram->serial = "Debug DRAM Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy DRAM |
\*---------------------------------------------------------*/
mode dummy_dram_direct_mode;
dummy_dram_direct_mode.name = "Direct";
dummy_dram_direct_mode.value = 0;
dummy_dram_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_dram_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_dram->modes.push_back(dummy_dram_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy DRAM |
\*---------------------------------------------------------*/
zone dummy_dram_single_zone;
dummy_dram_single_zone.name = "Single Zone";
dummy_dram_single_zone.type = ZONE_TYPE_SINGLE;
dummy_dram_single_zone.leds_min = 1;
dummy_dram_single_zone.leds_max = 1;
dummy_dram_single_zone.leds_count = 1;
dummy_dram_single_zone.matrix_map = NULL;
dummy_dram->zones.push_back(dummy_dram_single_zone);
led dummy_dram_single_led;
dummy_dram_single_led.name = "Single LED";
dummy_dram->leds.push_back(dummy_dram_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy DRAM |
\*---------------------------------------------------------*/
zone dummy_dram_linear_zone;
dummy_dram_linear_zone.name = "Linear Zone";
dummy_dram_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_dram_linear_zone.leds_min = 5;
dummy_dram_linear_zone.leds_max = 5;
dummy_dram_linear_zone.leds_count = 5;
dummy_dram_linear_zone.matrix_map = NULL;
dummy_dram->zones.push_back(dummy_dram_linear_zone);
for(std::size_t led_idx = 0; led_idx < 5; led_idx++)
{
led dummy_dram_linear_led;
dummy_dram_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_dram->leds.push_back(dummy_dram_linear_led);
}
dummy_dram->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy DRAM onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_dram);
}
else if(strcmp(argument, "debug_gpu") == 0)
{
/*---------------------------------------------------------*\
| Create a dummy GPU |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_gpu = new RGBController_Dummy();
dummy_gpu->name = "Debug GPU";
dummy_gpu->type = DEVICE_TYPE_GPU;
dummy_gpu->description = "Debug GPU Device";
dummy_gpu->location = "Debug GPU Location";
dummy_gpu->version = "Debug GPU Version";
dummy_gpu->serial = "Debug GPU Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy GPU |
\*---------------------------------------------------------*/
mode dummy_gpu_direct_mode;
dummy_gpu_direct_mode.name = "Direct";
dummy_gpu_direct_mode.value = 0;
dummy_gpu_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_gpu_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_gpu->modes.push_back(dummy_gpu_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_gpu_single_zone;
dummy_gpu_single_zone.name = "Single Zone";
dummy_gpu_single_zone.type = ZONE_TYPE_SINGLE;
dummy_gpu_single_zone.leds_min = 1;
dummy_gpu_single_zone.leds_max = 1;
dummy_gpu_single_zone.leds_count = 1;
dummy_gpu_single_zone.matrix_map = NULL;
dummy_gpu->zones.push_back(dummy_gpu_single_zone);
led dummy_gpu_single_led;
dummy_gpu_single_led.name = "Single LED";
dummy_gpu->leds.push_back(dummy_gpu_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_gpu_linear_zone;
dummy_gpu_linear_zone.name = "Linear Zone";
dummy_gpu_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_gpu_linear_zone.leds_min = 15;
dummy_gpu_linear_zone.leds_max = 15;
dummy_gpu_linear_zone.leds_count = 15;
dummy_gpu_linear_zone.matrix_map = NULL;
dummy_gpu->zones.push_back(dummy_gpu_linear_zone);
for(std::size_t led_idx = 0; led_idx < 15; led_idx++)
{
led dummy_gpu_linear_led;
dummy_gpu_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_gpu->leds.push_back(dummy_gpu_linear_led);
}
dummy_gpu->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy GPU onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_gpu);
}
else if(strcmp(argument, "debug_keyboard") == 0)
{
/*---------------------------------------------------------*\
| Create a dummy Keyboard |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_keyboard = new RGBController_Dummy();
dummy_keyboard->name = "Debug Keyboard";
dummy_keyboard->type = DEVICE_TYPE_KEYBOARD;
dummy_keyboard->description = "Debug Keyboard Device";
dummy_keyboard->location = "Debug Keyboard Location";
dummy_keyboard->version = "Debug Keyboard Version";
dummy_keyboard->serial = "Debug Keyboard Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy GPU |
\*---------------------------------------------------------*/
mode dummy_gpu_direct_mode;
dummy_gpu_direct_mode.name = "Direct";
dummy_gpu_direct_mode.value = 0;
dummy_gpu_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_gpu_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_keyboard->modes.push_back(dummy_gpu_direct_mode);
/*---------------------------------------------------------*\
| Create a matrix zone for the debug Keyboard |
\*---------------------------------------------------------*/
zone dummy_keyboard_matrix_zone;
dummy_keyboard_matrix_zone.name = "Keyboard Matrix Zone";
dummy_keyboard_matrix_zone.type = ZONE_TYPE_MATRIX;
dummy_keyboard_matrix_zone.leds_min = 106;
dummy_keyboard_matrix_zone.leds_max = 106;
dummy_keyboard_matrix_zone.leds_count = 106;
dummy_keyboard_matrix_zone.matrix_map = new matrix_map_type;
dummy_keyboard_matrix_zone.matrix_map->height = 6;
dummy_keyboard_matrix_zone.matrix_map->width = 23;
dummy_keyboard_matrix_zone.matrix_map->map = (unsigned int*)&debug_keyboard_matrix_map;
dummy_keyboard->zones.push_back(dummy_keyboard_matrix_zone);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_keyboard_linear_zone;
dummy_keyboard_linear_zone.name = "Linear Zone";
dummy_keyboard_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_keyboard_linear_zone.leds_min = 18;
dummy_keyboard_linear_zone.leds_max = 18;
dummy_keyboard_linear_zone.leds_count = 18;
dummy_keyboard_linear_zone.matrix_map = NULL;
dummy_keyboard->zones.push_back(dummy_keyboard_linear_zone);
for(std::size_t led_idx = 0; led_idx < 124; led_idx++)
{
led dummy_keyboard_led;
dummy_keyboard_led.name = led_names[led_idx];
dummy_keyboard->leds.push_back(dummy_keyboard_led);
}
dummy_keyboard->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy Keyboard onto the controller list |
\*---------------------------------------------------------*/
ResourceManager::get()->RegisterRGBController(dummy_keyboard);
}
}
}
}
}
} /* DetectDebugControllers() */
REGISTER_DETECTOR("Debug Controllers", DetectDebugControllers);

View file

@ -1,223 +0,0 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_E131.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <fstream>
#include <iostream>
#include <string>
#ifndef WIN32
#include <unistd.h>
#include <dirent.h>
#else
#include <windows.h>
#endif
#ifndef WIN32
#define LPSTR char *
#define strtok_s strtok_r
#endif
/******************************************************************************************\
* *
* DetectE131Controllers *
* *
* Detect devices supported by the E131 driver *
* * *
\******************************************************************************************/
void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
{
RGBController_E131* new_controller;
std::ifstream infile;
char arg1[64];
E131Device dev;
std::vector<E131Device> devices;
bool new_device = false;
//Clear E131 device data
dev.name = "";
dev.type = ZONE_TYPE_SINGLE;
dev.num_leds = 0;
dev.rgb_order = E131_RGB_ORDER_RBG;
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT;
dev.matrix_width = 0;
dev.matrix_height = 0;
//Open settings file
infile.open("e131.txt");
if (infile.good())
{
for (std::string line; std::getline(infile, line); )
{
if (new_device)
{
dev.name = line;
new_device = false;
continue;
}
if (line == "")
{
continue;
}
if ((line[0] != ';') && (line[0] != '#') && (line[0] != '/'))
{
char * argument;
char * value;
value = (char *)line.c_str();
argument = strtok_s(value, "=", &value);
//Strip off new line characters if present
argument = strtok(argument, "\r\n");
value = strtok(value, "\r\n");
if(argument)
{
if (strcmp(argument, "e131_device_start") == 0)
{
new_device = true;
}
else if(strcmp(argument, "num_leds") == 0)
{
dev.num_leds = atoi(value);
}
else if(strcmp(argument, "start_universe") == 0)
{
dev.start_universe = atoi(value);
}
else if(strcmp(argument, "start_channel") == 0)
{
dev.start_channel = atoi(value);
}
else if(strcmp(argument, "keepalive_time") == 0)
{
dev.keepalive_time = atoi(value);
}
else if(strcmp(argument, "rgb_order") == 0)
{
if(strcmp(value, "RGB") == 0)
{
dev.rgb_order = E131_RGB_ORDER_RGB;
}
else if(strcmp(value, "RBG") == 0)
{
dev.rgb_order = E131_RGB_ORDER_RBG;
}
else if(strcmp(value, "GRB") == 0)
{
dev.rgb_order = E131_RGB_ORDER_GRB;
}
else if(strcmp(value, "GBR") == 0)
{
dev.rgb_order = E131_RGB_ORDER_GBR;
}
else if(strcmp(value, "BRG") == 0)
{
dev.rgb_order = E131_RGB_ORDER_BRG;
}
else if(strcmp(value, "BGR") == 0)
{
dev.rgb_order = E131_RGB_ORDER_BGR;
}
else
{
dev.rgb_order = atoi(value);
}
}
else if(strcmp(argument, "matrix_order") == 0)
{
if(strcmp(value, "HORIZONTAL_TOP_LEFT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT;
}
else if(strcmp(value, "HORIZONTAL_TOP_RIGHT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT;
}
else if(strcmp(value, "HORIZONTAL_BOTTOM_LEFT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT;
}
else if(strcmp(value, "HORIZONTAL_BOTTOM_RIGHT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT;
}
else if(strcmp(value, "VERTICAL_TOP_LEFT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_TOP_LEFT;
}
else if(strcmp(value, "VERTICAL_TOP_RIGHT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT;
}
else if(strcmp(value, "VERTICAL_BOTTOM_LEFT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT;
}
else if(strcmp(value, "VERTICAL_BOTTOM_RIGHT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT;
}
else
{
dev.matrix_order = atoi(value);
}
}
else if(strcmp(argument, "matrix_width") == 0)
{
dev.matrix_width = atoi(value);
}
else if(strcmp(argument, "matrix_height") == 0)
{
dev.matrix_height = atoi(value);
}
else if(strcmp(argument, "type") == 0)
{
if(strcmp(value, "SINGLE") == 0)
{
dev.type = ZONE_TYPE_SINGLE;
}
else if(strcmp(value, "LINEAR") == 0)
{
dev.type = ZONE_TYPE_LINEAR;
}
else if(strcmp(value, "MATRIX") == 0)
{
dev.type = ZONE_TYPE_MATRIX;
}
else
{
dev.type = atoi(value);
}
}
else if(strcmp(argument, "e131_device_end") == 0)
{
devices.push_back(dev);
}
}
}
}
if(devices.size() > 0)
{
new_controller = new RGBController_E131(devices);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectE131Controllers() */
REGISTER_DETECTOR("E1.31", DetectE131Controllers);

View file

@ -1,126 +0,0 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_OpenRazer.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>
/******************************************************************************************\
* *
* DetectOpenRazerControllers *
* *
* Detect devices supported by the OpenRazer kernel drivers *
* *
\******************************************************************************************/
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
{
char driver_path[512];
DIR *dir;
struct dirent *ent;
bool done = false;
int driver_to_read = 0;
while(driver_to_read < 8)
{
switch(driver_to_read)
{
case 0:
strcpy(driver_path, "/sys/bus/hid/drivers/razerkbd/");
break;
case 1:
strcpy(driver_path, "/sys/bus/hid/drivers/razermouse/");
break;
case 2:
strcpy(driver_path, "/sys/bus/hid/drivers/razerfirefly/");
break;
case 3:
strcpy(driver_path, "/sys/bus/hid/drivers/razermug/");
break;
case 4:
strcpy(driver_path, "/sys/bus/hid/drivers/razercore/");
break;
case 5:
strcpy(driver_path, "/sys/bus/hid/drivers/razerkraken/");
break;
case 6:
strcpy(driver_path, "/sys/bus/hid/drivers/razermousemat/");
break;
case 7:
strcpy(driver_path, "/sys/bus/hid/drivers/razeraccessory/");
break;
}
done = false;
dir = opendir(driver_path);
if(dir == NULL)
{
driver_to_read++;
continue;
}
ent = readdir(dir);
while(ent != NULL)
{
if(ent->d_type == DT_DIR || ent->d_type == DT_LNK)
{
if(!strcmp(ent->d_name, "."))
{
if(done == false)
{
done = true;
}
else
{
break;
}
}
else if(!strcmp(ent->d_name, "..") || !strcmp(ent->d_name, "module"))
{
}
else
{
char device_string[1024];
strcpy(device_string, driver_path);
strcat(device_string, ent->d_name);
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(device_string);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
}
ent = readdir(dir);
}
closedir(dir);
driver_to_read++;
}
} /* DetectOpenRazerControllers() */
REGISTER_DETECTOR("OpenRazer", DetectOpenRazerControllers);

File diff suppressed because it is too large Load diff

View file

@ -1,255 +0,0 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_OpenRazerWindows.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hid.h>
#ifdef _WIN64
#define OPENRAZERDLL "OpenRazer64.dll"
#elif WIN32
#define OPENRAZERDLL "OpenRazer.dll"
#endif
typedef struct
{
struct device_attribute* dev_attr_list[44];
} device_fn_list_type;
/*---------------------------------------------------------*\
| This is a table of device attribute names. It should |
| always match the order of the entries in the structure |
\*---------------------------------------------------------*/
static const char* device_fn_names[] =
{
"device_type",
"device_serial",
"firmware_version",
"matrix_custom_frame",
"matrix_brightness",
"matrix_effect_custom",
"matrix_effect_none",
"matrix_effect_static",
"matrix_effect_breath",
"matrix_effect_spectrum",
"matrix_effect_reactive",
"matrix_effect_wave",
"logo_led_brightness",
"logo_matrix_effect_none",
"logo_matrix_effect_static",
"logo_matrix_effect_breath",
"logo_matrix_effect_spectrum",
"logo_matrix_effect_reactive",
"scroll_led_brightness",
"scroll_matrix_effect_none",
"scroll_matrix_effect_static",
"scroll_matrix_effect_breath",
"scroll_matrix_effect_spectrum",
"scroll_matrix_effect_reactive",
"left_led_brightness",
"left_matrix_effect_none",
"left_matrix_effect_static",
"left_matrix_effect_breath",
"left_matrix_effect_spectrum",
"left_matrix_effect_reactive",
"left_matrix_effect_wave",
"right_led_brightness",
"right_matrix_effect_none",
"right_matrix_effect_static",
"right_matrix_effect_breath",
"right_matrix_effect_spectrum",
"right_matrix_effect_reactive",
"right_matrix_effect_wave",
"logo_led_effect",
"logo_led_rgb",
"logo_led_state",
"scroll_led_effect",
"scroll_led_rgb",
"scroll_led_state"
};
/*---------------------------------------------------------*\
| This function searches the device attribute list of a |
| given device to fill in a device_fn_type structure |
\*---------------------------------------------------------*/
static void load_device_fn(device_fn_type* device_fn, device* dev)
{
memset(device_fn, 0, sizeof(device_fn_type));
for (int table_idx = 0; table_idx < 44; table_idx++)
{
for (int list_idx = 0; list_idx < dev->attr_count; list_idx++)
{
if (strcmp(device_fn_names[table_idx], dev->attr_list[list_idx]->name) == 0)
{
((device_fn_list_type*)device_fn)->dev_attr_list[table_idx] = dev->attr_list[list_idx];
}
}
}
}
/******************************************************************************************\
* *
* DetectOpenRazerControllers *
* *
* Detect devices supported by the OpenRazer kernel drivers *
* *
\******************************************************************************************/
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
{
static HMODULE module = LoadLibrary(OPENRAZERDLL);
if(module == nullptr)
{
return;
}
/*---------------------------------------------------------*\
| Map DLL functions |
\*---------------------------------------------------------*/
typedef unsigned int(*INITRAZERDRIVER)(struct hid_device** hdev);
INITRAZERDRIVER init_razer_kbd_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_kbd_driver"));
INITRAZERDRIVER init_razer_mousemat_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_mousemat_driver"));
INITRAZERDRIVER init_razer_mouse_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_mouse_driver"));
INITRAZERDRIVER init_razer_accessory_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_accessory_driver"));
INITRAZERDRIVER init_razer_kraken_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_kraken_driver"));
INITRAZERDRIVER init_razer_core_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_core_driver"));
/*---------------------------------------------------------*\
| Initialize all OpenRazer driver modules and store devices |
\*---------------------------------------------------------*/
struct hid_device* hdev;
unsigned int num;
hdev = NULL;
num = init_razer_kbd_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_mouse_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_mousemat_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_accessory_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_kraken_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_core_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
} /* DetectOpenRazerControllers() */
REGISTER_DETECTOR("OpenRazer-Win32", DetectOpenRazerControllers);

View file

@ -1,237 +0,0 @@
/*-----------------------------------------*\
| RGBController_AMDWraithPrism.cpp |
| |
| Generic RGB Interface for AMD Wraith |
| Prism |
| |
| Adam Honse (CalcProgrammer1) 12/25/2019 |
\*-----------------------------------------*/
#include "RGBController_AMDWraithPrism.h"
RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismController* wraith_ptr)
{
wraith = wraith_ptr;
name = "AMD Wraith Prism";
type = DEVICE_TYPE_COOLER;
description = "AMD Wraith Prism Device";
version = wraith->GetFirmwareVersionString();
mode Direct;
Direct.name = "Direct";
Direct.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Breathing.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Breathing.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Breathing);
mode ColorCycle;
ColorCycle.name = "Color Cycle";
ColorCycle.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE;
ColorCycle.flags = MODE_FLAG_HAS_SPEED;
ColorCycle.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
ColorCycle.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
ColorCycle.color_mode = MODE_COLORS_NONE;
ColorCycle.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(ColorCycle);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Rainbow.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Rainbow);
mode Bounce;
Bounce.name = "Bounce";
Bounce.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE;
Bounce.flags = MODE_FLAG_HAS_SPEED;
Bounce.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Bounce.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Bounce.color_mode = MODE_COLORS_NONE;
Bounce.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Bounce);
mode Chase;
Chase.name = "Chase";
Chase.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_CHASE;
Chase.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Chase.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Chase.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Chase.color_mode = MODE_COLORS_PER_LED;
Chase.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Chase);
mode Swirl;
Swirl.name = "Swirl";
Swirl.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_SWIRL;
Swirl.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Swirl.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Swirl.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Swirl.color_mode = MODE_COLORS_PER_LED;
Swirl.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Swirl);
SetupZones();
}
RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
{
}
void RGBController_AMDWraithPrism::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
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);
zone fan_zone;
fan_zone.name = "Fan";
fan_zone.type = ZONE_TYPE_SINGLE;
fan_zone.leds_min = 1;
fan_zone.leds_max = 1;
fan_zone.leds_count = 1;
fan_zone.matrix_map = NULL;
zones.push_back(fan_zone);
zone ring_zone;
ring_zone.name = "Ring";
ring_zone.type = ZONE_TYPE_SINGLE;
ring_zone.leds_min = 1;
ring_zone.leds_max = 1;
ring_zone.leds_count = 1;
ring_zone.matrix_map = NULL;
zones.push_back(ring_zone);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
led logo_led;
logo_led.name = "Logo LED";
leds.push_back(logo_led);
led fan_led;
fan_led.name = "Fan LED";
leds.push_back(fan_led);
led ring_led;
ring_led.name = "Ring LED";
leds.push_back(ring_led);
SetupColors();
}
void RGBController_AMDWraithPrism::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AMDWraithPrism::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
wraith->SetLogoColor(red, grn, blu);
red = RGBGetRValue(colors[1]);
grn = RGBGetGValue(colors[1]);
blu = RGBGetBValue(colors[1]);
wraith->SetFanColor(red, grn, blu);
red = RGBGetRValue(colors[2]);
grn = RGBGetGValue(colors[2]);
blu = RGBGetBValue(colors[2]);
wraith->SetRingColor(red, grn, blu);
}
void RGBController_AMDWraithPrism::UpdateZoneLEDs(int zone)
{
RGBColor color = colors[zone];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if(zone == 0)
{
wraith->SetLogoColor(red, grn, blu);
}
else if(zone == 1)
{
wraith->SetFanColor(red, grn, blu);
}
else if(zone == 2)
{
wraith->SetRingColor(red, grn, blu);
}
}
void RGBController_AMDWraithPrism::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_AMDWraithPrism::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AMDWraithPrism::DeviceUpdateMode()
{
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
wraith->SetRingMode(modes[active_mode].value, modes[active_mode].speed, modes[active_mode].direction, random);
switch(modes[active_mode].value)
{
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE:
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW:
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE:
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, random);
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, random);
break;
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING:
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[active_mode].speed, random);
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[active_mode].speed, random);
break;
default:
if(random)
{
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, random);
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, random);
}
else
{
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[active_mode].speed, random);
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[active_mode].speed, random);
}
break;
}
DeviceUpdateLEDs();
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_AMDWraithPrism.h |
| |
| Generic RGB Interface for AMD Wraith |
| Prism |
| |
| Adam Honse (CalcProgrammer1) 12/25/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AMDWraithPrismController.h"
class RGBController_AMDWraithPrism : public RGBController
{
public:
RGBController_AMDWraithPrism(AMDWraithPrismController* wraith_ptr);
~RGBController_AMDWraithPrism();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
AMDWraithPrismController* wraith;
};

View file

@ -1,142 +0,0 @@
/*-----------------------------------------*\
| RGBController_AorusATC800.cpp |
| |
| Generic RGB Interface Aorus ATC800 CPU |
| Cooler |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#include "RGBController_AorusATC800.h"
RGBController_AorusATC800::RGBController_AorusATC800(ATC800Controller* cooler_ptr)
{
cooler = cooler_ptr;
name = "Aorus ATC800 CPU Cooler";
type = DEVICE_TYPE_COOLER;
description = "Aorus ATC800 CPU Cooler";
mode Static;
Static.name = "Static";
Static.value = AORUS_ATC800_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = AORUS_ATC800_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = AORUS_ATC800_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Flashing.color_mode = MODE_COLORS_PER_LED;
Flashing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
Flashing.speed_max = AORUS_ATC800_SPEED_FASTEST;
Flashing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(Flashing);
mode DoubleFlashing;
DoubleFlashing.name = "Double Flashing";
DoubleFlashing.value = AORUS_ATC800_MODE_DOUBLE_FLASH;
DoubleFlashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
DoubleFlashing.color_mode = MODE_COLORS_PER_LED;
DoubleFlashing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
DoubleFlashing.speed_max = AORUS_ATC800_SPEED_FASTEST;
DoubleFlashing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(DoubleFlashing);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = AORUS_ATC800_MODE_PULSE;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Pulsing.color_mode = MODE_COLORS_PER_LED;
Pulsing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
Pulsing.speed_max = AORUS_ATC800_SPEED_FASTEST;
Pulsing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(Pulsing);
SetupZones();
}
void RGBController_AorusATC800::SetupZones()
{
zone atc800_cpu_fans_zone;
atc800_cpu_fans_zone.name = "Fan";
atc800_cpu_fans_zone.type = ZONE_TYPE_SINGLE;
atc800_cpu_fans_zone.leds_min = 1;
atc800_cpu_fans_zone.leds_max = 1;
atc800_cpu_fans_zone.leds_count = 1;
atc800_cpu_fans_zone.matrix_map = NULL;
zones.push_back(atc800_cpu_fans_zone);
led atc800_fan_led;
atc800_fan_led.name = "Fan";
leds.push_back(atc800_fan_led);
zone atc800_top_zone;
atc800_top_zone.name = "Top";
atc800_top_zone.type = ZONE_TYPE_SINGLE;
atc800_top_zone.leds_min = 1;
atc800_top_zone.leds_max = 1;
atc800_top_zone.leds_count = 1;
atc800_top_zone.matrix_map = NULL;
zones.push_back(atc800_top_zone);
led atc800_top_led;
atc800_top_led.name = "Top";
leds.push_back(atc800_top_led);
SetupColors();
}
void RGBController_AorusATC800::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AorusATC800::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_AorusATC800::UpdateZoneLEDs(int zone)
{
unsigned char mode = modes[active_mode].value;
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
if (mode == AORUS_ATC800_MODE_OFF)
{
mode = 1;
red = 0;
grn = 0;
blu = 0;
}
cooler->SendCoolerMode(mode, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_AorusATC800::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_AorusATC800::SetCustomMode()
{
}
void RGBController_AorusATC800::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,32 +0,0 @@
/*-----------------------------------------*\
| RGBController_AorusATC800.h |
| |
| Generic RGB Interface for Aorus ATC 800 |
| CPU Cooler |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "ATC800Controller.h"
class RGBController_AorusATC800 : public RGBController
{
public:
RGBController_AorusATC800(ATC800Controller* logitech_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:
ATC800Controller* cooler;
};

View file

@ -1,108 +0,0 @@
/*-----------------------------------------*\
| RGBController_AuraCore.cpp |
| |
| Generic RGB Interface for ROG Aura Core |
| |
| Adam Honse (CalcProgrammer1) 4/17/2020 |
\*-----------------------------------------*/
#include "RGBController_AuraCore.h"
RGBController_AuraCore::RGBController_AuraCore(AuraCoreController* aura_ptr)
{
aura = aura_ptr;
name = "ASUS Aura Core";
type = DEVICE_TYPE_KEYBOARD;
description = "ASUS Aura Core Device";
mode Static;
Static.name = "Static";
Static.value = AURA_CORE_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_CORE_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode ColorCycle;
ColorCycle.name = "Color Cycle";
ColorCycle.value = AURA_CORE_MODE_SPECTRUM_CYCLE;
ColorCycle.flags = 0;
ColorCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(ColorCycle);
SetupZones();
}
void RGBController_AuraCore::SetupZones()
{
zone Keyboard;
Keyboard.name = "Keyboard";
Keyboard.type = ZONE_TYPE_SINGLE;
Keyboard.leds_min = 4;
Keyboard.leds_max = 4;
Keyboard.leds_count = 4;
Keyboard.matrix_map = NULL;
zones.push_back(Keyboard);
for(unsigned int led_idx = 0; led_idx < Keyboard.leds_count; led_idx++)
{
led KeyLED;
KeyLED.name = "Keyboard LED ";
KeyLED.name.append(std::to_string(led_idx + 1));
leds.push_back(KeyLED);
}
SetupColors();
}
void RGBController_AuraCore::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AuraCore::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
}
void RGBController_AuraCore::UpdateZoneLEDs(int /*zone*/)
{
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
{
UpdateSingleLED(led_idx);
}
}
void RGBController_AuraCore::UpdateSingleLED(int led)
{
aura->SendUpdate
(
led + 1,
modes[active_mode].value,
AURA_CORE_SPEED_NORMAL,
RGBGetRValue(colors[led]),
RGBGetGValue(colors[led]),
RGBGetBValue(colors[led])
);
aura->SendSet();
aura->SendApply();
}
void RGBController_AuraCore::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AuraCore::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_AuraCore.h |
| |
| Generic RGB Interface for ROG Aura Core |
| |
| Adam Honse (CalcProgrammer1) 4/17/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AuraCoreController.h"
class RGBController_AuraCore : public RGBController
{
public:
RGBController_AuraCore(AuraCoreController* aura_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:
AuraCoreController* aura;
};

View file

@ -1,198 +0,0 @@
/*-----------------------------------------*\
| RGBController_AuraGPU.h |
| |
| Generic RGB Interface for Asus Aura GPU |
| |
| Jan Rettig (Klapstuhl) 14.02.2020 |
\*-----------------------------------------*/
#include "RGBController_AuraGPU.h"
int RGBController_AuraGPU::GetDeviceMode()
{
int dev_mode = aura_gpu->AuraGPURegisterRead(AURA_GPU_REG_MODE);
int color_mode = MODE_COLORS_PER_LED;
if(dev_mode == AURA_GPU_MODE_STATIC)
{
if (aura_gpu->direct)
{
dev_mode = AURA_GPU_MODE_DIRECT;
}
}
switch(dev_mode)
{
case AURA_GPU_MODE_OFF:
case AURA_GPU_MODE_SPECTRUM_CYCLE:
color_mode = MODE_COLORS_NONE;
break;
}
for(std::size_t mode = 0; mode < modes.size(); mode++)
{
if(modes[mode].value == dev_mode)
{
active_mode = mode;
modes[mode].color_mode = color_mode;
}
}
return(active_mode);
}
RGBController_AuraGPU::RGBController_AuraGPU(AuraGPUController * aura_gpu_ptr)
{
aura_gpu = aura_gpu_ptr;
name = aura_gpu->GetDeviceName();
type = DEVICE_TYPE_GPU;
description = "ASUS Aura GPU Device";
version = "0.00.1";
location = aura_gpu->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = AURA_GPU_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Off;
Off.name = "Off";
Off.value = AURA_GPU_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = AURA_GPU_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_GPU_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = AURA_GPU_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Flashing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Flashing);
mode Spectrum_Cycle;
Spectrum_Cycle.name = "Spectrum Cycle";
Spectrum_Cycle.value = AURA_GPU_MODE_SPECTRUM_CYCLE;
Spectrum_Cycle.flags = 0;
Spectrum_Cycle.color_mode = MODE_COLORS_NONE;
modes.push_back(Spectrum_Cycle);
SetupZones();
active_mode = GetDeviceMode();
}
void RGBController_AuraGPU::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zone aura_gpu_zone;
aura_gpu_zone.name = "GPU";
aura_gpu_zone.type = ZONE_TYPE_SINGLE;
aura_gpu_zone.leds_min = 1;
aura_gpu_zone.leds_max = 1;
aura_gpu_zone.leds_count = 1;
aura_gpu_zone.matrix_map = NULL;
zones.push_back(aura_gpu_zone);
/*---------------------------------------------------------*\
| Set up LED |
\*---------------------------------------------------------*/
led aura_gpu_led;
aura_gpu_led.name = "GPU";
leds.push_back(aura_gpu_led);
SetupColors();
/*---------------------------------------------------------*\
| Initialize color |
\*---------------------------------------------------------*/
unsigned char red = aura_gpu->GetLEDRed();
unsigned char grn = aura_gpu->GetLEDGreen();
unsigned char blu = aura_gpu->GetLEDBlue();
colors[0] = ToRGBColor(red, grn, blu);
}
void RGBController_AuraGPU::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AuraGPU::DeviceUpdateLEDs()
{
for(std::size_t led = 0; led < colors.size(); led++)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
if (GetMode() == 0)
{
aura_gpu->SetLEDColorsDirect(red, grn, blu);
}
else
{
aura_gpu->SetLEDColorsEffect(red, grn, blu);
}
}
}
void RGBController_AuraGPU::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_AuraGPU::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_AuraGPU::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AuraGPU::DeviceUpdateMode()
{
int new_mode = modes[active_mode].value;
aura_gpu->direct = false;
switch(new_mode)
{
// Set all LEDs to 0 and Mode to static as a workaround for the non existing Off Mode
case AURA_GPU_MODE_OFF:
aura_gpu->SetLEDColorsEffect(0, 0, 0);
new_mode = AURA_GPU_MODE_STATIC;
break;
// Direct mode is done by switching to Static and not applying color changes
case AURA_GPU_MODE_DIRECT:
aura_gpu->direct = true;
new_mode = AURA_GPU_MODE_STATIC;
break;
}
aura_gpu->SetMode(new_mode);
}

View file

@ -1,34 +0,0 @@
/*-----------------------------------------*\
| RGBController_AuraGPU.h |
| |
| Generic RGB Interface for Asus Aura GPU |
| |
| Jan Rettig (Klapstuhl) 14.02.2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AuraGPUController.h"
class RGBController_AuraGPU : public RGBController
{
public:
RGBController_AuraGPU(AuraGPUController* aura_gpu_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:
AuraGPUController* aura_gpu;
int GetDeviceMode();
};

View file

@ -1,367 +0,0 @@
/*-----------------------------------------*\
| RGBController_AuraSMBus.cpp |
| |
| Generic RGB Interface for OpenAuraSDK |
| Asus Aura SMBus driver |
| |
| Adam Honse (CalcProgrammer1) 6/13/2019 |
\*-----------------------------------------*/
#include "RGBController_AuraSMBus.h"
int RGBController_AuraSMBus::GetDeviceMode()
{
int dev_mode = aura->AuraRegisterRead(AURA_REG_MODE);
int color_mode = MODE_COLORS_PER_LED;
if (aura->AuraRegisterRead(AURA_REG_DIRECT))
{
dev_mode = 0xFFFF;
}
switch(dev_mode)
{
case AURA_MODE_OFF:
case AURA_MODE_RAINBOW:
case AURA_MODE_SPECTRUM_CYCLE:
case AURA_MODE_RANDOM_FLICKER:
color_mode = MODE_COLORS_NONE;
break;
case AURA_MODE_SPECTRUM_CYCLE_CHASE:
dev_mode = AURA_MODE_CHASE;
color_mode = MODE_COLORS_RANDOM;
break;
case AURA_MODE_SPECTRUM_CYCLE_BREATHING:
dev_mode = AURA_MODE_BREATHING;
color_mode = MODE_COLORS_RANDOM;
break;
case AURA_MODE_SPECTRUM_CYCLE_CHASE_FADE:
dev_mode = AURA_MODE_CHASE_FADE;
color_mode = MODE_COLORS_RANDOM;
break;
}
for(std::size_t mode = 0; mode < modes.size(); mode++)
{
if(modes[mode].value == dev_mode)
{
active_mode = mode;
modes[mode].color_mode = color_mode;
}
}
return(active_mode);
}
void RGBController_AuraSMBus::DeviceUpdateLEDs()
{
for(std::size_t led = 0; led < colors.size(); led++)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
if (GetMode() == 0)
{
aura->SetLEDColorDirect(led, red, grn, blu);
}
else
{
aura->SetLEDColorEffect(led, red, grn, blu);
}
}
}
void RGBController_AuraSMBus::UpdateZoneLEDs(int zone)
{
for (std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++)
{
int led = zones[zone].leds[led_idx].value;
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if (GetMode() == 0)
{
aura->SetLEDColorDirect(led, red, grn, blu);
}
else
{
aura->SetLEDColorEffect(led, red, grn, blu);
}
}
}
void RGBController_AuraSMBus::UpdateSingleLED(int led)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if (GetMode() == 0)
{
aura->SetLEDColorDirect(led, red, grn, blu);
}
else
{
aura->SetLEDColorEffect(led, red, grn, blu);
}
}
RGBController_AuraSMBus::RGBController_AuraSMBus(AuraSMBusController * aura_ptr)
{
aura = aura_ptr;
version = aura->GetDeviceName();
location = aura->GetDeviceLocation();
if((version.find("DIMM_LED") != std::string::npos) || (version.find("AUDA") != std::string::npos) )
{
type = DEVICE_TYPE_DRAM;
name = "ASUS Aura DRAM";
}
else
{
type = DEVICE_TYPE_MOTHERBOARD;
name = "ASUS Aura Motherboard";
}
description = "ASUS Aura SMBus Device";
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Off;
Off.name = "Off";
Off.value = AURA_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = AURA_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = AURA_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Flashing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Flashing);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = AURA_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = 0;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = AURA_MODE_RAINBOW;
Rainbow.flags = 0;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode ChaseFade;
ChaseFade.name = "Chase Fade";
ChaseFade.value = AURA_MODE_CHASE_FADE;
ChaseFade.flags = MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_PER_LED_COLOR;
ChaseFade.color_mode = MODE_COLORS_PER_LED;
modes.push_back(ChaseFade);
mode Chase;
Chase.name = "Chase";
Chase.value = AURA_MODE_CHASE;
Chase.flags = MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_PER_LED_COLOR;
Chase.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Chase);
mode RandomFlicker;
RandomFlicker.name = "Random Flicker";
RandomFlicker.value = AURA_MODE_RANDOM_FLICKER;
RandomFlicker.flags = 0;
RandomFlicker.color_mode = MODE_COLORS_NONE;
modes.push_back(RandomFlicker);
SetupZones();
// Initialize active mode
active_mode = GetDeviceMode();
}
RGBController_AuraSMBus::~RGBController_AuraSMBus()
{
delete aura;
}
void RGBController_AuraSMBus::SetupZones()
{
std::vector<int> aura_led_map;
/*---------------------------------------------------------*\
| Search through all LEDs and create zones for each channel |
| type |
\*---------------------------------------------------------*/
for (std::size_t led_idx = 0; led_idx < aura->GetLEDCount(); led_idx++)
{
bool matched = false;
/*---------------------------------------------------------*\
| Search through existing zones to make sure we don't |
| create a duplicate zone |
\*---------------------------------------------------------*/
for (std::size_t existing_zone_idx = 0; existing_zone_idx < zones.size(); existing_zone_idx++)
{
if (aura->GetChannelName(led_idx) == zones[existing_zone_idx].name)
{
matched = true;
}
}
/*---------------------------------------------------------*\
| If zone does not already exist, create it |
\*---------------------------------------------------------*/
if (matched == false)
{
zone* new_zone = new zone();
/*---------------------------------------------------------*\
| Set zone name to channel name |
\*---------------------------------------------------------*/
new_zone->name = aura->GetChannelName(led_idx);
new_zone->leds_count = 0;
/*---------------------------------------------------------*\
| Find all LEDs with this channel type and add them to zone |
\*---------------------------------------------------------*/
for (std::size_t zone_led_idx = 0; zone_led_idx < aura->GetLEDCount(); zone_led_idx++)
{
if (aura->GetChannelName(zone_led_idx) == new_zone->name)
{
new_zone->leds_count++;
aura_led_map.push_back(zone_led_idx);
}
}
/*---------------------------------------------------------*\
| Aura zones have fixed size, so set min and max to count |
\*---------------------------------------------------------*/
new_zone->leds_min = new_zone->leds_count;
new_zone->leds_max = new_zone->leds_count;
/*---------------------------------------------------------*\
| If this zone has more than one LED, mark it as linear type|
\*---------------------------------------------------------*/
if(new_zone->leds_count > 1)
{
new_zone->type = ZONE_TYPE_LINEAR;
}
else
{
new_zone->type = ZONE_TYPE_SINGLE;
}
new_zone->matrix_map = NULL;
/*---------------------------------------------------------*\
| Push new zone to zones vector |
\*---------------------------------------------------------*/
zones.push_back(*new_zone);
}
}
/*---------------------------------------------------------*\
| Create LED entries for each zone |
\*---------------------------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
{
led* new_led = new led();
new_led->name = zones[zone_idx].name + " LED ";
new_led->name.append(std::to_string(led_idx + 1));
new_led->value = aura_led_map[led_idx];
leds.push_back(*new_led);
}
}
SetupColors();
/*---------------------------------------------------------*\
| Initialize colors for each LED |
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
unsigned int led = leds[led_idx].value;
unsigned char red = aura->GetLEDRed(led);
unsigned char grn = aura->GetLEDGreen(led);
unsigned char blu = aura->GetLEDBlue(led);
colors[led_idx] = ToRGBColor(red, grn, blu);
}
}
void RGBController_AuraSMBus::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AuraSMBus::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AuraSMBus::DeviceUpdateMode()
{
if (modes[active_mode].value == 0xFFFF)
{
aura->SetDirect(true);
}
else
{
int new_mode = modes[active_mode].value;
if(modes[active_mode].color_mode == MODE_COLORS_RANDOM)
{
switch(new_mode)
{
case AURA_MODE_CHASE:
new_mode = AURA_MODE_SPECTRUM_CYCLE_CHASE;
break;
case AURA_MODE_BREATHING:
new_mode = AURA_MODE_SPECTRUM_CYCLE_BREATHING;
break;
case AURA_MODE_CHASE_FADE:
new_mode = AURA_MODE_SPECTRUM_CYCLE_CHASE_FADE;
break;
}
}
aura->SetMode(new_mode);
aura->SetDirect(false);
}
}

View file

@ -1,36 +0,0 @@
/*-----------------------------------------*\
| RGBController_AuraSMBus.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| Asus Aura SMBus driver |
| |
| Adam Honse (CalcProgrammer1) 6/13/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AuraSMBusController.h"
class RGBController_AuraSMBus : public RGBController
{
public:
RGBController_AuraSMBus(AuraSMBusController* aura_ptr);
~RGBController_AuraSMBus();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
AuraSMBusController* aura;
int GetDeviceMode();
};

View file

@ -1,236 +0,0 @@
/*-----------------------------------------*\
| RGBController_AuraUSB.cpp |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Adam Honse (CalcProgrammer1) 1/18/2020 |
\*-----------------------------------------*/
#include "RGBController_AuraUSB.h"
RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* aura_ptr)
{
aura = aura_ptr;
name = "ASUS Aura USB";
version = aura->GetDeviceName();
type = DEVICE_TYPE_MOTHERBOARD;
description = "ASUS Aura USB Device";
mode Direct;
Direct.name = "Direct";
Direct.value = AURA_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Off;
Off.name = "Off";
Off.value = AURA_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = AURA_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = AURA_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Flashing.colors_min = 1;
Flashing.colors_max = 1;
Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Flashing.colors.resize(1);
modes.push_back(Flashing);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = AURA_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = 0;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = AURA_MODE_RAINBOW;
Rainbow.flags = 0;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode ChaseFade;
ChaseFade.name = "Chase Fade";
ChaseFade.value = AURA_MODE_CHASE_FADE;
ChaseFade.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
ChaseFade.colors_min = 1;
ChaseFade.colors_max = 1;
ChaseFade.color_mode = MODE_COLORS_MODE_SPECIFIC;
ChaseFade.colors.resize(1);
modes.push_back(ChaseFade);
mode Chase;
Chase.name = "Chase";
Chase.value = AURA_MODE_CHASE;
Chase.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Chase.colors_min = 1;
Chase.colors_max = 1;
Chase.color_mode = MODE_COLORS_MODE_SPECIFIC;
Chase.colors.resize(1);
modes.push_back(Chase);
SetupZones();
}
RGBController_AuraUSB::~RGBController_AuraUSB()
{
}
void RGBController_AuraUSB::SetupZones()
{
/*-------------------------------------------------*\
| Only set LED count on the first run |
\*-------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = true;
}
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
leds.clear();
colors.clear();
zones.resize(aura->GetChannelCount());
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
int addressableCounter = 1;
for (unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
{
AuraDeviceInfo device_info = aura->GetAuraDevices()[channel_idx];
zones[channel_idx].type = ZONE_TYPE_LINEAR;
if(device_info.device_type == AuraDeviceType::FIXED)
{
zones[channel_idx].name = "Aura Mainboard";
zones[channel_idx].leds_min = device_info.num_leds;
zones[channel_idx].leds_max = device_info.num_leds;
zones[channel_idx].leds_count = device_info.num_leds;
}
else
{
zones[channel_idx].name = "Aura Addressable ";
zones[channel_idx].name.append(std::to_string(addressableCounter));
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
addressableCounter++;
if(first_run)
{
zones[channel_idx].leds_count = 0;
}
}
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
led new_led;
new_led.name = zones[channel_idx].name;
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_ch_idx + 1));
new_led.value = channel_idx;
leds.push_back(new_led);
}
zones[channel_idx].matrix_map = NULL;
}
SetupColors();
}
void RGBController_AuraUSB::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_AuraUSB::DeviceUpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
aura->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
}
}
void RGBController_AuraUSB::UpdateZoneLEDs(int zone)
{
aura->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
}
void RGBController_AuraUSB::UpdateSingleLED(int led)
{
unsigned int channel = leds[led].value;
aura->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
}
void RGBController_AuraUSB::SetCustomMode()
{
}
void RGBController_AuraUSB::DeviceUpdateMode()
{
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
red = RGBGetRValue(modes[active_mode].colors[0]);
grn = RGBGetGValue(modes[active_mode].colors[0]);
blu = RGBGetBValue(modes[active_mode].colors[0]);
}
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
if(zones[zone_idx].leds_count > 0)
{
aura->SetMode(zone_idx, modes[active_mode].value, red, grn, blu);
}
}
}

View file

@ -1,37 +0,0 @@
/*-----------------------------------------*\
| RGBController_AuraUSB.h |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Adam Honse (CalcProgrammer1) 1/18/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AuraUSBController.h"
#define AURA_ADDRESSABLE_MAX_LEDS 120
class RGBController_AuraUSB : public RGBController
{
public:
RGBController_AuraUSB(AuraUSBController* aura_ptr);
~RGBController_AuraUSB();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
AuraUSBController* aura;
std::vector<unsigned int> leds_channel;
std::vector<unsigned int> zones_channel;
};

View file

@ -1,167 +0,0 @@
/*-------------------------------------------------------------------*\
| RGBController_CMMP750Controller.cpp |
| |
| Driver for Coolermaster MP750 mousepad |
| |
| Chris M (Dr_No) 18th Apr 2020 |
| |
\*-------------------------------------------------------------------*/
#include "RGBController_CMMP750Controller.h"
RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controller* cmmp_ptr)
{
cmmp750 = cmmp_ptr;
unsigned char speed = cmmp750->GetLedSpeed();
name = cmmp750->GetDeviceName();
type = DEVICE_TYPE_MOUSEMAT;
description = cmmp750->GetDeviceName();
version = "1.0";
serial = "";
location = cmmp750->GetLocation();
mode Static;
Static.name = "Static";
Static.value = MP750_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Blink;
Blink.name = "Blink";
Blink.value = MP750_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Blink.speed_min = MP750_SPEED_SLOWEST;
Blink.speed_max = MP750_SPEED_FASTEST;
Blink.color_mode = MODE_COLORS_PER_LED;
Blink.speed = speed;
modes.push_back(Blink);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = MP750_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = MP750_SPEED_SLOWEST;
Breathing.speed_max = MP750_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed = speed;
modes.push_back(Breathing);
mode ColorCycle;
ColorCycle.name = "Color Cycle";
ColorCycle.value = MP750_MODE_COLOR_CYCLE;
ColorCycle.flags = MODE_FLAG_HAS_SPEED;
ColorCycle.speed_min = MP750_SPEED_SLOWEST;
ColorCycle.speed_max = MP750_SPEED_FASTEST;
ColorCycle.color_mode = MODE_COLORS_NONE;
ColorCycle.speed = speed;
modes.push_back(ColorCycle);
mode BreathCycle;
BreathCycle.name = "Breath Cycle";
BreathCycle.value = MP750_MODE_BREATH_CYCLE;
BreathCycle.flags = MODE_FLAG_HAS_SPEED;
BreathCycle.speed_min = MP750_SPEED_SLOWEST;
BreathCycle.speed_max = MP750_SPEED_FASTEST;
BreathCycle.color_mode = MODE_COLORS_NONE;
BreathCycle.speed = speed;
modes.push_back(BreathCycle);
SetupZones();
active_mode = cmmp750->GetMode();
}
RGBController_CMMP750Controller::~RGBController_CMMP750Controller()
{
}
void RGBController_CMMP750Controller::SetupZones()
{
zone MP_zone;
MP_zone.name = "Mousepad";
MP_zone.type = ZONE_TYPE_SINGLE;
MP_zone.leds_min = 1;
MP_zone.leds_max = 1;
MP_zone.leds_count = 1;
MP_zone.matrix_map = NULL;
zones.push_back(MP_zone);
led MP_led;
MP_led.name = "Mousepad LED";
leds.push_back(MP_led);
SetupColors();
/*---------------------------------------------------------*\
| Initialize colors for each LED |
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
unsigned char red = cmmp750->GetLedRed();
unsigned char grn = cmmp750->GetLedGreen();
unsigned char blu = cmmp750->GetLedBlue();
colors[led_idx] = ToRGBColor(red, grn, blu);
}
}
void RGBController_CMMP750Controller::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CMMP750Controller::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
cmmp750->SetColor(red, grn, blu);
}
void RGBController_CMMP750Controller::UpdateZoneLEDs(int zone)
{
RGBColor color = colors[zone];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
cmmp750->SetColor(red, grn, blu);
}
void RGBController_CMMP750Controller::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_CMMP750Controller::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CMMP750Controller::DeviceUpdateMode()
{
switch(modes[active_mode].value)
{
case MP750_MODE_STATIC:
cmmp750->SetMode(MP750_MODE_STATIC, modes[active_mode].speed);
break;
case MP750_MODE_BLINK:
cmmp750->SetMode(MP750_MODE_BLINK, modes[active_mode].speed);
break;
case MP750_MODE_BREATHING:
cmmp750->SetMode(MP750_MODE_BREATHING, modes[active_mode].speed);
break;
case MP750_MODE_COLOR_CYCLE:
cmmp750->SetMode(MP750_MODE_COLOR_CYCLE, modes[active_mode].speed);
break;
case MP750_MODE_BREATH_CYCLE:
cmmp750->SetMode(MP750_MODE_BREATH_CYCLE, modes[active_mode].speed);
break;
default:
cmmp750->SetMode(MP750_MODE_BREATHING, modes[active_mode].speed);
break;
}
}

View file

@ -1,33 +0,0 @@
/*-------------------------------------------------------------------*\
| RGBController_CMMP750Controller.h |
| |
| Driver for Coolermaster MP750 mousepad |
| |
| Chris M (Dr_No) 18th Apr 2020 |
| |
\*-------------------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CMMP750Controller.h"
class RGBController_CMMP750Controller : public RGBController
{
public:
RGBController_CMMP750Controller(CMMP750Controller* cmmp_ptr);
~RGBController_CMMP750Controller();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
CMMP750Controller* cmmp750;
int GetDeviceMode();
};

View file

@ -1,108 +0,0 @@
/*-------------------------------------------------*\
| 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();
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;
}
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()
{
}

View file

@ -1,32 +0,0 @@
/*--------------------------------------------*\
| 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);
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;
};

View file

@ -1,136 +0,0 @@
/*-----------------------------------------*\
| 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;
description = "Corsair Hydro Series Device";
version = corsair->GetFirmwareString();
type = DEVICE_TYPE_COOLER;
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();
}
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;
}
}

View file

@ -1,32 +0,0 @@
/*-----------------------------------------*\
| 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);
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;
};

View file

@ -1,319 +0,0 @@
/*-----------------------------------------*\
| RGBController_CorsairLightingNode.cpp |
| |
| Generic RGB Interface for Corsair |
| Lighting Node Pro |
| |
| Adam Honse (CalcProgrammer1) 1/12/2020 |
\*-----------------------------------------*/
#include "RGBController_CorsairLightingNode.h"
RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLightingNodeController* corsair_ptr)
{
corsair = corsair_ptr;
name = "Corsair Lighting Node Device";
description = "Corsair Lighting Node Device";
type = DEVICE_TYPE_LEDSTRIP;
version = corsair->GetFirmwareString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode RainbowWave;
RainbowWave.name = "Rainbow Wave";
RainbowWave.value = CORSAIR_LIGHTING_NODE_MODE_RAINBOW_WAVE;
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
RainbowWave.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
RainbowWave.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
RainbowWave.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
RainbowWave.direction = MODE_DIRECTION_RIGHT;
RainbowWave.color_mode = MODE_COLORS_NONE;
modes.push_back(RainbowWave);
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_SHIFT;
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
ColorShift.colors_min = 2;
ColorShift.colors_max = 2;
ColorShift.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
ColorShift.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
ColorShift.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorShift.colors.resize(2);
modes.push_back(ColorShift);
mode ColorPulse;
ColorPulse.name = "Color Pulse";
ColorPulse.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_PULSE;
ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
ColorPulse.colors_min = 2;
ColorPulse.colors_max = 2;
ColorPulse.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
ColorPulse.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
ColorPulse.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
ColorPulse.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorPulse.colors.resize(2);
modes.push_back(ColorPulse);
mode ColorWave;
ColorWave.name = "Color Wave";
ColorWave.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_WAVE;
ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
ColorWave.colors_min = 2;
ColorWave.colors_max = 2;
ColorWave.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
ColorWave.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
ColorWave.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
ColorWave.direction = MODE_DIRECTION_RIGHT;
ColorWave.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorWave.colors.resize(2);
modes.push_back(ColorWave);
mode Static;
Static.name = "Static";
Static.value = CORSAIR_LIGHTING_NODE_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
mode Temperature;
Temperature.name = "Temperature";
Temperature.value = CORSAIR_LIGHTING_NODE_MODE_TEMPERATURE;
Temperature.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Temperature.colors_min = 3;
Temperature.colors_max = 3;
Temperature.color_mode = MODE_COLORS_MODE_SPECIFIC;
Temperature.colors.resize(3);
modes.push_back(Temperature);
mode Visor;
Visor.name = "Visor";
Visor.value = CORSAIR_LIGHTING_NODE_MODE_VISOR;
Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Visor.colors_min = 2;
Visor.colors_max = 2;
Visor.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Visor.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Visor.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Visor.color_mode = MODE_COLORS_MODE_SPECIFIC;
Visor.colors.resize(2);
modes.push_back(Visor);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = CORSAIR_LIGHTING_NODE_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Marquee.colors_min = 1;
Marquee.colors_max = 1;
Marquee.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Marquee.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Marquee.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Marquee.direction = MODE_DIRECTION_RIGHT;
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
Marquee.colors.resize(1);
modes.push_back(Marquee);
mode Blink;
Blink.name = "Blink";
Blink.value = CORSAIR_LIGHTING_NODE_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Blink.colors_min = 2;
Blink.colors_max = 2;
Blink.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Blink.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Blink.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Blink.color_mode = MODE_COLORS_MODE_SPECIFIC;
Blink.colors.resize(2);
modes.push_back(Blink);
mode Sequential;
Sequential.name = "Sequential";
Sequential.value = CORSAIR_LIGHTING_NODE_MODE_SEQUENTIAL;
Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Sequential.colors_min = 1;
Sequential.colors_max = 1;
Sequential.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Sequential.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Sequential.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Sequential.direction = MODE_DIRECTION_RIGHT;
Sequential.color_mode = MODE_COLORS_MODE_SPECIFIC;
Sequential.colors.resize(1);
modes.push_back(Sequential);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CORSAIR_LIGHTING_NODE_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Rainbow.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Rainbow.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
SetupZones();
}
void RGBController_CorsairLightingNode::SetupZones()
{
/*-------------------------------------------------*\
| Only set LED count on the first run |
\*-------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = true;
}
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
leds.clear();
colors.clear();
zones.resize(CORSAIR_LIGHTING_NODE_NUM_CHANNELS);
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
for (unsigned int channel_idx = 0; channel_idx < CORSAIR_LIGHTING_NODE_NUM_CHANNELS; channel_idx++)
{
char ch_idx_string[2];
sprintf(ch_idx_string, "%d", channel_idx + 1);
zones[channel_idx].name = "Corsair Channel ";
zones[channel_idx].name.append(ch_idx_string);
zones[channel_idx].type = ZONE_TYPE_LINEAR;
/*-------------------------------------------------*\
| I did some experimenting and determined that the |
| maximum number of LEDs the Corsair Commander Pro |
| can support is 200. |
\*-------------------------------------------------*/
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = 204;
if(first_run)
{
zones[channel_idx].leds_count = 0;
}
zones[channel_idx].matrix_map = NULL;
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
char led_idx_string[4];
sprintf(led_idx_string, "%d", led_ch_idx + 1);
led new_led;
new_led.name = "Corsair Channel ";
new_led.name.append(ch_idx_string);
new_led.name.append(", LED ");
new_led.name.append(led_idx_string);
leds.push_back(new_led);
leds_channel.push_back(channel_idx);
}
}
SetupColors();
}
void RGBController_CorsairLightingNode::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_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);
}
}
void RGBController_CorsairLightingNode::UpdateZoneLEDs(int zone)
{
corsair->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);
}
void RGBController_CorsairLightingNode::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairLightingNode::DeviceUpdateMode()
{
if(modes[active_mode].value == 0xFFFF)
{
DeviceUpdateLEDs();
}
else
{
for(int channel = 0; channel < CORSAIR_LIGHTING_NODE_NUM_CHANNELS; channel++)
{
unsigned int direction = 0;
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
if(modes[active_mode].direction == MODE_DIRECTION_RIGHT)
{
direction = 1;
}
unsigned char mode_colors[9];
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
for(std::size_t i = 0; i < modes[active_mode].colors.size(); i++)
{
mode_colors[(3 * i) + 0] = RGBGetRValue(modes[active_mode].colors[i]);
mode_colors[(3 * i) + 1] = RGBGetGValue(modes[active_mode].colors[i]);
mode_colors[(3 * i) + 2] = RGBGetBValue(modes[active_mode].colors[i]);
}
}
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]);
}
}
}

View file

@ -1,34 +0,0 @@
/*-----------------------------------------*\
| 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);
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;
};

View file

@ -1,805 +0,0 @@
/*-----------------------------------------*\
| RGBController_CorsairPeripheral.cpp |
| |
| Generic RGB Interface for Corsair RGB |
| keyboard, mouse, and mousemat devices |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "RGBController_CorsairPeripheral.h"
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
static unsigned int matrix_map_k95_platinum[7][24] =
{ { NA, NA, NA, NA, 107, 8, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 16, NA, NA, NA,},
{ 113, 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 114, 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 115, 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 116, 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 117, 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 118, 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
static unsigned int matrix_map_k95[7][26] =
{ { NA, NA, NA, 131, 132, 133, 134, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 107, 8, NA, NA, 16, NA, NA,},
{ 113, 114, 115, 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 116, 117, 118, 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 119, 120, 121, 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 122, 123, 124, 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 125, 126, 127, 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 128, 129, 130, 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
/*---------------------------------------------------------*\
| Normal Corsair Layout |
\*---------------------------------------------------------*/
static const char* zone_names[] =
{
"Keyboard",
};
static const unsigned int zone_sizes[] =
{
113
};
static const zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
/*---------------------------------------------------------*\
| K95 Platinum |
\*---------------------------------------------------------*/
static const char* zone_names_k95_platinum[] =
{
"Keyboard",
"Light Bar"
};
static const unsigned int zone_sizes_k95_platinum[] =
{
119,
19
};
static const zone_type zone_types_k95_platinum[] =
{
ZONE_TYPE_MATRIX,
ZONE_TYPE_LINEAR
};
/*---------------------------------------------------------*\
| K95 non-Platinum |
\*---------------------------------------------------------*/
static const char* zone_names_k95[] =
{
"Keyboard",
};
static const unsigned int zone_sizes_k95[] =
{
135
};
static const zone_type zone_types_k95[] =
{
ZONE_TYPE_MATRIX
};
static const char* led_names[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Key: Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Key: Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Key: Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Key: Media Play/Pause",//56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Key: Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\ (ANSI)", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
};
static const char* led_names_k95_plat[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Key: Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Key: Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Key: Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Key: Media Play/Pause",//56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Key: Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\ (ANSI)", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
"Key: Macro G1",
"Key: Macro G2",
"Key: Macro G3",
"Key: Macro G4",
"Key: Macro G5",
"Key: Macro G6",
"Light Bar 1",
"Light Bar 2",
"Light Bar 3",
"Light Bar 4",
"Light Bar 5",
"Light Bar 6",
"Light Bar 7",
"Light Bar 8",
"Light Bar 9",
"Light Bar 10",
"Light Bar 11",
"Light Bar 12",
"Light Bar 13",
"Light Bar 14",
"Light Bar 15",
"Light Bar 16",
"Light Bar 17",
"Light Bar 18",
"Light Bar 19"
};
static const char* led_names_k95[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Key: Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Key: Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Key: Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Key: Media Play/Pause",//56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Key: Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\ (ANSI)", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
"Key: Macro G1",
"Key: Macro G2",
"Key: Macro G3",
"Key: Macro G4",
"Key: Macro G5",
"Key: Macro G6",
"Key: Macro G7",
"Key: Macro G8",
"Key: Macro G9",
"Key: Macro G10",
"Key: Macro G11",
"Key: Macro G12",
"Key: Macro G13",
"Key: Macro G14",
"Key: Macro G15",
"Key: Macro G16",
"Key: Macro G17",
"Key: Macro G18",
"Key: MR",
"Key: M1",
"Key: M2",
"Key: M3",
};
static const char* corsair_mouse_leds[] =
{
"Mouse LED 1",
"Mouse LED 2",
"Mouse LED 3",
"Mouse LED 4",
"Mouse LED 5",
"Mouse LED 6",
"Mouse LED 7",
"Mouse LED 8",
"Mouse LED 9",
"Mouse LED 10",
"Mouse LED 11",
"Mouse LED 12",
"Mouse LED 13",
"Mouse LED 14",
"Mouse LED 15",
};
static const char* corsair_sabre_rgb_leds[] =
{
"",
"Underglow",
"Logo",
"DPI",
"Scroll Wheel",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
};
static const char* corsair_harpoon_pro_leds[] =
{
"",
"",
"",
"Logo",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripheralController* corsair_ptr)
{
corsair = corsair_ptr;
name = "Corsair RGB Peripheral Device";
description = "Corsair RGB Peripheral Device";
type = corsair->GetDeviceType();
version = corsair->GetFirmwareString();
physical_layout = corsair->GetPhysicalLayout();
logical_layout = corsair->GetLogicalLayout();
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_CorsairPeripheral::~RGBController_CorsairPeripheral()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_CorsairPeripheral::SetupZones()
{
/*---------------------------------------------------------*\
| Determine number of zones |
| For now, keyboard has 2 zones and mousemat has 1 |
\*---------------------------------------------------------*/
unsigned int num_zones = 0;
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
{
num_zones = 2;
break;
}
num_zones = 1;
break;
case DEVICE_TYPE_MOUSE:
case DEVICE_TYPE_MOUSEMAT:
num_zones = 1;
break;
case DEVICE_TYPE_HEADSET_STAND:
num_zones = 2;
break;
}
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < num_zones; zone_idx++)
{
zone new_zone;
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
{
new_zone.name = zone_names_k95_platinum[zone_idx];
new_zone.type = zone_types_k95_platinum[zone_idx];
new_zone.leds_min = zone_sizes_k95_platinum[zone_idx];
new_zone.leds_max = zone_sizes_k95_platinum[zone_idx];
new_zone.leds_count = zone_sizes_k95_platinum[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 24;
new_zone.matrix_map->map = (unsigned int *)&matrix_map_k95_platinum;
}
else
{
new_zone.matrix_map = NULL;
}
}
else if (logical_layout == CORSAIR_TYPE_K95)
{
new_zone.name = zone_names_k95[zone_idx];
new_zone.type = zone_types_k95[zone_idx];
new_zone.leds_min = zone_sizes_k95[zone_idx];
new_zone.leds_max = zone_sizes_k95[zone_idx];
new_zone.leds_count = zone_sizes_k95[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 26;
new_zone.matrix_map->map = (unsigned int *)&matrix_map_k95;
}
else
{
new_zone.matrix_map = NULL;
}
}
else //default layout
{
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];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
}
break;
case DEVICE_TYPE_MOUSE:
new_zone.name = "Mouse Zone";
new_zone.type = ZONE_TYPE_SINGLE;
new_zone.leds_min = 15;
new_zone.leds_max = 15;
new_zone.leds_count = 15;
new_zone.matrix_map = NULL;
break;
case DEVICE_TYPE_MOUSEMAT:
new_zone.name = "Mousemat Zone";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = 15;
new_zone.leds_max = 15;
new_zone.leds_count = 15;
new_zone.matrix_map = NULL;
break;
case DEVICE_TYPE_HEADSET_STAND:
if(zone_idx == 0)
{
new_zone.name = "Base LED Strip";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = 8;
new_zone.leds_max = 8;
new_zone.leds_count = 8;
new_zone.matrix_map = NULL;
}
else
{
new_zone.name = "Logo";
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;
}
break;
}
zones.push_back(new_zone);
total_led_count += new_zone.leds_count;
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
if(logical_layout == CORSAIR_TYPE_K95_PLAT)
{
new_led.name = led_names_k95_plat[led_idx];
}
else if(logical_layout == CORSAIR_TYPE_K95)
{
new_led.name = led_names_k95[led_idx];
}
else
{
new_led.name = led_names[led_idx];
}
break;
case DEVICE_TYPE_MOUSE:
new_led.name = corsair_mouse_leds[led_idx];
break;
case DEVICE_TYPE_MOUSEMAT:
case DEVICE_TYPE_HEADSET_STAND:
new_led.name = "Mousemat LED ";
new_led.name.append(std::to_string(led_idx + 1));
break;
}
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_CorsairPeripheral::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CorsairPeripheral::DeviceUpdateLEDs()
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairPeripheral::UpdateZoneLEDs(int /*zone*/)
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairPeripheral::UpdateSingleLED(int /*led*/)
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairPeripheral::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairPeripheral::DeviceUpdateMode()
{
}

View file

@ -1,36 +0,0 @@
/*-----------------------------------------*\
| 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;
};

View file

@ -1,107 +0,0 @@
/*-----------------------------------------*\
| 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();
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();
}
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);
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| 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);
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;
};

View file

@ -1,281 +0,0 @@
/*-----------------------------------------*\
| 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();
type = DEVICE_TYPE_DRAM;
description = "Corsair Vengeance Pro RGB Device";
location = corsair->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = CORSAIR_PRO_MODE_STATIC;
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 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;
}
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]);
}
}
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]);
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| 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);
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;
};

View file

@ -1,183 +0,0 @@
/*-----------------------------------------*\
| RGBController_Crucial.cpp |
| |
| Generic RGB Interface for Crucial |
| Ballistix RGB controller |
| |
| Adam Honse (CalcProgrammer1) 1/19/2020 |
\*-----------------------------------------*/
#include "RGBController_Crucial.h"
RGBController_Crucial::RGBController_Crucial(CrucialController * crucial_ptr)
{
crucial = crucial_ptr;
name = "Crucial DRAM";
type = DEVICE_TYPE_DRAM;
description = "Crucial DRAM Device";
location = crucial->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Shift;
Shift.name = "Shift";
Shift.value = CRUCIAL_MODE_SHIFT;
Shift.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Shift.colors_min = 1;
Shift.colors_max = 1;
Shift.color_mode = MODE_COLORS_MODE_SPECIFIC;
Shift.colors.resize(1);
modes.push_back(Shift);
mode GradientShift;
GradientShift.name = "Gradient Shift";
GradientShift.value = CRUCIAL_MODE_GRADIENT_SHIFT;
GradientShift.flags = 0;
GradientShift.color_mode = MODE_COLORS_NONE;
modes.push_back(GradientShift);
mode Fill;
Fill.name = "Fill";
Fill.value = CRUCIAL_MODE_FILL;
Fill.flags = 0;
Fill.color_mode = MODE_COLORS_NONE;
modes.push_back(Fill);
mode Stack;
Stack.name = "Stack";
Stack.value = CRUCIAL_MODE_STACK;
Stack.flags = 0;
Stack.color_mode = MODE_COLORS_NONE;
modes.push_back(Stack);
mode DoubleStack;
DoubleStack.name = "Double Stack";
DoubleStack.value = CRUCIAL_MODE_DOUBLE_STACK;
DoubleStack.flags = 0;
DoubleStack.color_mode = MODE_COLORS_NONE;
modes.push_back(DoubleStack);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = CRUCIAL_MODE_BREATHING;
Breathing.flags = 0;
Breathing.color_mode = MODE_COLORS_NONE;
modes.push_back(Breathing);
mode MotionPoint;
MotionPoint.name = "Motion Point";
MotionPoint.value = CRUCIAL_MODE_MOTION_POINT;
MotionPoint.flags = 0;
MotionPoint.color_mode = MODE_COLORS_NONE;
modes.push_back(MotionPoint);
mode InsideOut;
InsideOut.name = "Inside Out";
InsideOut.value = CRUCIAL_MODE_INSIDE_OUT;
InsideOut.flags = 0;
InsideOut.color_mode = MODE_COLORS_NONE;
modes.push_back(InsideOut);
mode ColorStep;
ColorStep.name = "Color Step";
ColorStep.value = CRUCIAL_MODE_COLOR_STEP;
ColorStep.flags = 0;
ColorStep.color_mode = MODE_COLORS_NONE;
modes.push_back(ColorStep);
mode WaterWave;
WaterWave.name = "Water Wave (Color Blending)";
WaterWave.value = CRUCIAL_MODE_WATER_WAVE;
WaterWave.flags = 0;
WaterWave.color_mode = MODE_COLORS_NONE;
modes.push_back(WaterWave);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = CRUCIAL_MODE_FLASHING;
Flashing.flags = 0;
Flashing.color_mode = MODE_COLORS_NONE;
modes.push_back(Flashing);
mode Static;
Static.name = "Static";
Static.value = CRUCIAL_MODE_STATIC;
Static.flags = 0;
Static.color_mode = MODE_COLORS_NONE;
modes.push_back(Static);
SetupZones();
}
void RGBController_Crucial::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zone new_zone;
new_zone.name = "DRAM";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = 8;
new_zone.leds_max = 8;
new_zone.leds_count = 8;
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.name = "DRAM LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_Crucial::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_Crucial::DeviceUpdateLEDs()
{
if(modes[active_mode].value == 0xFFFF)
{
crucial->SetAllColorsDirect(&colors[0]);
}
else
{
crucial->SetAllColorsEffect(&colors[0]);
}
}
void RGBController_Crucial::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_Crucial::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_Crucial::SetCustomMode()
{
active_mode = 0;
}
void RGBController_Crucial::DeviceUpdateMode()
{
crucial->SetMode(modes[active_mode].value);
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| 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);
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;
};

View file

@ -1,278 +0,0 @@
/*-----------------------------------------*\
| RGBController_DuckyKeyboard.cpp |
| |
| Generic RGB Interface for Ducky RGB |
| keyboard devices |
| |
| Adam Honse (CalcProgrammer1) 7/4/2020 |
\*-----------------------------------------*/
#include "RGBController_DuckyKeyboard.h"
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 12, 18, 24, 30, NA, 42, 48, 54, 60, NA, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126 },
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, NA, 67, 73, 85, NA, 91, 97, 103, 109, 115, 121, 127 },
{ 2, NA, 8, 14, 20, 26, NA, 32, 38, 44, 50, 56, 62, 68, 74, 86, 92, 98, 104, 110, 116, 122, 128 },
{ 3, NA, 9, 15, 21, 27, NA, 33, 39, 45, 51, 57, 63, 69, 87, NA, NA, NA, NA, 111, 117, 123, NA },
{ 4, NA, 16, 22, 28, 34, NA, 40, NA, 46, 52, 58, 64, 70, 82, NA, NA, 100, NA, 112, 118, 124, 131 },
{ 5, 11, 17, NA, NA, NA, NA, 41, NA, NA, NA, NA, 65, 77, 83, 89, 95, 101, 107, 113, NA, 125, NA } };
static const char* zone_names[] =
{
"Keyboard"
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
132
};
static const char *led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Unused",
"Key: 1",
"Key: Q",
"Key: A",
"Unused",
"Key: Left Windows",
"Key: F1",
"Key: 2",
"Key: W",
"Key: S",
"Key: Z",
"Key: Left Alt",
"Key: F2",
"Key: 3",
"Key: E",
"Key: D",
"Key: X",
"Unused",
"Key: F3",
"Key: 4",
"Key: R",
"Key: F",
"Key: C",
"Unused",
"Key: F4",
"Key: 5",
"Key: T",
"Key: G",
"Key: V",
"Unused",
"Unused",
"Key: 6",
"Key: Y",
"Key: H",
"Key: B",
"Key: Space",
"Key: F5",
"Key: 7",
"Key: U",
"Key: J",
"Key: N",
"Unused",
"Key: F6",
"Key: 8",
"Key: I",
"Key: K",
"Key: M",
"Unused",
"Key: F7",
"Key: 9",
"Key: O",
"Key: L",
"Key: ,",
"Unused",
"Key: F8",
"Key: 0",
"Key: P",
"Key: ;",
"Key: .",
"Key: Right Alt",
"Key: F9",
"Key: -",
"Key: [",
"Key: '",
"Key: /",
"Unused",
"Key: F10",
"Key: =",
"Key: ]",
"Unused",
"Unused",
"Key: Right Windows",
"Key: F11",
"Unused",
"Unused",
"Unused",
"Key: Right Shift",
"Key: Right Fn",
"Key: F12",
"Key: Backspace",
"Key: \\ (ANSI)",
"Key: Enter",
"Unused",
"Key: Right Control",
"Key: Print Screen",
"Key: Insert",
"Key: Delete",
"Unused",
"Unused",
"Key: Left Arrow",
"Key: Scroll Lock",
"Key: Home",
"Key: End",
"Unused",
"Key: Up Arrow",
"Key: Down Arrow",
"Key: Pause/Break",
"Key: Page Up",
"Key: Page Down",
"Unused",
"Unused",
"Key: Right Arrow",
"Key: Calculator",
"Key: Num Lock",
"Key: Number Pad 7",
"Key: Number Pad 4",
"Key: Number Pad 1",
"Key: Number Pad 0",
"Key: Media Mute",
"Key: Number Pad /",
"Key: Number Pad 8",
"Key: Number Pad 5",
"Key: Number Pad 2",
"Unused",
"Key: Media Volume Down",
"Key: Number Pad *",
"Key: Number Pad 9",
"Key: Number Pad 6",
"Key: Number Pad 3",
"Key: Number Pad .",
"Key: Media Volume Up",
"Key: Number Pad -",
"Key: Number Pad +",
"Unused",
"Unused",
"Key: Number Pad Enter",
};
RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController* ducky_ptr)
{
ducky = ducky_ptr;
name = "Ducky Keyboard Device";
type = DEVICE_TYPE_KEYBOARD;
description = "Ducky Keyboard Device";
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_DuckyKeyboard::~RGBController_DuckyKeyboard()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_DuckyKeyboard::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 = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
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_DuckyKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_DuckyKeyboard::DeviceUpdateLEDs()
{
unsigned char colordata[155*3];
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
{
colordata[(color_idx*3)+0] = RGBGetRValue(colors[color_idx]);
colordata[(color_idx*3)+1] = RGBGetGValue(colors[color_idx]);
colordata[(color_idx*3)+2] = RGBGetBValue(colors[color_idx]);
}
ducky->SendColors(colordata, sizeof(colordata));
}
void RGBController_DuckyKeyboard::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_DuckyKeyboard::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_DuckyKeyboard::SetCustomMode()
{
}
void RGBController_DuckyKeyboard::DeviceUpdateMode()
{
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| 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;
};

View file

@ -1,343 +0,0 @@
/*-----------------------------------------*\
| RGBController_LEDStrip.cpp |
| |
| Generic RGB Interface for OpenAuraSDK |
| E1.31 Streaming ACN interface |
| |
| Adam Honse (CalcProgrammer1) 10/18/2019 |
\*-----------------------------------------*/
#include "RGBController_E131.h"
#include <e131.h>
#include <math.h>
using namespace std::chrono_literals;
RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
{
name = "E1.31 Streaming ACN Device";
type = DEVICE_TYPE_LEDSTRIP;
description = "E1.31 Streaming ACN Device";
devices = device_list;
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);
sockfd = e131_socket();
keepalive_delay = 0ms;
SetupZones();
for (std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
{
/*-----------------------------------------*\
| Update keepalive delay |
\*-----------------------------------------*/
if(devices[device_idx].keepalive_time > 0)
{
if(keepalive_delay.count() == 0 || keepalive_delay.count() > devices[device_idx].keepalive_time)
{
keepalive_delay = std::chrono::milliseconds(devices[device_idx].keepalive_time);
}
}
/*-----------------------------------------*\
| Add Universes |
\*-----------------------------------------*/
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
for (unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
{
unsigned int universe = devices[device_idx].start_universe + univ_idx;
bool universe_exists = false;
for (std::size_t pkt_idx = 0; pkt_idx < packets.size(); pkt_idx++)
{
if(universes[pkt_idx] == universe)
{
universe_exists = true;
}
}
if(!universe_exists)
{
e131_packet_t packet;
e131_addr_t dest_addr;
e131_pkt_init(&packet, universe, 512);
e131_multicast_dest(&dest_addr, universe, E131_DEFAULT_PORT);
packets.push_back(packet);
universes.push_back(universe);
dest_addrs.push_back(dest_addr);
}
}
/*-----------------------------------------*\
| Generate matrix maps |
\*-----------------------------------------*/
if(devices[device_idx].type == ZONE_TYPE_MATRIX)
{
unsigned int led_idx = 0;
matrix_map_type * new_map = new matrix_map_type;
new_map->width = devices[device_idx].matrix_width;
new_map->height = devices[device_idx].matrix_height;
new_map->map = new unsigned int[devices[device_idx].matrix_width * devices[device_idx].matrix_height];
switch(devices[device_idx].matrix_order)
{
case E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT:
for(unsigned int y = 0; y < new_map->height; y++)
{
for(unsigned int x = 0; x < new_map->width; x++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT:
for(unsigned int y = 0; y < new_map->height; y++)
{
for(int x = new_map->width - 1; x >= 0; x--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT:
for(int y = new_map->height; y >= 0; y--)
{
for(unsigned int x = 0; x < new_map->width; x++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT:
for(int y = new_map->height; y >= 0; y--)
{
for(int x = new_map->width - 1; x >= 0; x--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_TOP_LEFT:
for(unsigned int x = 0; x < new_map->width; x++)
{
for(unsigned int y = 0; y < new_map->height; y++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT:
for(int x = new_map->width - 1; x >= 0; x--)
{
for(unsigned int y = 0; y < new_map->height; y++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT:
for(unsigned int x = 0; x < new_map->width; x++)
{
for(int y = new_map->height - 1; y >= 0; y--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT:
for(int x = new_map->width - 1; x >= 0; x--)
{
for(int y = new_map->height - 1; y >= 0; y--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
}
zones[device_idx].matrix_map = new_map;
}
}
if(keepalive_delay.count() > 0)
{
KeepaliveThread = new std::thread(&RGBController_E131::KeepaliveThreadFunction, this);
}
}
RGBController_E131::~RGBController_E131()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
if(zones[zone_index].matrix_map->map != NULL)
{
delete zones[zone_index].matrix_map->map;
}
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_E131::SetupZones()
{
/*-----------------------------------------*\
| Add Zones |
\*-----------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < devices.size(); zone_idx++)
{
zone led_zone;
led_zone.name = devices[zone_idx].name;
led_zone.type = devices[zone_idx].type;
led_zone.leds_min = devices[zone_idx].num_leds;
led_zone.leds_max = devices[zone_idx].num_leds;
led_zone.leds_count = devices[zone_idx].num_leds;
led_zone.matrix_map = NULL;
zones.push_back(led_zone);
}
/*-----------------------------------------*\
| Add LEDs |
\*-----------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
{
led new_led;
new_led.name = zones[zone_idx].name + " LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
}
SetupColors();
}
void RGBController_E131::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_E131::DeviceUpdateLEDs()
{
int color_idx = 0;
last_update_time = std::chrono::steady_clock::now();
for(std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
{
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
unsigned int channel_idx = devices[device_idx].start_channel;
unsigned int led_idx = 0;
unsigned int rgb_idx = 0;
bool done = false;
for (unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
{
unsigned int universe = devices[device_idx].start_universe + univ_idx;
for(std::size_t packet_idx = 0; packet_idx < packets.size(); packet_idx++)
{
if(!done && (universes[packet_idx] == universe))
{
while(!done && (channel_idx <= 512))
{
switch(rgb_idx)
{
case 0:
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetRValue( colors[color_idx] );
rgb_idx = 1;
break;
case 1:
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetGValue( colors[color_idx] );
rgb_idx = 2;
break;
case 2:
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetBValue( colors[color_idx] );
rgb_idx = 0;
led_idx++;
color_idx++;
break;
}
if(led_idx >= devices[device_idx].num_leds)
{
done = true;
}
channel_idx++;
}
}
}
channel_idx = 1;
}
}
for(std::size_t packet_idx = 0; packet_idx < packets.size(); packet_idx++)
{
e131_send(sockfd, &packets[packet_idx], &dest_addrs[packet_idx]);
packets[packet_idx].frame.seq_number++;
}
}
void RGBController_E131::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_E131::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_E131::SetCustomMode()
{
}
void RGBController_E131::DeviceUpdateMode()
{
}
void RGBController_E131::KeepaliveThreadFunction()
{
while(1)
{
if((std::chrono::steady_clock::now() - last_update_time) > ( keepalive_delay * 0.95f ) )
{
UpdateLEDs();
}
std::this_thread::sleep_for(keepalive_delay / 2);
}
}

View file

@ -1,84 +0,0 @@
/*-----------------------------------------*\
| RGBController_E131.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| E1.31 Streaming ACN interface |
| |
| Adam Honse (CalcProgrammer1) 10/18/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include <e131.h>
#include <chrono>
#include <thread>
typedef unsigned int e131_rgb_order;
enum
{
E131_RGB_ORDER_RGB,
E131_RGB_ORDER_RBG,
E131_RGB_ORDER_GRB,
E131_RGB_ORDER_GBR,
E131_RGB_ORDER_BRG,
E131_RGB_ORDER_BGR
};
enum
{
E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT,
E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT,
E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT,
E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT,
E131_MATRIX_ORDER_VERTICAL_TOP_LEFT,
E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT,
E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT,
E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT
};
typedef unsigned int e131_matrix_order;
struct E131Device
{
std::string name;
unsigned int num_leds;
unsigned int start_universe;
unsigned int start_channel;
unsigned int keepalive_time;
e131_rgb_order rgb_order;
zone_type type;
unsigned int matrix_width;
unsigned int matrix_height;
e131_matrix_order matrix_order;
};
class RGBController_E131 : public RGBController
{
public:
RGBController_E131(std::vector<E131Device> device_list);
~RGBController_E131();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void KeepaliveThreadFunction();
private:
std::vector<E131Device> devices;
std::vector<e131_packet_t> packets;
std::vector<e131_addr_t> dest_addrs;
std::vector<unsigned int> universes;
int sockfd;
std::thread * KeepaliveThread;
std::chrono::milliseconds keepalive_delay;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};

View file

@ -1,174 +0,0 @@
/*-------------------------------------------------------------------*\
| 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();
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()
{
}
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);
}

View file

@ -1,35 +0,0 @@
/*-------------------------------------------------------------------*\
| 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

View file

@ -1,118 +0,0 @@
/*-----------------------------------------*\
| RGBController_EVGAGPUv1.cpp |
| |
| Generic RGB Interface for OpenRGB EVGA |
| GPU V1 (Pascal) Driver |
| |
| Adam Honse (CalcProgrammer1) 9/11/2020 |
\*-----------------------------------------*/
#include "RGBController_EVGAGPUv1.h"
RGBController_EVGAGPUv1::RGBController_EVGAGPUv1(EVGAGPUv1Controller* evga_ptr)
{
evga = evga_ptr;
name = "EVGA GPU";
description = "EVGA RGB v1 GPU Device";
location = evga->GetDeviceLocation();
type = DEVICE_TYPE_GPU;
mode Off;
Off.name = "Off";
Off.value = EVGA_GPU_V1_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Direct;
Direct.name = "Direct";
Direct.value = EVGA_GPU_V1_MODE_CUSTOM;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = EVGA_GPU_V1_MODE_RAINBOW;
Rainbow.flags = 0;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = EVGA_GPU_V1_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
SetupZones();
// Initialize active mode
active_mode = 0;
}
void RGBController_EVGAGPUv1::SetupZones()
{
/*---------------------------------------------------------*\
| This device only has one LED, so create a single zone and |
| LED for it |
\*---------------------------------------------------------*/
zone* new_zone = new zone();
led* new_led = new led();
new_zone->name = "GPU Zone";
new_zone->type = ZONE_TYPE_SINGLE;
new_zone->leds_min = 1;
new_zone->leds_max = 1;
new_zone->leds_count = 1;
new_zone->matrix_map = NULL;
new_led->name = "GPU LED";
/*---------------------------------------------------------*\
| Push the zone and LED on to device vectors |
\*---------------------------------------------------------*/
leds.push_back(*new_led);
zones.push_back(*new_zone);
SetupColors();
}
void RGBController_EVGAGPUv1::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_EVGAGPUv1::DeviceUpdateLEDs()
{
RGBColor color = colors[0];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
evga->SetColor(red, grn, blu);
}
void RGBController_EVGAGPUv1::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_EVGAGPUv1::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_EVGAGPUv1::SetCustomMode()
{
active_mode = 1;
}
void RGBController_EVGAGPUv1::DeviceUpdateMode()
{
evga->SetMode((unsigned char)modes[(unsigned int)active_mode].value);
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_EVGAGPUv1.h |
| |
| Generic RGB Interface for OpenRGB |
| EVGA GPU RGB V1 (Pascal) Driver |
| |
| Adam Honse (CalcProgrammer1) 9/11/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "EVGAGPUv1Controller.h"
class RGBController_EVGAGPUv1 : public RGBController
{
public:
RGBController_EVGAGPUv1(EVGAGPUv1Controller* evga_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:
EVGAGPUv1Controller* evga;
};

View file

@ -1,118 +0,0 @@
/*-----------------------------------------*\
| RGBController_EVGAGPUv2.cpp |
| |
| Generic RGB Interface for OpenRGB EVGA |
| GPU V2 (Pascal) Driver |
| |
| Adam Honse (CalcProgrammer1) 9/13/2020 |
\*-----------------------------------------*/
#include "RGBController_EVGAGPUv2.h"
RGBController_EVGAGPUv2::RGBController_EVGAGPUv2(EVGAGPUv2Controller* evga_ptr)
{
evga = evga_ptr;
name = "EVGA GPU";
description = "EVGA RGB v2 GPU Device";
location = evga->GetDeviceLocation();
type = DEVICE_TYPE_GPU;
mode Off;
Off.name = "Off";
Off.value = EVGA_GPU_V2_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Direct;
Direct.name = "Direct";
Direct.value = EVGA_GPU_V2_MODE_CUSTOM;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
// mode Rainbow;
// Rainbow.name = "Rainbow";
// Rainbow.value = EVGA_GPU_V2_MODE_RAINBOW;
// Rainbow.flags = 0;
// Rainbow.color_mode = MODE_COLORS_NONE;
// modes.push_back(Rainbow);
// mode Breathing;
// Breathing.name = "Breathing";
// Breathing.value = EVGA_GPU_V2_MODE_BREATHING;
// Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
// Breathing.color_mode = MODE_COLORS_PER_LED;
// modes.push_back(Breathing);
SetupZones();
// Initialize active mode
active_mode = 0;
}
void RGBController_EVGAGPUv2::SetupZones()
{
/*---------------------------------------------------------*\
| This device only has one LED, so create a single zone and |
| LED for it |
\*---------------------------------------------------------*/
zone* new_zone = new zone();
led* new_led = new led();
new_zone->name = "GPU Zone";
new_zone->type = ZONE_TYPE_SINGLE;
new_zone->leds_min = 1;
new_zone->leds_max = 1;
new_zone->leds_count = 1;
new_zone->matrix_map = NULL;
new_led->name = "GPU LED";
/*---------------------------------------------------------*\
| Push the zone and LED on to device vectors |
\*---------------------------------------------------------*/
leds.push_back(*new_led);
zones.push_back(*new_zone);
SetupColors();
}
void RGBController_EVGAGPUv2::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_EVGAGPUv2::DeviceUpdateLEDs()
{
RGBColor color = colors[0];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
evga->SetColor(red, grn, blu);
}
void RGBController_EVGAGPUv2::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_EVGAGPUv2::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_EVGAGPUv2::SetCustomMode()
{
active_mode = 1;
}
void RGBController_EVGAGPUv2::DeviceUpdateMode()
{
evga->SetMode((unsigned char)modes[(unsigned int)active_mode].value);
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_EVGAGPUv2.h |
| |
| Generic RGB Interface for OpenRGB |
| EVGA GPU RGB V2 (Turing) Driver |
| |
| Adam Honse (CalcProgrammer1) 9/13/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "EVGAGPUv2Controller.h"
class RGBController_EVGAGPUv2 : public RGBController
{
public:
RGBController_EVGAGPUv2(EVGAGPUv2Controller* evga_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:
EVGAGPUv2Controller* evga;
};

View file

@ -1,78 +0,0 @@
/*-----------------------------------------*\
| 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_LEDSTRIP;
description = "Espurna Device";
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();
}
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()
{
}

View file

@ -1,31 +0,0 @@
/*-----------------------------------------*\
| 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);
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;
};

View file

@ -1,175 +0,0 @@
#include "RGBController_Faustus.h"
#include "Detector.h"
#include <dirent.h>
#include <string.h>
RGBController_Faustus::RGBController_Faustus(const std::string& dev_path)
{
name = "ASUS TUF Keyboard";
type = DEVICE_TYPE_KEYBOARD;
description = "Faustus Device";
modes.resize(4);
modes[0].name = "Static";
modes[0].value = FAUSTUS_MODE_STATIC;
modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR;
modes[0].color_mode = MODE_COLORS_PER_LED;
modes[1].name = "Breathing";
modes[1].value = FAUSTUS_MODE_BREATHING;
modes[1].flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
modes[1].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[1].speed_max = FAUSTUS_SPEED_FASTEST;
modes[1].color_mode = MODE_COLORS_PER_LED;
modes[1].speed = FAUSTUS_SPEED_NORMAL;
modes[2].name = "Color Cycle";
modes[2].value = FAUSTUS_MODE_COLOR_CYCLE;
modes[2].flags = MODE_FLAG_HAS_SPEED;
modes[2].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[2].speed_max = FAUSTUS_SPEED_FASTEST;
modes[2].color_mode = MODE_COLORS_NONE;
modes[2].speed = FAUSTUS_SPEED_NORMAL;
modes[3].name = "Strobe";
modes[3].value = FAUSTUS_MODE_STROBE;
modes[3].flags = MODE_FLAG_HAS_SPEED;
modes[3].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[3].speed_max = FAUSTUS_SPEED_FASTEST;
modes[3].color_mode = MODE_COLORS_NONE;
modes[3].speed = FAUSTUS_SPEED_NORMAL;
SetupZones();
// Prepare file streams
r_path = dev_path;
g_path = dev_path;
b_path = dev_path;
mode_path = dev_path;
flags_path = dev_path;
set_path = dev_path;
r_path.append("/kbbl_red");
g_path.append("/kbbl_green");
b_path.append("/kbbl_blue");
mode_path.append("/kbbl_mode");
flags_path.append("/kbbl_flags");
set_path.append("/kbbl_set");
}
void RGBController_Faustus::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zones.resize(1);
zones[0].type = ZONE_TYPE_SINGLE;
zones[0].name = "Keyboard Backlight zone";
zones[0].leds_min = 1;
zones[0].leds_max = 1;
zones[0].leds_count = 1;
zones[0].matrix_map = NULL;
/*---------------------------------------------------------*\
| Set up LED |
\*---------------------------------------------------------*/
leds.resize(1);
leds[0].name = "Keyboard Backlight LED";
SetupColors();
}
void RGBController_Faustus::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_Faustus::DeviceUpdateLEDs()
{
int rv = uint8_t(RGBGetRValue(colors[0]));
int gv = uint8_t(RGBGetGValue(colors[0]));
int bv = uint8_t(RGBGetBValue(colors[0]));
std::ofstream str_r;
std::ofstream str_g;
std::ofstream str_b;
std::ofstream str_mode;
std::ofstream str_flags;
std::ofstream str_set;
str_r.open(r_path, std::ios::out | std::ios::trunc);
str_g.open(g_path, std::ios::out | std::ios::trunc);
str_b.open(b_path, std::ios::out | std::ios::trunc);
str_mode.open(mode_path, std::ios::out | std::ios::trunc);
str_flags.open(flags_path, std::ios::out | std::ios::trunc);
str_set.open(set_path, std::ios::out | std::ios::trunc);
str_r << std::hex;
str_g << std::hex;
str_b << std::hex;
str_mode << std::hex;
str_flags << std::hex;
str_set << std::hex;
str_r << rv;
str_g << gv;
str_b << bv;
str_mode << active_mode;
str_flags << 0x2a; // All of em
str_set << 2;
// Flush everything
str_r.close();
str_g.close();
str_b.close();
str_mode.close();
str_flags.close();
str_set.close();
}
void RGBController_Faustus::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_Faustus::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_Faustus::SetCustomMode()
{
SetMode(0);
}
void RGBController_Faustus::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
void DetectFaustusControllers(std::vector<RGBController*> &rgb_controllers)
{
const char* base_path = "/sys/devices/platform/faustus/kbbl";
DIR* dir = opendir(base_path);
if(!dir) return;
// Directory is present - we pretty much have a driver confirmation already, but double check for all files required just in case
struct dirent* dent = readdir(dir);
if(!dent) return;
int found = 0;
while(dent)
{
const char* fname = dent->d_name;
if(!strcmp(fname, "kbbl_red") || !strcmp(fname, "kbbl_green") || !strcmp(fname, "kbbl_blue") || !strcmp(fname, "kbbl_mode") || !strcmp(fname, "kbbl_flags") || !strcmp(fname, "kbbl_set"))
{
++found;
}
dent = readdir(dir);
}
closedir(dir);
if(found != 6) return;
rgb_controllers.push_back(new RGBController_Faustus(base_path));
} /* DetectFaustusControllers() */
REGISTER_DETECTOR("Faustus", DetectFaustusControllers);

View file

@ -1,46 +0,0 @@
#ifndef RGBCONTROLLER_FAUSTUS_H
#define RGBCONTROLLER_FAUSTUS_H
#include "RGBController.h"
#include <fstream>
enum
{
FAUSTUS_MODE_STATIC = 0,
FAUSTUS_MODE_BREATHING = 1,
FAUSTUS_MODE_COLOR_CYCLE = 2,
FAUSTUS_MODE_STROBE = 3
};
enum
{
FAUSTUS_SPEED_SLOWEST = 0,
FAUSTUS_SPEED_NORMAL = 1,
FAUSTUS_SPEED_FASTEST = 2,
};
class RGBController_Faustus : public RGBController
{
private:
std::string r_path;
std::string g_path;
std::string b_path;
std::string mode_path;
std::string flags_path;
std::string set_path;
public:
RGBController_Faustus(const std::string& dev_path);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
};
#endif // RGBCONTROLLER_FAUSTUS_H

View file

@ -1,165 +0,0 @@
/*-----------------------------------------*\
| RGBController_GalaxGPU.cpp |
| |
| Driver for Galax / KFA2 RGB on GPUs |
| |
| Niels Westphal (crashniels) 12.07.2020 |
\*-----------------------------------------*/
#include "RGBController_GalaxGPU.h"
int RGBController_GalaxGPU::GetDeviceMode()
{
int modereg1 = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER_1);
int modereg2 = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER_2);
if (modereg1 == GALAX_MODE_STATIC_VALUE_1 && modereg2 == GALAX_MODE_STATIC_VALUE_2)
{
active_mode = 1;
modes[active_mode].color_mode = MODE_COLORS_PER_LED;
}
if (modereg1 == GALAX_MODE_BREATHING_VALUE_1 && modereg2 == GALAX_MODE_BREATHING_VALUE_2)
{
active_mode = 2;
modes[active_mode].color_mode = MODE_COLORS_PER_LED;
}
if (modereg1 == GALAX_MODE_RAINBOW_VALUE_1 && modereg2 == GALAX_MODE_RAINBOW_VALUE_2)
{
active_mode = 3;
modes[active_mode].color_mode = MODE_COLORS_NONE;
}
if (modereg1 == GALAX_MODE_CYCLE_BREATHING_VALUE_1 && modereg2 == GALAX_MODE_CYCLE_BREATHING_VALUE_2)
{
active_mode = 4;
modes[active_mode].color_mode = MODE_COLORS_NONE;
}
return(active_mode);
}
RGBController_GalaxGPU::RGBController_GalaxGPU(GalaxGPUController * galax_gpu_ptr)
{
galax_gpu = galax_gpu_ptr;
name = galax_gpu->GetDeviceName();
type = DEVICE_TYPE_GPU;
description = "GALAX / KFA2 RTX GPU";
version = "1.0";
location = galax_gpu->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 1;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = 2;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = 3;
Rainbow.flags = 0;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Cycle_Breathing;
Cycle_Breathing.name = "Cycle Breathing";
Cycle_Breathing.value = 4;
Cycle_Breathing.flags = 0;
Cycle_Breathing.color_mode = MODE_COLORS_NONE;
modes.push_back(Cycle_Breathing);
SetupZones();
active_mode = GetDeviceMode();
}
void RGBController_GalaxGPU::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zone galax_gpu_zone;
galax_gpu_zone.name = "GPU";
galax_gpu_zone.type = ZONE_TYPE_SINGLE;
galax_gpu_zone.leds_min = 1;
galax_gpu_zone.leds_max = 1;
galax_gpu_zone.leds_count = 1;
galax_gpu_zone.matrix_map = NULL;
zones.push_back(galax_gpu_zone);
/*---------------------------------------------------------*\
| Set up LED |
\*---------------------------------------------------------*/
led galax_gpu_led;
galax_gpu_led.name = "GPU";
leds.push_back(galax_gpu_led);
SetupColors();
/*---------------------------------------------------------*\
| Initialize color |
\*---------------------------------------------------------*/
unsigned char red = galax_gpu->GetLEDRed();
unsigned char grn = galax_gpu->GetLEDGreen();
unsigned char blu = galax_gpu->GetLEDBlue();
colors[0] = ToRGBColor(red, grn, blu);
}
void RGBController_GalaxGPU::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_GalaxGPU::DeviceUpdateLEDs()
{
for(std::size_t led = 0; led < colors.size(); led++)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
if (GetMode() == 1)
{
galax_gpu->SetLEDColorsDirect(red, grn, blu);
}
else
{
galax_gpu->SetLEDColorsEffect(red, grn, blu);
}
}
}
void RGBController_GalaxGPU::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_GalaxGPU::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_GalaxGPU::SetCustomMode()
{
active_mode = 1;
}
void RGBController_GalaxGPU::DeviceUpdateMode()
{
int new_mode = modes[active_mode].value;
galax_gpu->SetMode(new_mode);
}

View file

@ -1,34 +0,0 @@
/*-----------------------------------------*\
| RGBController_GalaxGPU.h |
| |
| Driver for Galax / KFA2 RGB on GPUs |
| |
| Niels Westphal (crashniels) 12.07.2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "GalaxGPUController.h"
class RGBController_GalaxGPU : public RGBController
{
public:
RGBController_GalaxGPU(GalaxGPUController* galax_gpu_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
GalaxGPUController* galax_gpu;
int GetDeviceMode();
};

View file

@ -1,90 +0,0 @@
/*--------------------------------------------------------------*\
| RGBController_HoltekA070.cpp |
| |
| Generic RGB Interface for Holtek USB Gaming Mouse [04d9:a070] |
| |
| Santeri Pikarinen (santeri3700) 8/01/2020 |
\*--------------------------------------------------------------*/
#include "RGBController_HoltekA070.h"
RGBController_HoltekA070::RGBController_HoltekA070(HoltekA070Controller* holtek_ptr)
{
holtek = holtek_ptr;
name = "Holtek USB Gaming Mouse Device";
type = DEVICE_TYPE_MOUSE;
description = "Holtek USB Gaming Mouse Device";
mode Static;
Static.name = "Static";
Static.speed = HOLTEK_A070_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = HOLTEK_A070_MODE_BREATHING_SLOW;
Breathing.speed_max = HOLTEK_A070_MODE_BREATHING_FAST;
Breathing.speed = HOLTEK_A070_MODE_BREATHING_MEDIUM;
modes.push_back(Breathing);
SetupZones();
}
void RGBController_HoltekA070::SetupZones()
{
zone mouse_zone;
mouse_zone.name = "Mouse";
mouse_zone.type = ZONE_TYPE_SINGLE;
mouse_zone.leds_min = 1;
mouse_zone.leds_max = 1;
mouse_zone.leds_count = 1;
mouse_zone.matrix_map = NULL;
zones.push_back(mouse_zone);
led mouse_led;
mouse_led.name = "Mouse";
leds.push_back(mouse_led);
SetupColors();
}
void RGBController_HoltekA070::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_HoltekA070::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char green = RGBGetGValue(colors[0]);
unsigned char blue = RGBGetBValue(colors[0]);
holtek->SendCustomColor(red, green, blue);
}
void RGBController_HoltekA070::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_HoltekA070::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_HoltekA070::SetCustomMode()
{
}
void RGBController_HoltekA070::DeviceUpdateMode()
{
holtek->SendMode(modes[active_mode].speed);
}

View file

@ -1,30 +0,0 @@
/*--------------------------------------------------------------*\
| RGBController_HoltekA070.h |
| |
| Generic RGB Interface for Holtek USB Gaming Mouse [04d9:a070] |
| |
| Santeri Pikarinen (santeri3700) 8/01/2020 |
\*--------------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "HoltekA070Controller.h"
class RGBController_HoltekA070 : public RGBController
{
public:
RGBController_HoltekA070(HoltekA070Controller* holtek_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:
HoltekA070Controller* holtek;
};

View file

@ -1,295 +0,0 @@
/*-----------------------------------------*\
| RGBController_HuePlus.cpp |
| |
| Generic RGB Interface for NZXT Hue+ |
| |
| Adam Honse (CalcProgrammer1) 6/20/2019 |
\*-----------------------------------------*/
#include "RGBController_HuePlus.h"
RGBController_HuePlus::RGBController_HuePlus(HuePlusController* hueplus_ptr)
{
hueplus = hueplus_ptr;
name = "NZXT Hue+";
type = DEVICE_TYPE_LEDSTRIP;
description = "NZXT Hue+ Device";
location = hueplus->GetLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = HUE_PLUS_MODE_FIXED;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Fading;
Fading.name = "Fading";
Fading.value = HUE_PLUS_MODE_FADING;
Fading.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Fading.speed_min = HUE_PLUS_SPEED_SLOWEST;
Fading.speed_max = HUE_PLUS_SPEED_FASTEST;
Fading.colors_min = 1;
Fading.colors_max = 8;
Fading.speed = HUE_PLUS_SPEED_NORMAL;
Fading.color_mode = MODE_COLORS_MODE_SPECIFIC;
Fading.colors.resize(2);
modes.push_back(Fading);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = HUE_PLUS_MODE_SPECTRUM;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
SpectrumCycle.speed_min = HUE_PLUS_SPEED_SLOWEST;
SpectrumCycle.speed_max = HUE_PLUS_SPEED_FASTEST;
SpectrumCycle.speed = HUE_PLUS_SPEED_NORMAL;
SpectrumCycle.direction = MODE_DIRECTION_RIGHT;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = HUE_PLUS_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Marquee.speed_min = HUE_PLUS_SPEED_SLOWEST;
Marquee.speed_max = HUE_PLUS_SPEED_FASTEST;
Marquee.colors_min = 1;
Marquee.colors_max = 1;
Marquee.speed = HUE_PLUS_SPEED_NORMAL;
Marquee.direction = MODE_DIRECTION_RIGHT;
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
Marquee.colors.resize(1);
modes.push_back(Marquee);
mode CoverMarquee;
CoverMarquee.name = "Cover Marquee";
CoverMarquee.value = HUE_PLUS_MODE_COVER_MARQUEE;
CoverMarquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
CoverMarquee.speed_min = HUE_PLUS_SPEED_SLOWEST;
CoverMarquee.speed_max = HUE_PLUS_SPEED_FASTEST;
CoverMarquee.colors_min = 1;
CoverMarquee.colors_max = 8;
CoverMarquee.speed = HUE_PLUS_SPEED_NORMAL;
CoverMarquee.direction = MODE_DIRECTION_RIGHT;
CoverMarquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
CoverMarquee.colors.resize(2);
modes.push_back(CoverMarquee);
mode Alternating;
Alternating.name = "Alternating";
Alternating.value = HUE_PLUS_MODE_ALTERNATING;
Alternating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Alternating.speed_min = HUE_PLUS_SPEED_SLOWEST;
Alternating.speed_max = HUE_PLUS_SPEED_FASTEST;
Alternating.colors_min = 1;
Alternating.colors_max = 2;
Alternating.speed = HUE_PLUS_SPEED_NORMAL;
Alternating.direction = MODE_DIRECTION_RIGHT;
Alternating.color_mode = MODE_COLORS_MODE_SPECIFIC;
Alternating.colors.resize(2);
modes.push_back(Alternating);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = HUE_PLUS_MODE_PULSING;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Pulsing.speed_min = HUE_PLUS_SPEED_SLOWEST;
Pulsing.speed_max = HUE_PLUS_SPEED_FASTEST;
Pulsing.colors_min = 1;
Pulsing.colors_max = 8;
Pulsing.speed = HUE_PLUS_SPEED_NORMAL;
Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Pulsing.colors.resize(2);
modes.push_back(Pulsing);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HUE_PLUS_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = HUE_PLUS_SPEED_SLOWEST;
Breathing.speed_max = HUE_PLUS_SPEED_FASTEST;
Breathing.colors_min = 1;
Breathing.colors_max = 8;
Breathing.speed = HUE_PLUS_SPEED_NORMAL;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(2);
modes.push_back(Breathing);
mode Alert;
Alert.name = "Alert";
Alert.value = HUE_PLUS_MODE_ALERT;
Alert.flags = 0;
Alert.color_mode = MODE_COLORS_NONE;
modes.push_back(Alert);
mode Candlelight;
Candlelight.name = "Candlelight";
Candlelight.value = HUE_PLUS_MODE_CANDLELIGHT;
Candlelight.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Candlelight.colors_min = 1;
Candlelight.colors_max = 1;
Candlelight.color_mode = MODE_COLORS_MODE_SPECIFIC;
Candlelight.colors.resize(1);
modes.push_back(Candlelight);
mode Wings;
Wings.name = "Wings";
Wings.value = HUE_PLUS_MODE_WINGS;
Wings.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Wings.speed_min = HUE_PLUS_SPEED_SLOWEST;
Wings.speed_max = HUE_PLUS_SPEED_FASTEST;
Wings.colors_min = 1;
Wings.colors_max = 1;
Wings.speed = HUE_PLUS_SPEED_NORMAL;
Wings.color_mode = MODE_COLORS_MODE_SPECIFIC;
Wings.colors.resize(1);
modes.push_back(Wings);
mode Wave;
Wave.name = "Wave";
Wave.value = HUE_PLUS_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Wave.speed_min = HUE_PLUS_SPEED_SLOWEST;
Wave.speed_max = HUE_PLUS_SPEED_FASTEST;
Wave.speed = HUE_PLUS_SPEED_NORMAL;
Wave.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Wave);
SetupZones();
}
void RGBController_HuePlus::SetupZones()
{
/*-------------------------------------------------*\
| Only set LED count on the first run |
\*-------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = true;
}
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
leds.clear();
colors.clear();
zones.resize(HUE_PLUS_NUM_CHANNELS);
/*-------------------------------------------------*\
| Set up zones |
\*-------------------------------------------------*/
for(unsigned int zone_idx = 0; zone_idx < HUE_PLUS_NUM_CHANNELS; zone_idx++)
{
zones[zone_idx].name = "Hue+ Channel ";
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
zones[zone_idx].type = ZONE_TYPE_LINEAR;
zones[zone_idx].leds_min = 0;
zones[zone_idx].leds_max = 40;
zones[zone_idx].matrix_map = NULL;
if(first_run)
{
zones[zone_idx].leds_count = 0;
}
}
/*-------------------------------------------------*\
| Set up LEDs |
\*-------------------------------------------------*/
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 = "Hue+ Channel ";
new_led.name.append(std::to_string(zone_idx + 1));
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_idx + 1));
new_led.value = zone_idx;
leds.push_back(new_led);
}
}
SetupColors();
}
void RGBController_HuePlus::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_HuePlus::DeviceUpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
hueplus->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
}
}
void RGBController_HuePlus::UpdateZoneLEDs(int zone)
{
hueplus->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
}
void RGBController_HuePlus::UpdateSingleLED(int led)
{
unsigned int zone_idx = leds[led].value;
hueplus->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
}
void RGBController_HuePlus::SetCustomMode()
{
active_mode = 0;
}
void RGBController_HuePlus::DeviceUpdateMode()
{
if(modes[active_mode].value == HUE_PLUS_MODE_FIXED)
{
DeviceUpdateLEDs();
}
else
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
RGBColor* colors = NULL;
bool direction = false;
if(modes[active_mode].direction == MODE_DIRECTION_LEFT)
{
direction = true;
}
if(modes[active_mode].colors.size() > 0)
{
colors = &modes[active_mode].colors[0];
}
hueplus->SetChannelEffect
(
zone_idx,
modes[active_mode].value,
modes[active_mode].speed,
direction,
colors,
modes[active_mode].colors.size()
);
}
}
}

View file

@ -1,34 +0,0 @@
/*-----------------------------------------*\
| RGBController_HuePlus.h |
| |
| Generic RGB Interface for NZXT Hue+ |
| |
| Adam Honse (CalcProgrammer1) 6/20/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "serial_port.h"
#include "HuePlusController.h"
class RGBController_HuePlus : public RGBController
{
public:
RGBController_HuePlus(HuePlusController* hueplus_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:
HuePlusController* hueplus;
std::vector<unsigned int> leds_channel;
std::vector<unsigned int> zones_channel;
};

View file

@ -1,326 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXAlloyOrigins.cpp |
| |
| Generic RGB Interface for HyperX Alloy |
| Origins RGB Keyboard |
| |
| Adam Honse (CalcProgrammer1) 7/11/2020 |
\*-----------------------------------------*/
#include "RGBController_HyperXAlloyOrigins.h"
//Include thread libraries for Windows or Linux
#ifdef WIN32
#include <process.h>
#else
#include "pthread.h"
#include "unistd.h"
#endif
//Thread functions have different types in Windows and Linux
#ifdef WIN32
#define THREAD static void
#define THREADRETURN
#else
#define THREAD static void*
#define THREADRETURN return(NULL);
#endif
using namespace std::chrono_literals;
THREAD keepalive_thread(void *param)
{
RGBController_HyperXAlloyOrigins* controller = static_cast<RGBController_HyperXAlloyOrigins*>(param);
controller->KeepaliveThread();
THREADRETURN
}
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 11, 17, 22, 27, NA, 33, 38, 43, 49, NA, 54, 60, 64, 68, 74, 78, 83, NA, NA, NA, NA },
{ 1, 6, 12, 18, 23, 28, 34, 39, 44, 50, 55, NA, 61, 65, 69, NA, 75, 79, 84, 87, 92, 96, 101 },
{ 2, NA, 7, 13, 19, 24, NA, 29, 35, 40, 45, 51, 56, 62, 66, 70, 76, 80, 85, 88, 93, 97, 102 },
{ 3, NA, 8, 14, 20, 25, NA, 30, 36, 41, 46, 52, 57, 63, 71, NA, NA, NA, NA, 89, 94, 98, NA },
{ 4, NA, 9, 15, 21, 26, NA, 31, NA, 37, 42, 47, 53, 58, 72, NA, NA, 81, NA, 90, 95, 99, 103 },
{ 5, 10, 16, NA, NA, NA, NA, 32, NA, NA, NA, NA, 48, 59, 67, 73, 77, 82, 86, 91, NA, 100, NA } };
static const char* zone_names[] =
{
"Keyboard",
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
104,
};
static const char *led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
// Skip index 6
"Key: 1",
"Key: Q",
"Key: A",
"Key: Z",
"Key: Left Windows",
"Key: F1",
"Key: 2",
"Key: W",
"Key: S",
"Key: X",
"Key: Left Alt",
"Key: F2",
"Key: 3",
"Key: E",
"Key: D",
"Key: C",
// Skip index 23
"Key: F3",
"Key: 4",
"Key: R",
"Key: F",
"Key: V",
// Skip index 29
"Key: F4",
"Key: 5",
"Key: T",
"Key: G",
"Key: B",
"Key: Space",
"Key: F5",
"Key: 6",
"Key: Y",
"Key: H",
"Key: N",
// Skip index 41
"Key: F6",
"Key: 7",
"Key: U",
"Key: J",
"Key: M",
// Skip index 47
"Key: F7",
"Key: 8",
"Key: I",
"Key: K",
"Key: ,",
"Key: Right Alt",
"Key: F8",
"Key: 9",
"Key: O",
"Key: L",
"Key: .",
// Skip index 59
"Key: F9",
"Key: 0",
"Key: P",
"Key: ;",
"Key: /",
"Key: Fn",
"Key: F10",
"Key: -",
"Key: [",
"Key: '",
// Skip index 70
// Skip index 71
"Key: F11",
"Key: =",
"Key: ]",
// Skip index 75
// Skip index 76
"Key: Menu",
"Key: F12",
"Key: Backspace",
"Key: \\ (ANSI)",
"Key: Enter",
"Key: Right Shift",
"Key: Right Control",
"Key: Print Screen",
"Key: Insert",
"Key: Delete",
// Skip index 87
// Skip index 88
"Key: Left Arrow",
"Key: Scroll Lock",
"Key: Home",
"Key: End",
// Skip index 93
"Key: Up Arrow",
"Key: Down Arrow",
"Key: Pause/Break",
"Key: Page Up",
"Key: Page Down",
// Skip index 99
// Skip index 100
"Key: Right Arrow",
// Skip index 102
"Key: Num Lock",
"Key: Number Pad 7",
"Key: Number Pad 4",
"Key: Number Pad 1",
"Key: Number Pad 0",
// Skip index 108
"Key: Number Pad /",
"Key: Number Pad 8",
"Key: Number Pad 5",
"Key: Number Pad 2",
// Skip index 113
// Skip index 114
"Key: Number Pad *",
"Key: Number Pad 9",
"Key: Number Pad 6",
"Key: Number Pad 3",
"Key: Number Pad .",
// Skip index 120
"Key: Number Pad -",
"Key: Number Pad +",
// Skip index 123
// Skip index 124
"Key: Number Pad Enter",
};
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr)
{
hyperx = hyperx_ptr;
name = "HyperX Alloy Origins Keyboard Device";
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX Alloy Origins Keyboard Device";
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
/*-----------------------------------------------------*\
| The Corsair Lighting Node Pro requires a packet within|
| 20 seconds of sending the lighting change in order |
| to not revert back into rainbow mode. Start a thread |
| to continuously send a keepalive packet every 5s |
\*-----------------------------------------------------*/
#ifdef WIN32
_beginthread(keepalive_thread, 0, this);
#else
pthread_t thread;
pthread_create(&thread, NULL, &keepalive_thread, this);
#endif
}
RGBController_HyperXAlloyOrigins::~RGBController_HyperXAlloyOrigins()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_HyperXAlloyOrigins::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];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
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_HyperXAlloyOrigins::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_HyperXAlloyOrigins::DeviceUpdateLEDs()
{
hyperx->SetLEDsDirect(colors);
}
void RGBController_HyperXAlloyOrigins::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXAlloyOrigins::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXAlloyOrigins::SetCustomMode()
{
}
void RGBController_HyperXAlloyOrigins::DeviceUpdateMode()
{
}
void RGBController_HyperXAlloyOrigins::KeepaliveThread()
{
while(1)
{
if(active_mode == 0)
{
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
{
UpdateLEDs();
}
}
std::this_thread::sleep_for(10ms);;
}
}

View file

@ -1,39 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXAlloyOrigins.h |
| |
| Generic RGB Interface for HyperX Alloy |
| Origins RGB Keyboard |
| |
| Adam Honse (CalcProgrammer1) 7/11/2020 |
\*-----------------------------------------*/
#pragma once
#include <chrono>
#include "RGBController.h"
#include "HyperXAlloyOriginsController.h"
class RGBController_HyperXAlloyOrigins : public RGBController
{
public:
RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr);
~RGBController_HyperXAlloyOrigins();
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:
HyperXAlloyOriginsController* hyperx;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};

View file

@ -1,253 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXDRAM.cpp |
| |
| Generic RGB Interface for OpenAuraSDK |
| HyperX Predator and Fury RGB interface |
| |
| Adam Honse (CalcProgrammer1) 6/29/2019 |
\*-----------------------------------------*/
#include "RGBController_HyperXDRAM.h"
RGBController_HyperXDRAM::RGBController_HyperXDRAM(HyperXDRAMController* hyperx_ptr)
{
hyperx = hyperx_ptr;
name = hyperx->GetDeviceName();
type = DEVICE_TYPE_DRAM;
description = "HyperX DRAM Device";
location = hyperx->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = HYPERX_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = HYPERX_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = HYPERX_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = HYPERX_SPEED_RAINBOW_SLOW;
Rainbow.speed_max = HYPERX_SPEED_RAINBOW_FAST;
Rainbow.speed = HYPERX_SPEED_RAINBOW_NORMAL;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Comet;
Comet.name = "Comet";
Comet.value = HYPERX_MODE_COMET;
Comet.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Comet.speed_min = HYPERX_SPEED_COMET_SLOW;
Comet.speed_max = HYPERX_SPEED_COMET_FAST;
Comet.colors_min = 1;
Comet.colors_max = 1;
Comet.speed = HYPERX_SPEED_COMET_NORMAL;
Comet.color_mode = MODE_COLORS_MODE_SPECIFIC;
Comet.colors.resize(1);
modes.push_back(Comet);
mode Heartbeat;
Heartbeat.name = "Heartbeat";
Heartbeat.value = HYPERX_MODE_HEARTBEAT;
Heartbeat.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Heartbeat.speed_min = HYPERX_SPEED_COMET_SLOW;
Heartbeat.speed_max = HYPERX_SPEED_COMET_FAST;
Heartbeat.colors_min = 1;
Heartbeat.colors_max = 1;
Heartbeat.speed = HYPERX_SPEED_COMET_NORMAL;
Heartbeat.color_mode = MODE_COLORS_MODE_SPECIFIC;
Heartbeat.colors.resize(1);
modes.push_back(Heartbeat);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = HYPERX_MODE_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
SpectrumCycle.speed_min = HYPERX_SPEED_CYCLE_SLOW;
SpectrumCycle.speed_max = HYPERX_SPEED_CYCLE_FAST;
SpectrumCycle.speed = HYPERX_SPEED_CYCLE_NORMAL;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HYPERX_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Breathing.speed_min = HYPERX_SPEED_BREATHING_SLOW;
Breathing.speed_max = HYPERX_SPEED_BREATHING_FAST;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.speed = HYPERX_SPEED_BREATHING_NORMAL;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode Bounce;
Bounce.name = "Bounce";
Bounce.value = HYPERX_MODE_BOUNCE;
Bounce.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Bounce.speed_min = HYPERX_SPEED_BOUNCE_SLOW;
Bounce.speed_max = HYPERX_SPEED_BOUNCE_FAST;
Bounce.colors_min = 1;
Bounce.colors_max = 1;
Bounce.speed = HYPERX_SPEED_BOUNCE_NORMAL;
Bounce.color_mode = MODE_COLORS_MODE_SPECIFIC;
Bounce.colors.resize(1);
modes.push_back(Bounce);
mode Blink;
Blink.name = "Blink";
Blink.value = HYPERX_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Blink.speed_min = HYPERX_SPEED_BLINK_SLOW;
Blink.speed_max = HYPERX_SPEED_BLINK_FAST;
Blink.colors_min = 1;
Blink.colors_max = 1;
Blink.speed = HYPERX_SPEED_BLINK_NORMAL;
Blink.color_mode = MODE_COLORS_MODE_SPECIFIC;
Blink.colors.resize(1);
modes.push_back(Blink);
SetupZones();
}
void RGBController_HyperXDRAM::SetupZones()
{
for(unsigned int slot = 0; slot < hyperx->GetSlotCount(); slot++)
{
zone* new_zone = new zone;
new_zone->name = "HyperX Slot ";
new_zone->name.append(std::to_string(slot + 1));
new_zone->type = ZONE_TYPE_LINEAR;
new_zone->leds_min = 5;
new_zone->leds_max = 5;
new_zone->leds_count = 5;
new_zone->matrix_map = NULL;
zones.push_back(*new_zone);
}
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
{
led* new_led = new led();
new_led->name = "HyperX Slot ";
new_led->name.append(std::to_string(zone_idx + 1));
new_led->name.append(", LED ");
new_led->name.append(std::to_string(led_idx + 1));
new_led->value = leds.size();
leds.push_back(*new_led);
}
}
SetupColors();
}
void RGBController_HyperXDRAM::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_HyperXDRAM::DeviceUpdateLEDs()
{
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
{
for (std::size_t led_idx = 0; led_idx < colors.size(); led_idx++ )
{
RGBColor color = colors[led_idx];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
hyperx->SetLEDColor(led_idx, red, grn, blu);
}
}
else
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
hyperx->SetEffectColor(red, grn, blu);
}
}
void RGBController_HyperXDRAM::UpdateZoneLEDs(int zone)
{
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
{
for (std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++ )
{
unsigned int led = zones[zone].leds[led_idx].value;
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
hyperx->SetLEDColor(led, red, grn, blu);
}
}
else
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
hyperx->SetEffectColor(red, grn, blu);
}
}
void RGBController_HyperXDRAM::UpdateSingleLED(int led)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
{
hyperx->SetLEDColor(led, red, grn, blu);
}
else
{
hyperx->SetEffectColor(red, grn, blu);
}
}
void RGBController_HyperXDRAM::SetCustomMode()
{
active_mode = 0;
}
void RGBController_HyperXDRAM::DeviceUpdateMode()
{
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
hyperx->SetMode(modes[active_mode].value, random, modes[active_mode].speed);
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
unsigned char red = RGBGetRValue(modes[active_mode].colors[0]);
unsigned char grn = RGBGetGValue(modes[active_mode].colors[0]);
unsigned char blu = RGBGetBValue(modes[active_mode].colors[0]);
hyperx->SetEffectColor(red, grn, blu);
}
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXDRAM.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| HyperX Predator and Fury RGB interface |
| |
| Adam Honse (CalcProgrammer1) 6/29/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "HyperXDRAMController.h"
class RGBController_HyperXDRAM : public RGBController
{
public:
RGBController_HyperXDRAM(HyperXDRAMController* hyperx_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:
HyperXDRAMController* hyperx;
};

View file

@ -1,358 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXKeyboard.cpp |
| |
| Generic RGB Interface for HyperX RGB |
| Keyboard |
| |
| Adam Honse (CalcProgrammer1) 2/2/2020 |
\*-----------------------------------------*/
#include "RGBController_HyperXKeyboard.h"
using namespace std::chrono_literals;
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 16, 30, 44, 54, NA, 65, 75, 84, 95, NA, 8, 23 , 38, 6 , 22, 36, 49, NA, NA, NA, NA },
{ 1, 17, 31, 45, 55, 66, 76, 85, 96, 9, 24, NA, 39, 7 , 37, NA , 60, 70, 80, 52, 63, 73, 82 },
{ 2, NA, 18, 32, 46, 56, NA, 67, 77, 86, 97, 10, 25, 40 , 90, 101, 50, 61, 71, 51, 62, 72, 93 },
{ 3, NA, 19, 33, 47, 57, NA, 68, 78, 87, 98, 11, 26, 41 , 28, 14 , NA, NA, NA, 92, 103, 53, NA },
{ 4, 20, 34, 48, 58, 69, NA, 79, NA, 88, 99, 12, 27, 42 , 81, NA , NA, 102, NA, 64, 74, 83, 104 },
{ 5, 21, 35, NA, NA, NA, NA, 59, NA, NA, NA, NA, 89, 100, 13, 91 , 15, 29, 43, 94, NA, 105, NA } };
static const char* zone_names[] =
{
"Keyboard",
"RGB Strip",
"Media Keys"
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
ZONE_TYPE_LINEAR,
ZONE_TYPE_SINGLE
};
static const unsigned int zone_sizes[] =
{
106,
18,
4
};
static const char *led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Key: F12",
"Key: =",
"Key: F9",
"Key: 9",
"Key: O",
"Key: L",
"Key: ,",
"Key: Menu",
"Key: Enter (ISO)",
"Key: Left Arrow",
"Key: F1",
"Key: 1",
"Key: Q",
"Key: A",
"Key: \\ (ISO)",
"Key: Left Windows",
"Key: Print Screen",
"Key: F10",
"Key: 0",
"Key: P",
"Key: ;",
"Key: .",
"Key: Enter",
"Key: Down Arrow",
"Key: F2",
"Key: 2",
"Key: W",
"Key: S",
"Key: Z",
"Key: Left Alt",
"Key: Scroll Lock",
"Key: Backspace",
"Key: F11",
"Key: -",
"Key: [",
"Key: '",
"Key: /",
"Key: Right Arrow",
"Key: F3",
"Key: 3",
"Key: E",
"Key: D",
"Key: X",
"Key: Pause/Break",
"Key: Delete",
"Key: Number Pad 7",
"Key: Num Lock",
"Key: Number Pad 6",
"Key: F4",
"Key: 4",
"Key: R",
"Key: F",
"Key: C",
"Key: Space",
"Key: Insert",
"Key: End",
"Key: Number Pad 8",
"Key: Number Pad /",
"Key: Number Pad 1",
"Key: F5",
"Key: 5",
"Key: T",
"Key: G",
"Key: V",
"Key: Home",
"Key: Page Down",
"Key: Number Pad 9",
"Key: Number Pad *",
"Key: Number Pad 2",
"Key: F6",
"Key: 6",
"Key: Y",
"Key: H",
"Key: B",
"Key: Page Up",
"Key: Right Shift",
"Key: Number Pad -",
"Key: Number Pad 3",
"Key: F7",
"Key: 7",
"Key: U",
"Key: J",
"Key: N",
"Key: Right Alt",
"Key: ]",
"Key: Right Control",
"Key: Number Pad 4",
"Key: Number Pad +",
"Key: Number Pad 0",
"Key: F8",
"Key: 8",
"Key: I",
"Key: K",
"Key: M",
"Key: Right Windows",
"Key: \\ (ANSI)",
"Key: Up Arrow",
"Key: Number Pad 5",
"Key: Number Pad Enter",
"Key: Number Pad .",
"RGB Strip 1",
"RGB Strip 2",
"RGB Strip 3",
"RGB Strip 4",
"RGB Strip 5",
"RGB Strip 6",
"RGB Strip 7",
"RGB Strip 8",
"RGB Strip 9",
"RGB Strip 10",
"RGB Strip 11",
"RGB Strip 12",
"RGB Strip 13",
"RGB Strip 14",
"RGB Strip 15",
"RGB Strip 16",
"RGB Strip 17",
"RGB Strip 18",
"Key: Media Previous",
"Key: Media Play/Pause",
"Key: Media Next",
"Key: Media Mute"
};
RGBController_HyperXKeyboard::RGBController_HyperXKeyboard(HyperXKeyboardController* hyperx_ptr)
{
hyperx = hyperx_ptr;
name = "HyperX RGB Keyboard";
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX RGB Keyboard Device";
mode Direct;
Direct.name = "Direct";
Direct.value = HYPERX_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = HYPERX_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Wave;
Wave.name = "Wave";
Wave.value = HYPERX_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
Wave.speed_min = 0x00;
Wave.speed_max = 0x09;
Wave.color_mode = MODE_COLORS_NONE;
Wave.speed = 0x09;
Wave.direction = MODE_DIRECTION_LEFT;
modes.push_back(Wave);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HYPERX_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Breathing.speed_min = 0x00;
Breathing.speed_max = 0x09;
Breathing.colors_min = 1;
Breathing.colors_max = 2;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed = 0x09;
Breathing.colors.resize(2);
modes.push_back(Breathing);
SetupZones();
/*-----------------------------------------------------*\
| The Corsair Lighting Node Pro requires a packet within|
| 20 seconds of sending the lighting change in order |
| to not revert back into rainbow mode. Start a thread |
| to continuously send a keepalive packet every 5s |
\*-----------------------------------------------------*/
KeepaliveThreadRunning = true;
KeepaliveThread = new std::thread(&RGBController_HyperXKeyboard::KeepaliveThreadFunction, this);
}
RGBController_HyperXKeyboard::~RGBController_HyperXKeyboard()
{
KeepaliveThreadRunning = false;
KeepaliveThread->join();
delete KeepaliveThread;
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_HyperXKeyboard::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 3; 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];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
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_HyperXKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_HyperXKeyboard::DeviceUpdateLEDs()
{
last_update_time = std::chrono::steady_clock::now();
if(active_mode == 0)
{
hyperx->SetLEDsDirect(colors);
}
else
{
hyperx->SetLEDs(colors);
}
}
void RGBController_HyperXKeyboard::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXKeyboard::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXKeyboard::SetCustomMode()
{
active_mode = 0;
}
void RGBController_HyperXKeyboard::DeviceUpdateMode()
{
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
hyperx->SetMode(modes[active_mode].value, modes[active_mode].direction, modes[active_mode].speed, modes[active_mode].colors);
}
else
{
std::vector<RGBColor> temp_colors;
hyperx->SetMode(modes[active_mode].value, modes[active_mode].direction, modes[active_mode].speed, temp_colors);
}
}
void RGBController_HyperXKeyboard::KeepaliveThreadFunction()
{
while(KeepaliveThreadRunning)
{
if(active_mode == 0)
{
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
{
UpdateLEDs();
}
}
std::this_thread::sleep_for(10ms);;
}
}

View file

@ -1,44 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXKeyboard.h |
| |
| Generic RGB Interface for HyperX RGB |
| Keyboard |
| |
| Adam Honse (CalcProgrammer1) 2/2/2020 |
\*-----------------------------------------*/
#pragma once
#include <atomic>
#include <chrono>
#include <thread>
#include "RGBController.h"
#include "HyperXKeyboardController.h"
class RGBController_HyperXKeyboard : public RGBController
{
public:
RGBController_HyperXKeyboard(HyperXKeyboardController* hyperx_ptr);
~RGBController_HyperXKeyboard();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void KeepaliveThreadFunction();
private:
HyperXKeyboardController* hyperx;
std::atomic<bool> KeepaliveThreadRunning;
std::thread* KeepaliveThread;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};

View file

@ -1,169 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXPulsefireSurge.cpp |
| |
| Generic RGB Interface for HyperX |
| Pulsefire Surge |
| |
| Adam Honse (CalcProgrammer1) 2/2/2020 |
\*-----------------------------------------*/
#include "RGBController_HyperXPulsefireSurge.h"
//Include thread libraries for Windows or Linux
#ifdef WIN32
#include <process.h>
#else
#include "pthread.h"
#include "unistd.h"
#endif
//Thread functions have different types in Windows and Linux
#ifdef WIN32
#define THREAD static void
#define THREADRETURN
#else
#define THREAD static void*
#define THREADRETURN return(NULL);
#endif
using namespace std::chrono_literals;
THREAD keepalive_thread(void *param)
{
RGBController_HyperXPulsefireSurge* controller = static_cast<RGBController_HyperXPulsefireSurge*>(param);
controller->KeepaliveThread();
THREADRETURN
}
RGBController_HyperXPulsefireSurge::RGBController_HyperXPulsefireSurge(HyperXPulsefireSurgeController* hyperx_ptr)
{
hyperx = hyperx_ptr;
name = "HyperX Pulsefire Surge Device";
type = DEVICE_TYPE_MOUSE;
description = "HyperX Pulsefire Surge Device";
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
/*-----------------------------------------------------*\
| The Corsair Lighting Node Pro requires a packet within|
| 20 seconds of sending the lighting change in order |
| to not revert back into rainbow mode. Start a thread |
| to continuously send a keepalive packet every 5s |
\*-----------------------------------------------------*/
#ifdef WIN32
_beginthread(keepalive_thread, 0, this);
#else
pthread_t thread;
pthread_create(&thread, NULL, &keepalive_thread, this);
#endif
};
RGBController_HyperXPulsefireSurge::~RGBController_HyperXPulsefireSurge()
{
}
void RGBController_HyperXPulsefireSurge::SetupZones()
{
zone led_strip;
led_strip.name = "LED Strip";
led_strip.type = ZONE_TYPE_LINEAR;
led_strip.leds_min = 32;
led_strip.leds_max = 32;
led_strip.leds_count = 32;
led_strip.matrix_map = NULL;
zones.push_back(led_strip);
zone logo;
logo.name = "Logo";
logo.type = ZONE_TYPE_SINGLE;
logo.leds_min = 1;
logo.leds_max = 1;
logo.leds_count = 1;
logo.matrix_map = NULL;
zones.push_back(logo);
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;
if(zones[zone_idx].leds_count > 1)
{
new_led.name.append(" LED ");
new_led.name.append(std::to_string(led_idx + 1));
}
leds.push_back(new_led);
}
}
SetupColors();
}
void RGBController_HyperXPulsefireSurge::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_HyperXPulsefireSurge::DeviceUpdateLEDs()
{
last_update_time = std::chrono::steady_clock::now();
if(active_mode == 0)
{
hyperx->SendDirect(&colors[0]);
}
else
{
}
}
void RGBController_HyperXPulsefireSurge::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXPulsefireSurge::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXPulsefireSurge::SetCustomMode()
{
active_mode = 0;
}
void RGBController_HyperXPulsefireSurge::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
void RGBController_HyperXPulsefireSurge::KeepaliveThread()
{
while(1)
{
if(active_mode == 0)
{
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
{
UpdateLEDs();
}
}
std::this_thread::sleep_for(10ms);
}
}

View file

@ -1,39 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXPulsefireSurge.h |
| |
| Generic RGB Interface for HyperX |
| Pulsefire Surge |
| |
| Adam Honse (CalcProgrammer1) 7/25/2020 |
\*-----------------------------------------*/
#pragma once
#include <chrono>
#include "RGBController.h"
#include "HyperXPulsefireSurgeController.h"
class RGBController_HyperXPulsefireSurge : public RGBController
{
public:
RGBController_HyperXPulsefireSurge(HyperXPulsefireSurgeController* hyperx_ptr);
~RGBController_HyperXPulsefireSurge();
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:
HyperXPulsefireSurgeController* hyperx;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};

View file

@ -1,84 +0,0 @@
/*-----------------------------------------*\
| RGBController_LEDStrip.cpp |
| |
| Generic RGB Interface for OpenAuraSDK |
| KeyboardVisualizer LED strip interface |
| |
| Adam Honse (CalcProgrammer1) 6/20/2019 |
\*-----------------------------------------*/
#include "RGBController_LEDStrip.h"
RGBController_LEDStrip::RGBController_LEDStrip(LEDStripController* ledstrip_ptr)
{
strip = ledstrip_ptr;
name = "LED Strip";
type = DEVICE_TYPE_LEDSTRIP;
description = "Keyboard Visualizer Arduino LED Strip Device";
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();
}
void RGBController_LEDStrip::SetupZones()
{
zone led_zone;
led_zone.name = "LED Strip";
led_zone.type = ZONE_TYPE_LINEAR;
led_zone.leds_min = strip->num_leds;
led_zone.leds_max = strip->num_leds;
led_zone.leds_count = strip->num_leds;
led_zone.matrix_map = NULL;
zones.push_back(led_zone);
for(int led_idx = 0; led_idx < strip->num_leds; led_idx++)
{
led new_led;
new_led.name = "LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_LEDStrip::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LEDStrip::DeviceUpdateLEDs()
{
strip->SetLEDs(colors);
}
void RGBController_LEDStrip::UpdateZoneLEDs(int /*zone*/)
{
strip->SetLEDs(colors);
}
void RGBController_LEDStrip::UpdateSingleLED(int /*led*/)
{
strip->SetLEDs(colors);
}
void RGBController_LEDStrip::SetCustomMode()
{
}
void RGBController_LEDStrip::DeviceUpdateMode()
{
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_LEDStrip.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| KeyboardVisualizer LED strip interface |
| |
| Adam Honse (CalcProgrammer1) 6/20/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "serial_port.h"
#include "LEDStripController.h"
class RGBController_LEDStrip : public RGBController
{
public:
RGBController_LEDStrip(LEDStripController* ledstrip_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:
LEDStripController* strip;
};

View file

@ -1,86 +0,0 @@
/*-----------------------------------------*\
| RGBController_LinuxLED.cpp |
| |
| Generic RGB Interface for Linux LED |
| |
| Adam Honse (CalcProgrammer1) 9/25/2020 |
\*-----------------------------------------*/
#include "RGBController_LinuxLED.h"
RGBController_LinuxLED::RGBController_LinuxLED(LinuxLEDController* controller_ptr)
{
controller = controller_ptr;
name = "Linux LED";
type = DEVICE_TYPE_LEDSTRIP;
description = "Linux Sysfs LED Device";
location = "R: " + controller->GetRedPath() + "\r\n" +
"G: " + controller->GetGreenPath() + "\r\n" +
"B: " + controller->GetBluePath();
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();
}
void RGBController_LinuxLED::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_LinuxLED::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LinuxLED::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
controller->SetRGB(red, grn, blu);
}
void RGBController_LinuxLED::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LinuxLED::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_LinuxLED::SetCustomMode()
{
}
void RGBController_LinuxLED::DeviceUpdateMode()
{
}

View file

@ -1,31 +0,0 @@
/*-----------------------------------------*\
| RGBController_LinuxLED.h |
| |
| Generic RGB Interface for Linux LED |
| |
| Adam Honse (CalcProgrammer1) 9/25/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LinuxLEDController.h"
class RGBController_LinuxLED : public RGBController
{
public:
RGBController_LinuxLED(LinuxLEDController* 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:
LinuxLEDController* controller;
};

View file

@ -1,109 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG203.cpp |
| |
| Generic RGB Interface for Logitech G203 |
| Prodigy RGB Mouse |
| |
| Adam Honse (CalcProgrammer1) 5/17/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechG203.h"
RGBController_LogitechG203::RGBController_LogitechG203(LogitechG203Controller* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Mouse Device";
type = DEVICE_TYPE_MOUSE;
description = "Logitech Mouse Device";
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G203_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G203_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G203_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G203_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G203_SPEED_FASTEST;
Cycle.speed = LOGITECH_G203_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G203_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G203_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G203_SPEED_FASTEST;
Breathing.speed = LOGITECH_G203_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
void RGBController_LogitechG203::SetupZones()
{
zone g203_zone;
g203_zone.name = "Mouse";
g203_zone.type = ZONE_TYPE_SINGLE;
g203_zone.leds_min = 1;
g203_zone.leds_max = 1;
g203_zone.leds_count = 1;
g203_zone.matrix_map = NULL;
zones.push_back(g203_zone);
led g203_led;
g203_led.name = "Mouse";
leds.push_back(g203_led);
SetupColors();
}
void RGBController_LogitechG203::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG203::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu);
}
void RGBController_LogitechG203::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechG203::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechG203::SetCustomMode()
{
}
void RGBController_LogitechG203::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,32 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG203.h |
| |
| Generic RGB Interface for Logitech G203 |
| Prodigy RGB Mouse |
| |
| Adam Honse (CalcProgrammer1) 5/17/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechG203Controller.h"
class RGBController_LogitechG203 : public RGBController
{
public:
RGBController_LogitechG203(LogitechG203Controller* logitech_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:
LogitechG203Controller* logitech;
};

View file

@ -1,168 +0,0 @@
#include "RGBController_LogitechG203L.h"
RGBController_LogitechG203L::RGBController_LogitechG203L(LogitechG203LController* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Mouse Device";
type = DEVICE_TYPE_MOUSE;
description = "Logitech Mouse Device";
mode Direct;
Direct.name = "Direct";
Direct.value = LOGITECH_G203L_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G203L_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G203L_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G203L_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = 0x4E20;
Cycle.speed_max = 0x03E8;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G203L_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed_min = 0x4E20;
Breathing.speed_max = 0x03E8;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode Wave;
Wave.name = "Wave";
Wave.value = LOGITECH_G203L_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_DIRECTION_LR;
Wave.color_mode = MODE_COLORS_NONE;
Wave.speed_min = 0x4E20;
Wave.speed_max = 0x03E8;
modes.push_back(Wave);
mode Colormixing;
Colormixing.name = "Colormixing";
Colormixing.value = LOGITECH_G203L_MODE_COLORMIXING;
Colormixing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Colormixing.color_mode = MODE_COLORS_NONE;
Colormixing.speed_min = 0x4E20;
Colormixing.speed_max = 0x03E8;
modes.push_back(Colormixing);
SetupZones();
}
void RGBController_LogitechG203L::SetupZones()
{
zone g203L_zone;
g203L_zone.name = "Mouse Zone";
g203L_zone.type = ZONE_TYPE_LINEAR;
g203L_zone.leds_min = 3;
g203L_zone.leds_max = 3;
g203L_zone.leds_count = 3;
g203L_zone.matrix_map = NULL;
zones.push_back(g203L_zone);
led g203L_led_l;
g203L_led_l.name = "Mouse Left";
g203L_led_l.value = 1;
leds.push_back(g203L_led_l);
led g203L_led_c;
g203L_led_c.name = "Mouse Center";
g203L_led_c.value = 2;
leds.push_back(g203L_led_c);
led g203L_led_r;
g203L_led_r.name = "Mouse Right";
g203L_led_r.value = 3;
leds.push_back(g203L_led_r);
SetupColors();
}
void RGBController_LogitechG203L::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG203L::DeviceUpdateLEDs()
{
logitech->SetDevice(colors);
logitech->SetDevice(colors); //dirty workaround for color lag
}
void RGBController_LogitechG203L::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechG203L::UpdateSingleLED(int led)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
logitech->SetSingleLED(leds[led].value, red, grn, blu);
logitech->SetSingleLED(leds[led].value, red, grn, blu); //dirty workaround for color lag
}
void RGBController_LogitechG203L::SetCustomMode()
{
}
void RGBController_LogitechG203L::DeviceUpdateMode()
{
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
unsigned char dir = 0;
unsigned char val = 0xFF;
if(modes[active_mode].color_mode & MODE_COLORS_MODE_SPECIFIC)
{
red = RGBGetRValue(modes[active_mode].colors[0]);
grn = RGBGetGValue(modes[active_mode].colors[0]);
blu = RGBGetBValue(modes[active_mode].colors[0]);
}
if(modes[active_mode].flags & MODE_FLAG_HAS_DIRECTION_LR)
{
dir = (unsigned char)modes[active_mode].direction;
}
if(modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS)
{
//dunno where brightness is
}
if(modes[active_mode].value == LOGITECH_G203L_MODE_DIRECT)
{
logitech->SetDevice(colors);
}
else
{
logitech->SetMode(modes[active_mode].value, modes[active_mode].speed, val, dir, red, grn, blu);
}
}

View file

@ -1,23 +0,0 @@
#pragma once
#include "RGBController.h"
#include "LogitechG203LController.h"
class RGBController_LogitechG203L : public RGBController
{
public:
RGBController_LogitechG203L(LogitechG203LController* logitech_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:
LogitechG203LController* logitech;
};

View file

@ -1,123 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG403.cpp |
| |
| Generic RGB Interface for Logitech G403 |
| Prodigy RGB Mouse |
| |
| Martin Hartl (inlar) 5/19/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechG403.h"
RGBController_LogitechG403::RGBController_LogitechG403(LogitechG403Controller* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Mouse Device";
type = DEVICE_TYPE_MOUSE;
description = "Logitech Mouse Device";
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G403_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G403_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G403_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G403_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G403_SPEED_FASTEST;
Cycle.speed = LOGITECH_G403_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G403_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G403_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G403_SPEED_FASTEST;
Breathing.speed = LOGITECH_G403_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
void RGBController_LogitechG403::SetupZones()
{
zone G403_wheel_zone;
G403_wheel_zone.name = "Scroll Wheel";
G403_wheel_zone.type = ZONE_TYPE_SINGLE;
G403_wheel_zone.leds_min = 1;
G403_wheel_zone.leds_max = 1;
G403_wheel_zone.leds_count = 1;
G403_wheel_zone.matrix_map = NULL;
zones.push_back(G403_wheel_zone);
led G403_wheel_led;
G403_wheel_led.name = "Scroll Wheel";
leds.push_back(G403_wheel_led);
zone G403_logo_zone;
G403_logo_zone.name = "Logo";
G403_logo_zone.type = ZONE_TYPE_SINGLE;
G403_logo_zone.leds_min = 1;
G403_logo_zone.leds_max = 1;
G403_logo_zone.leds_count = 1;
G403_logo_zone.matrix_map = NULL;
zones.push_back(G403_logo_zone);
led G403_logo_led;
G403_logo_led.name = "Logo";
leds.push_back(G403_logo_led);
SetupColors();
}
void RGBController_LogitechG403::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG403::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_LogitechG403::UpdateZoneLEDs(int zone)
{
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_LogitechG403::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_LogitechG403::SetCustomMode()
{
}
void RGBController_LogitechG403::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,32 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG403.h |
| |
| Generic RGB Interface for Logitech G403 |
| Prodigy RGB Mouse |
| |
| Martin Hartl (inlar) 5/19/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechG403Controller.h"
class RGBController_LogitechG403 : public RGBController
{
public:
RGBController_LogitechG403(LogitechG403Controller* logitech_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:
LogitechG403Controller* logitech;
};

View file

@ -1,123 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG403.h |
| |
| Generic RGB Interface for Logitech G502 |
| Proteus Sprectrum Mouse |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechG502PS.h"
RGBController_LogitechG502PS::RGBController_LogitechG502PS(LogitechG502PSController* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Mouse Device";
type = DEVICE_TYPE_MOUSE;
description = "Logitech Mouse Device";
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G502_PS_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G502_PS_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G502_PS_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G502_PS_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G502_PS_SPEED_FASTEST;
Cycle.speed = LOGITECH_G502_PS_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G502_PS_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G502_PS_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G502_PS_SPEED_FASTEST;
Breathing.speed = LOGITECH_G502_PS_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
void RGBController_LogitechG502PS::SetupZones()
{
zone G502_PS_side_zone;
G502_PS_side_zone.name = "DPI";
G502_PS_side_zone.type = ZONE_TYPE_SINGLE;
G502_PS_side_zone.leds_min = 1;
G502_PS_side_zone.leds_max = 1;
G502_PS_side_zone.leds_count = 1;
G502_PS_side_zone.matrix_map = NULL;
zones.push_back(G502_PS_side_zone);
led G502_PS_side_led;
G502_PS_side_led.name = "DPI";
leds.push_back(G502_PS_side_led);
zone G502_logo_zone;
G502_logo_zone.name = "Logo";
G502_logo_zone.type = ZONE_TYPE_SINGLE;
G502_logo_zone.leds_min = 1;
G502_logo_zone.leds_max = 1;
G502_logo_zone.leds_count = 1;
G502_logo_zone.matrix_map = NULL;
zones.push_back(G502_logo_zone);
led G502_logo_led;
G502_logo_led.name = "Logo";
leds.push_back(G502_logo_led);
SetupColors();
}
void RGBController_LogitechG502PS::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG502PS::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_LogitechG502PS::UpdateZoneLEDs(int zone)
{
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_LogitechG502PS::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_LogitechG502PS::SetCustomMode()
{
}
void RGBController_LogitechG502PS::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,32 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG403.h |
| |
| Generic RGB Interface for Logitech G502 |
| Proteus Sprectrum Mouse |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechG502PSController.h"
class RGBController_LogitechG502PS : public RGBController
{
public:
RGBController_LogitechG502PS(LogitechG502PSController* logitech_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:
LogitechG502PSController* logitech;
};

View file

@ -1,389 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG810.cpp |
| |
| Generic RGB Interface for Logitech G810 |
| Orion Spectrum Keyboard |
| |
| Adam Honse (CalcProgrammer1) 6/12/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechG810.h"
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[7][23] =
{ { 111, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 116, 114, 115, NA, 113, NA, 112, 110, NA, NA, NA },
{ 37, NA, 54, 55, 56, 57, NA, 58, 59, 60, 61, NA, 62, 63, 64, 65, 66, 67, 68, 109, 108, 107, 106 },
{ 49, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, 41, 42, 38, NA, 69, 70, 71, 79, 80, 81, 82 },
{ 39, NA, 16, 22, 4, 17, NA, 19, 24, 20, 8, 14, 15, 43, 44, 45, 72, 73, 74, 91, 92, 93, 83 },
{ 53, NA, 0, 18, 3, 5, NA, 6, 7, 9, 10, 11, 47, 48, 46, 36, NA, NA, NA, 88, 89, 90, NA },
{ 99, 96, 25, 23, 2, 21, NA, 1, NA, 13, 12, 50, 51, 52, 103, NA, NA, 78, NA, 85, 86, 87, 84 },
{ 98, 101, 100, NA, NA, NA, NA, 40, NA, NA, NA, NA, 104, 105, 97, 102, 76, 77, 75, 94, NA, 95, NA } };
static const char* zone_names[] =
{
"Keyboard",
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
117,
};
typedef struct
{
const char * name;
const unsigned char zone;
const unsigned char idx;
} led_type;
static const led_type led_names[] =
{
/* Key Label Zone, Index */
{ "Key: A", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x04 },
{ "Key: B", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x05 },
{ "Key: C", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x06 },
{ "Key: D", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x07 },
{ "Key: E", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x08 },
{ "Key: F", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x09 },
{ "Key: G", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x0A },
{ "Key: H", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x0B },
{ "Key: I", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x0C },
{ "Key: J", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x0D },
{ "Key: K", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x0E },
{ "Key: L", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x0F },
{ "Key: M", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x10 },
{ "Key: N", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x11 },
{ "Key: O", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x12 },
{ "Key: P", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x13 },
{ "Key: Q", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x14 },
{ "Key: R", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x15 },
{ "Key: S", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x16 },
{ "Key: T", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x17 },
{ "Key: U", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x18 },
{ "Key: V", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x19 },
{ "Key: W", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x1A },
{ "Key: X", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x1B },
{ "Key: Y", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x1C },
{ "Key: Z", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x1D },
{ "Key: 1", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x1E },
{ "Key: 2", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x1F },
{ "Key: 3", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x20 },
{ "Key: 4", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x21 },
{ "Key: 5", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x22 },
{ "Key: 6", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x23 },
{ "Key: 7", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x24 },
{ "Key: 8", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x25 },
{ "Key: 9", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x26 },
{ "Key: 0", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x27 },
{ "Key: Enter", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x28 },
{ "Key: Escape", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x29 },
{ "Key: Backspace", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x2A },
{ "Key: Tab", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x2B },
{ "Key: Space", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x2C },
{ "Key: -", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x2D },
{ "Key: =", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x2E },
{ "Key: [", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x2F },
{ "Key: ]", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x30 },
{ "Key: \\ (ANSI)", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x31 },//ANSI only
{ "Key: #", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x32 },//ISO only
{ "Key: ;", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x33 },
{ "Key: '", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x34 },
{ "Key: `", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x35 },
{ "Key: ,", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x36 },
{ "Key: .", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x37 },
{ "Key: /", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x38 },
{ "Key: Caps Lock", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x39 },
{ "Key: F1", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x3A },
{ "Key: F2", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x3B },
{ "Key: F3", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x3C },
{ "Key: F4", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x3D },
{ "Key: F5", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x3E },
{ "Key: F6", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x3F },
{ "Key: F7", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x40 },
{ "Key: F8", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x41 },
{ "Key: F9", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x42 },
{ "Key: F10", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x43 },
{ "Key: F11", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x44 },
{ "Key: F12", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x45 },
{ "Key: Print Screen", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x46 },
{ "Key: Scroll Lock", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x47 },
{ "Key: Pause/Break", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x48 },
{ "Key: Insert", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x49 },
{ "Key: Home", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x4A },
{ "Key: Page Up", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x4B },
{ "Key: Delete", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x4C },
{ "Key: End", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x4D },
{ "Key: Page Down", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x4E },
{ "Key: Right Arrow", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x4F },
{ "Key: Left Arrow", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x50 },
{ "Key: Down Arrow", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x51 },
{ "Key: Up Arrow", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x52 },
{ "Key: Num Lock", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x53 },
{ "Key: Number Pad /", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x54 },
{ "Key: Number Pad *", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x55 },
{ "Key: Number Pad -", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x56 },
{ "Key: Number Pad +", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x57 },
{ "Key: Number Pad Enter", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x58 },
{ "Key: Number Pad 1", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x59 },
{ "Key: Number Pad 2", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x5A },
{ "Key: Number Pad 3", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x5B },
{ "Key: Number Pad 4", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x5C },
{ "Key: Number Pad 5", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x5D },
{ "Key: Number Pad 6", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x5E },
{ "Key: Number Pad 7", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x5F },
{ "Key: Number Pad 8", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x60 },
{ "Key: Number Pad 9", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x61 },
{ "Key: Number Pad 0", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x62 },
{ "Key: Number Pad .", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x63 },
{ "Key: \\ (ISO)", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x64 },//ISO only
{ "Key: Menu", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0x65 },
{ "Key: Left Control", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0xE0 },
{ "Key: Left Shift", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0xE1 },
{ "Key: Left Alt", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0xE2 },
{ "Key: Left Windows", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0xE3 },
{ "Key: Right Control", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0xE4 },
{ "Key: Right Shift", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0xE5 },
{ "Key: Right Alt", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0xE6 },
{ "Key: Right Windows", LOGITECH_G810_ZONE_DIRECT_KEYBOARD, 0xE7 },
{ "Key: Media Next", LOGITECH_G810_ZONE_DIRECT_MEDIA, 0xB5 },
{ "Key: Media Previous", LOGITECH_G810_ZONE_DIRECT_MEDIA, 0xB6 },
{ "Key: Media Stop", LOGITECH_G810_ZONE_DIRECT_MEDIA, 0xB7 },
{ "Key: Media Play/Pause", LOGITECH_G810_ZONE_DIRECT_MEDIA, 0xCD },
{ "Key: Media Mute", LOGITECH_G810_ZONE_DIRECT_MEDIA, 0xE2 },
{ "Logo", LOGITECH_G810_ZONE_DIRECT_LOGO, 0x01 },
{ "Lighting", LOGITECH_G810_ZONE_DIRECT_INDICATORS, 0x01 },
{ "Game Mode", LOGITECH_G810_ZONE_DIRECT_INDICATORS, 0x02 },
{ "Caps Lock Indicator", LOGITECH_G810_ZONE_DIRECT_INDICATORS, 0x03 },
{ "Scroll Lock Indicator", LOGITECH_G810_ZONE_DIRECT_INDICATORS, 0x04 },
{ "Num Lock Indicator", LOGITECH_G810_ZONE_DIRECT_INDICATORS, 0x05 },
};
RGBController_LogitechG810::RGBController_LogitechG810(LogitechG810Controller* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Keyboard Device";
type = DEVICE_TYPE_KEYBOARD;
description = "Logitech Keyboard Device";
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G810_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G810_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G810_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G810_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G810_SPEED_FASTEST;
Cycle.speed = LOGITECH_G810_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G810_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
Breathing.speed_min = LOGITECH_G810_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G810_SPEED_FASTEST;
Breathing.speed = LOGITECH_G810_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
RGBController_LogitechG810::~RGBController_LogitechG810()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_LogitechG810::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];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
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].name;
new_led.value = ( led_names[led_idx].zone << 8 ) + led_names[led_idx].idx;
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_LogitechG810::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG810::DeviceUpdateLEDs()
{
#define MAX_FRAMES_PER_PACKET 0x0E
unsigned char frame_buf[MAX_FRAMES_PER_PACKET * 4];
unsigned char frame_cnt = 0;
unsigned char prev_zone = 0;
unsigned char zone = 0;
unsigned char idx = 0;
/*---------------------------------------------------------*\
| TODO: Send packets with multiple LED frames |
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
zone = ( leds[led_idx].value >> 8 );
idx = ( leds[led_idx].value & 0xFF );
if((zone != prev_zone) && (frame_cnt != 0))
{
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
frame_cnt = 0;
}
frame_buf[(frame_cnt * 4) + 0] = idx;
frame_buf[(frame_cnt * 4) + 1] = RGBGetRValue(colors[led_idx]);
frame_buf[(frame_cnt * 4) + 2] = RGBGetGValue(colors[led_idx]);
frame_buf[(frame_cnt * 4) + 3] = RGBGetBValue(colors[led_idx]);
frame_cnt++;
prev_zone = zone;
if(frame_cnt == MAX_FRAMES_PER_PACKET)
{
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
frame_cnt = 0;
}
}
if(frame_cnt != 0)
{
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
}
logitech->Commit();
}
void RGBController_LogitechG810::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechG810::UpdateSingleLED(int led)
{
unsigned char frame[4];
unsigned char zone;
unsigned char idx;
zone = ( leds[led].value >> 8 );
idx = ( leds[led].value & 0xFF );
frame[0] = idx;
frame[1] = RGBGetRValue(colors[led]);
frame[2] = RGBGetGValue(colors[led]);
frame[3] = RGBGetBValue(colors[led]);
logitech->SetDirect(zone, 1, frame);
logitech->Commit();
}
void RGBController_LogitechG810::SetCustomMode()
{
active_mode = 0;
}
void RGBController_LogitechG810::DeviceUpdateMode()
{
/*---------------------------------------------------------*\
| Direct mode does not send a mode packet |
| Call UpdateLEDs to send direct packet |
\*---------------------------------------------------------*/
if(active_mode == 0xFFFF)
{
UpdateLEDs();
return;
}
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
red = RGBGetRValue(modes[active_mode].colors[0]);
grn = RGBGetGValue(modes[active_mode].colors[0]);
blu = RGBGetBValue(modes[active_mode].colors[0]);
}
logitech->SetMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu);
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG810.h |
| |
| Generic RGB Interface for Logitech G810 |
| Orion Spectrum keyboard |
| |
| Adam Honse (CalcProgrammer1) 6/12/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechG810Controller.h"
class RGBController_LogitechG810 : public RGBController
{
public:
RGBController_LogitechG810(LogitechG810Controller* logitech_ptr);
~RGBController_LogitechG810();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
LogitechG810Controller* logitech;
};

View file

@ -1,109 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechGPowerPlay.cpp |
| |
| Generic RGB Interface for |
| Logitech G PowerPlay Wireless Mousemat |
| |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechGPowerPlay.h"
RGBController_LogitechGPowerPlay::RGBController_LogitechGPowerPlay(LogitechGPowerPlayController* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech G PowerPlay Wireless Charging System";
type = DEVICE_TYPE_MOUSEMAT;
description = "Logitech G PowerPlay Wireless Charging System";
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G_POWERPLAY_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G_POWERPLAY_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G_POWERPLAY_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Cycle.color_mode = MODE_COLORS_PER_LED;
Cycle.speed_min = LOGITECH_G_POWERPLAY_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G_POWERPLAY_SPEED_FASTEST;
Cycle.speed = LOGITECH_G_POWERPLAY_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G_POWERPLAY_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G_POWERPLAY_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G_POWERPLAY_SPEED_FASTEST;
Breathing.speed = LOGITECH_G_POWERPLAY_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
void RGBController_LogitechGPowerPlay::SetupZones()
{
zone GPowerPlay_logo_zone;
GPowerPlay_logo_zone.name = "Logo";
GPowerPlay_logo_zone.type = ZONE_TYPE_SINGLE;
GPowerPlay_logo_zone.leds_min = 1;
GPowerPlay_logo_zone.leds_max = 1;
GPowerPlay_logo_zone.leds_count = 1;
GPowerPlay_logo_zone.matrix_map = NULL;
zones.push_back(GPowerPlay_logo_zone);
led GPowerPlay_logo_led;
GPowerPlay_logo_led.name = "Logo";
leds.push_back(GPowerPlay_logo_led);
SetupColors();
}
void RGBController_LogitechGPowerPlay::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechGPowerPlay::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
}
void RGBController_LogitechGPowerPlay::UpdateZoneLEDs(int zone)
{
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
logitech->SendMouseMatMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_LogitechGPowerPlay::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_LogitechGPowerPlay::SetCustomMode()
{
}
void RGBController_LogitechGPowerPlay::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,32 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechGPowerPlay.h |
| |
| Generic RGB Interface for |
| Logitech G PowerPlay Wireless Mousemat |
| |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechGPowerPlayController.h"
class RGBController_LogitechGPowerPlay : public RGBController
{
public:
RGBController_LogitechGPowerPlay(LogitechGPowerPlayController* logitech_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:
LogitechGPowerPlayController* logitech;
};

View file

@ -1,123 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechGProWireless.cpp |
| |
| Generic RGB Interface for |
| Logitech G Pro Wireless Gaming Mouse |
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechGProWireless.h"
RGBController_LogitechGProWireless::RGBController_LogitechGProWireless(LogitechGProWirelessController* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech G Pro Wireless Gaming Mouse";
type = DEVICE_TYPE_MOUSE;
description = "Logitech G Pro Wireless Gaming Mouse";
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G_PRO_WIRELESS_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G_PRO_WIRELESS_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G_PRO_WIRELESS_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST;
Cycle.speed = LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G_PRO_WIRELESS_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST;
Breathing.speed = LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
void RGBController_LogitechGProWireless::SetupZones()
{
zone GProWireless_primary_zone;
GProWireless_primary_zone.name = "DPI";
GProWireless_primary_zone.type = ZONE_TYPE_SINGLE;
GProWireless_primary_zone.leds_min = 1;
GProWireless_primary_zone.leds_max = 1;
GProWireless_primary_zone.leds_count = 1;
GProWireless_primary_zone.matrix_map = NULL;
zones.push_back(GProWireless_primary_zone);
led GProWireless_primary_led;
GProWireless_primary_led.name = "DPI";
leds.push_back(GProWireless_primary_led);
zone GProWireless_logo_zone;
GProWireless_logo_zone.name = "Logo";
GProWireless_logo_zone.type = ZONE_TYPE_SINGLE;
GProWireless_logo_zone.leds_min = 1;
GProWireless_logo_zone.leds_max = 1;
GProWireless_logo_zone.leds_count = 1;
GProWireless_logo_zone.matrix_map = NULL;
zones.push_back(GProWireless_logo_zone);
led GProWireless_logo_led;
GProWireless_logo_led.name = "Logo";
leds.push_back(GProWireless_logo_led);
SetupColors();
}
void RGBController_LogitechGProWireless::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechGProWireless::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_LogitechGProWireless::UpdateZoneLEDs(int zone)
{
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_LogitechGProWireless::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_LogitechGProWireless::SetCustomMode()
{
}
void RGBController_LogitechGProWireless::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,32 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechGProWireless.h |
| |
| Generic RGB Interface for |
| Logitech G Pro Wireless Gaming Mouse |
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechGProWirelessController.h"
class RGBController_LogitechGProWireless : public RGBController
{
public:
RGBController_LogitechGProWireless(LogitechGProWirelessController* logitech_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:
LogitechGProWirelessController* logitech;
};

View file

@ -1,110 +0,0 @@
/*-----------------------------------------*\
| RGBController_MSI3Zone.cpp |
| |
| Generic RGB Interface for MSI/Steelseries|
| 3-Zone Keyboard |
| |
| Adam Honse (CalcProgrammer1) 12/25/2019 |
\*-----------------------------------------*/
#include "RGBController_MSI3Zone.h"
RGBController_MSI3Zone::RGBController_MSI3Zone(MSI3ZoneController* msi_ptr)
{
msi = msi_ptr;
name = "MSI 3-Zone Keyboard";
type = DEVICE_TYPE_KEYBOARD;
description = "MSI 3-Zone Keyboard Device";
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_MSI3Zone::~RGBController_MSI3Zone()
{
}
void RGBController_MSI3Zone::SetupZones()
{
/*---------------------------------------------------------*\
| Set up Keyboard zone and Keyboard LEDs |
\*---------------------------------------------------------*/
zone keyboard_zone;
keyboard_zone.name = "Keyboard";
keyboard_zone.type = ZONE_TYPE_LINEAR;
keyboard_zone.leds_min = 3;
keyboard_zone.leds_max = 3;
keyboard_zone.leds_count = 3;
keyboard_zone.matrix_map = NULL;
zones.push_back(keyboard_zone);
led left_led;
left_led.name = "Keyboard Left";
leds.push_back(left_led);
led mid_led;
mid_led.name = "Keyboard Middle";
leds.push_back(mid_led);
led right_led;
right_led.name = "Keyboard Right";
leds.push_back(right_led);
/*---------------------------------------------------------*\
| Set up Aux zone and Aux LED |
\*---------------------------------------------------------*/
zone aux_zone;
aux_zone.name = "Aux";
aux_zone.type = ZONE_TYPE_SINGLE;
aux_zone.leds_min = 1;
aux_zone.leds_max = 1;
aux_zone.leds_count = 1;
aux_zone.matrix_map = NULL;
zones.push_back(aux_zone);
led aux_led;
aux_led.name = "Aux";
leds.push_back(aux_led);
SetupColors();
}
void RGBController_MSI3Zone::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_MSI3Zone::DeviceUpdateLEDs()
{
msi->SetLEDs(colors);
}
void RGBController_MSI3Zone::UpdateZoneLEDs(int /*zone*/)
{
msi->SetLEDs(colors);
}
void RGBController_MSI3Zone::UpdateSingleLED(int /*led*/)
{
msi->SetLEDs(colors);
}
void RGBController_MSI3Zone::SetCustomMode()
{
}
void RGBController_MSI3Zone::DeviceUpdateMode()
{
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_MSI3Zone.h |
| |
| Generic RGB Interface for MSI/Steelseries|
| 3-Zone Keyboard |
| |
| Adam Honse (CalcProgrammer1) 12/25/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "MSI3ZoneController.h"
class RGBController_MSI3Zone : public RGBController
{
public:
RGBController_MSI3Zone(MSI3ZoneController* msi_ptr);
~RGBController_MSI3Zone();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
MSI3ZoneController* msi;
};

View file

@ -1,321 +0,0 @@
/*-----------------------------------------*\
| RGBController_MSIGPU.h |
| |
| Generic RGB Interface for MSI GPU |
| |
\*-----------------------------------------*/
#include "RGBController_MSIGPU.h"
static unsigned char brightness_values[] = { 0x14, 0x28, 0x3c, 0x50, 0x64 };
static unsigned char speed_values[] = { 0x04, 0x02, 0x01 };
int RGBController_MSIGPU::GetDeviceMode()
{
int dev_mode = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_MODE);
for(std::size_t mode = 0; mode < modes.size(); mode++)
{
if (modes[mode].value == dev_mode)
{
active_mode = mode;
break;
}
}
return(active_mode);
}
RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
{
msi_gpu = msi_gpu_ptr;
name = "MSI GPU Device";
type = DEVICE_TYPE_GPU;
description = "MSI GPU Device";
location = msi_gpu->GetDeviceLocation();
mode Off;
Off.name = "Off";
Off.value = MSI_GPU_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = MSI_GPU_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Rainbow.speed_min = 0;
Rainbow.speed_max = 2;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Static;
Static.name = "Static";
Static.value = MSI_GPU_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Raindrop;
Raindrop.name = "Raindrop";
Raindrop.value = MSI_GPU_MODE_RAINDROP;
Raindrop.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Raindrop.speed_min = 0;
Raindrop.speed_max = 2;
Raindrop.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Raindrop);
mode Magic;
Magic.name = "Magic";
Magic.value = MSI_GPU_MODE_MAGIC;
Magic.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Magic.speed_min = 0;
Magic.speed_max = 2;
Magic.color_mode = MODE_COLORS_NONE;
modes.push_back(Magic);
mode Patrolling;
Patrolling.name = "Patrolling";
Patrolling.value = MSI_GPU_MODE_PATROLLING;
Patrolling.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Patrolling.speed_min = 0;
Patrolling.speed_max = 2;
Patrolling.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Patrolling);
mode Streaming;
Streaming.name = "Streaming";
Streaming.value = MSI_GPU_MODE_STREAMING;
Streaming.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Streaming.speed_min = 0;
Streaming.speed_max = 2;
Streaming.color_mode = MODE_COLORS_NONE;
modes.push_back(Streaming);
mode Lightning;
Lightning.name = "Lightning";
Lightning.value = MSI_GPU_MODE_LIGHTNING;
Lightning.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Lightning.speed_min = 0;
Lightning.speed_max = 2;
Lightning.color_mode = MODE_COLORS_NONE;
modes.push_back(Lightning);
mode Wave;
Wave.name = "Wave";
Wave.value = MSI_GPU_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Wave.speed_min = 0;
Wave.speed_max = 2;
Wave.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Wave);
mode Meteor;
Meteor.name = "Meteor";
Meteor.value = MSI_GPU_MODE_METEOR;
Meteor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Meteor.speed_min = 0;
Meteor.speed_max = 2;
Meteor.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Meteor);
mode Stack;
Stack.name = "Stack";
Stack.value = MSI_GPU_MODE_STACK;
Stack.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Stack.speed_min = 0;
Stack.speed_max = 2;
Stack.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Stack);
mode Rhythm;
Rhythm.name = "Rhythm";
Rhythm.value = MSI_GPU_MODE_RHYTHM;
Rhythm.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Rhythm.speed_min = 0;
Rhythm.speed_max = 2;
Rhythm.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Rhythm);
mode Flowing;
Flowing.name = "Flowing";
Flowing.value = MSI_GPU_MODE_FLOWING;
Flowing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Flowing.speed_min = 0;
Flowing.speed_max = 2;
Flowing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Flowing);
mode Whirling;
Whirling.name = "Whirling";
Whirling.value = MSI_GPU_MODE_WHIRLING;
Whirling.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Whirling.speed_min = 0;
Whirling.speed_max = 2;
Whirling.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Whirling);
mode Twisting;
Twisting.name = "Twisting";
Twisting.value = MSI_GPU_MODE_TWISTING;
Twisting.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Twisting.speed_min = 0;
Twisting.speed_max = 2;
Twisting.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Twisting);
mode Laminating;
Laminating.name = "Laminating";
Laminating.value = MSI_GPU_MODE_LAMINATING;
Laminating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Laminating.speed_min = 0;
Laminating.speed_max = 2;
Laminating.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Laminating);
mode Fadein;
Fadein.name = "Fadein";
Fadein.value = MSI_GPU_MODE_FADEIN;
Fadein.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Fadein.speed_min = 0;
Fadein.speed_max = 2;
Fadein.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Fadein);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = MSI_GPU_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = 0;
Breathing.speed_max = 2;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode flashing;
flashing.name = "Flashing";
flashing.value = MSI_GPU_MODE_FLASHING;
flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
flashing.speed_min = 0;
flashing.speed_max = 2;
flashing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(flashing);
mode doubleflashing;
doubleflashing.name = "Doubleflashing";
doubleflashing.value = MSI_GPU_MODE_DOUBLEFLASHING;
doubleflashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
doubleflashing.speed_min = 0;
doubleflashing.speed_max = 2;
doubleflashing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(doubleflashing);
SetupZones();
active_mode = GetDeviceMode();
}
void RGBController_MSIGPU::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zone msi_gpu_zone;
msi_gpu_zone.name = "GPU";
msi_gpu_zone.type = ZONE_TYPE_SINGLE;
msi_gpu_zone.leds_min = 1;
msi_gpu_zone.leds_max = 1;
msi_gpu_zone.leds_count = 3;
msi_gpu_zone.matrix_map = NULL;
zones.push_back(msi_gpu_zone);
/*---------------------------------------------------------*\
| Set up LED |
\*---------------------------------------------------------*/
led led1;
led1.name = "Color 1";
leds.push_back(led1);
led led2;
led2.name = "Color 2";
leds.push_back(led2);
led led3;
led3.name = "Color 3";
leds.push_back(led3);
SetupColors();
/*---------------------------------------------------------*\
| Initialize color |
\*---------------------------------------------------------*/
unsigned char r1 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_R1);
unsigned char g1 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_G1);
unsigned char b1 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_B1);
unsigned char r2 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_R2);
unsigned char g2 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_G2);
unsigned char b2 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_B2);
unsigned char r3 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_R3);
unsigned char g3 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_G3);
unsigned char b3 = msi_gpu->MSIGPURegisterRead(MSI_GPU_REG_B3);
colors[0] = ToRGBColor(r1, g1, b1);
colors[1] = ToRGBColor(r2, g2, b2);
colors[2] = ToRGBColor(r3, g3, b3);
}
void RGBController_MSIGPU::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_MSIGPU::DeviceUpdateLEDs()
{
if (modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS)
{
msi_gpu->MSIGPURegisterWrite(MSI_GPU_REG_BRIGHTNESS, brightness_values[4]); // how to access brightness value?
}
if (modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
{
msi_gpu->MSIGPURegisterWrite(MSI_GPU_REG_SPEED, speed_values[modes[active_mode].speed]);
}
msi_gpu->MSIGPURegisterWrite(MSI_GPU_REG_UNKNOWN, 0x00);
if (modes[active_mode].flags & MODE_FLAG_HAS_PER_LED_COLOR)
{
if (modes[active_mode].value == MSI_GPU_MODE_FADEIN)
{
msi_gpu->SetRGB2(RGBGetRValue(colors[1]), RGBGetGValue(colors[1]), RGBGetBValue(colors[1]));
msi_gpu->SetRGB3(RGBGetRValue(colors[2]), RGBGetGValue(colors[2]), RGBGetBValue(colors[2]));
}
else
{
msi_gpu->SetRGB1(RGBGetRValue(colors[0]), RGBGetGValue(colors[0]), RGBGetBValue(colors[0]));
}
}
msi_gpu->SetMode(modes[active_mode].value);
}
void RGBController_MSIGPU::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_MSIGPU::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_MSIGPU::SetCustomMode()
{
active_mode = 0;
}
void RGBController_MSIGPU::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_MSIGPU.h |
| |
| Generic RGB Interface for MSI GPU |
| |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "MSIGPUController.h"
class RGBController_MSIGPU : public RGBController
{
public:
RGBController_MSIGPU(MSIGPUController* msi_gpu_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:
MSIGPUController* msi_gpu;
int GetDeviceMode();
};

View file

@ -1,230 +0,0 @@
/*-----------------------------------------*\
| RGBController_MSIMysticLight.cpp |
| |
| Generic RGB Interface for OpenRGB |
| MSI Mystic Light USB Driver |
| |
| T-bond 3/4/2020 |
\*-----------------------------------------*/
#include "RGBController_MSIMysticLight.h"
#include <array>
static const std::array<ZoneDescription, 18> led_zones
{
ZoneDescription{"JRGB1", MSI_ZONE_J_RGB_1},
ZoneDescription{"JRGB2", MSI_ZONE_J_RGB_2},
ZoneDescription{"JRAINBOW1", MSI_ZONE_J_RAINBOW_1},
ZoneDescription{"JRAINBOW2", MSI_ZONE_J_RAINBOW_2},
ZoneDescription{"JPIPE1", MSI_ZONE_J_PIPE_1},
ZoneDescription{"JPIPE2", MSI_ZONE_J_PIPE_2},
ZoneDescription{"JCORSAIR", MSI_ZONE_J_CORSAIR},
ZoneDescription{"JCORSAIR Outer", MSI_ZONE_J_CORSAIR_OUTERLL120},
ZoneDescription{"Onboard LED 0", MSI_ZONE_ON_BOARD_LED},
ZoneDescription{"Onboard LED 1", MSI_ZONE_ON_BOARD_LED_1},
ZoneDescription{"Onboard LED 2", MSI_ZONE_ON_BOARD_LED_2},
ZoneDescription{"Onboard LED 3", MSI_ZONE_ON_BOARD_LED_3},
ZoneDescription{"Onboard LED 4", MSI_ZONE_ON_BOARD_LED_4},
ZoneDescription{"Onboard LED 5", MSI_ZONE_ON_BOARD_LED_5},
ZoneDescription{"Onboard LED 6", MSI_ZONE_ON_BOARD_LED_6},
ZoneDescription{"Onboard LED 7", MSI_ZONE_ON_BOARD_LED_7},
ZoneDescription{"Onboard LED 8", MSI_ZONE_ON_BOARD_LED_8},
ZoneDescription{"Onboard LED 9", MSI_ZONE_ON_BOARD_LED_9},
};
RGBController_MSIMysticLight::RGBController_MSIMysticLight(MSIMysticLightController* controller_ptr)
{
controller = controller_ptr;
name = "MSI Mystic Light Controller";
type = DEVICE_TYPE_MOTHERBOARD;
description = controller->GetDeviceName();
version = controller->GetFWVersion();
location = controller->GetDeviceLocation();
serial = controller->GetSerial();
SetupModes();
SetupZones();
SetupColors();
}
RGBController_MSIMysticLight::~RGBController_MSIMysticLight()
{
delete controller;
}
void RGBController_MSIMysticLight::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < led_zones.size(); zone_idx++)
{
ZoneDescription zd = led_zones[zone_idx];
zone new_zone;
new_zone.name = zd.name;
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = controller->GetZoneMinLedCount(zd.value);
new_zone.leds_max = controller->GetZoneMaxLedCount(zd.value);
new_zone.leds_count = controller->GetZoneLedCount(zd.value);
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
{
led new_led;
new_led.name = new_zone.name + " LED ";
if(new_zone.leds_count > 1)
{
new_led.name.append(std::to_string(led_idx + 1));
}
new_led.value = zone_idx;
leds.push_back(new_led);
}
}
}
void RGBController_MSIMysticLight::ResizeZone(int zone, int new_size)
{
if((size_t) zone >= zones.size())
{
return;
}
MSI_ZONE zon = ZoneFromPos(zone);
unsigned int max_count = controller->GetZoneMaxLedCount(zon);
unsigned int min_count = controller->GetZoneMinLedCount(zon);
unsigned int new_siz = new_size;
new_siz = std::min(std::max(new_siz, min_count), max_count); // std::clamp only from C++17
/// TODO: Update LED count
}
void RGBController_MSIMysticLight::SetCustomMode()
{
active_mode = 0;
}
void RGBController_MSIMysticLight::DeviceUpdateLEDs()
{
for(size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
UpdateZoneLEDs(zone_idx);
}
}
void RGBController_MSIMysticLight::UpdateZoneLEDs(int zone)
{
for(int led_idx = zones[zone].leds_count - 1; led_idx >= 0; led_idx--)
{
UpdateLed(zone, led_idx);
}
controller->Update();
}
void RGBController_MSIMysticLight::UpdateSingleLED(int led)
{
UpdateLed(leds[led].value, led);
controller->Update();
}
void RGBController_MSIMysticLight::DeviceUpdateMode()
{
}
void RGBController_MSIMysticLight::SetupModes()
{
constexpr unsigned int RANDOM_ONLY = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_RANDOM_COLOR;
constexpr unsigned int COMMON = RANDOM_ONLY | MODE_FLAG_HAS_PER_LED_COLOR;
SetupMode("Static", MSI_MODE_STATIC, MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR);
SetupMode("Off", MSI_MODE_DISABLE, 0);
SetupMode("Breathing", MSI_MODE_BREATHING, COMMON);
SetupMode("Flashing", MSI_MODE_FLASHING, COMMON);
SetupMode("Double flashing", MSI_MODE_DOUBLE_FLASHING, COMMON);
SetupMode("Lightning", MSI_MODE_LIGHTNING, COMMON);
SetupMode("MSI Marquee", MSI_MODE_MSI_MARQUEE, COMMON);
SetupMode("Meteor", MSI_MODE_METEOR, COMMON);
SetupMode("Water drop", MSI_MODE_WATER_DROP, COMMON);
SetupMode("MSI Rainbow", MSI_MODE_MSI_RAINBOW, RANDOM_ONLY);
SetupMode("Pop", MSI_MODE_POP, COMMON);
SetupMode("Rap", MSI_MODE_RAP, COMMON);
SetupMode("Jazz", MSI_MODE_JAZZ, COMMON);
SetupMode("Play", MSI_MODE_PLAY, COMMON);
SetupMode("Movie", MSI_MODE_MOVIE, COMMON);
SetupMode("Color ring", MSI_MODE_COLOR_RING, COMMON);
SetupMode("Planetary", MSI_MODE_PLANETARY, COMMON);
SetupMode("Double meteor", MSI_MODE_DOUBLE_METEOR, COMMON);
SetupMode("Energy", MSI_MODE_ENERGY, COMMON);
SetupMode("Blink", MSI_MODE_BLINK, COMMON);
SetupMode("Clock", MSI_MODE_CLOCK, COMMON);
SetupMode("Color pulse", MSI_MODE_COLOR_PULSE, COMMON);
SetupMode("Color shift", MSI_MODE_COLOR_SHIFT, COMMON);
SetupMode("Color wave", MSI_MODE_COLOR_WAVE, COMMON);
SetupMode("Marquee", MSI_MODE_MARQUEE, COMMON);
SetupMode("Rainbow", MSI_MODE_RAINBOW, COMMON);
SetupMode("Rainbow wave", MSI_MODE_RAINBOW_WAVE, COMMON);
SetupMode("Visor", MSI_MODE_VISOR, COMMON);
SetupMode("JRainbow", MSI_MODE_JRAINBOW, COMMON);
SetupMode("Rainbow flashing", MSI_MODE_RAINBOW_FLASHING, COMMON);
SetupMode("Rainbow double flashing", MSI_MODE_RAINBOW_DOUBLE_FLASHING, COMMON);
SetupMode("Random", MSI_MODE_RANDOM, COMMON);
SetupMode("Fan control", MSI_MODE_FAN_CONTROL, COMMON);
SetupMode("Off 2", MSI_MODE_DISABLE_2, COMMON);
SetupMode("Color ring flashing", MSI_MODE_COLOR_RING_FLASHING, COMMON);
SetupMode("Color ring double flashing", MSI_MODE_COLOR_RING_DOUBLE_FLASHING, COMMON);
SetupMode("Stack", MSI_MODE_STACK, COMMON);
SetupMode("Corsair Que", MSI_MODE_CORSAIR_QUE, COMMON);
SetupMode("Fire", MSI_MODE_FIRE, COMMON);
SetupMode("Lava", MSI_MODE_LAVA, COMMON);
}
void RGBController_MSIMysticLight::UpdateLed(int zone, int led)
{
bool random = modes[active_mode].color_mode == MODE_COLORS_RANDOM;
unsigned char red = RGBGetRValue(zones[zone].colors[led]);
unsigned char grn = RGBGetGValue(zones[zone].colors[led]);
unsigned char blu = RGBGetBValue(zones[zone].colors[led]);
MSI_MODE mode = (MSI_MODE)(modes[active_mode].value);
MSI_SPEED speed = (MSI_SPEED)(modes[active_mode].speed);
MSI_ZONE zon = ZoneFromPos(zone);
controller->SetMode(zon, mode, speed, MSI_BRIGHTNESS_LEVEL_100, random);
controller->SetZoneColor(zon, red, grn, blu, red, grn, blu);
}
MSI_ZONE RGBController_MSIMysticLight::ZoneFromPos(int zone)
{
return led_zones[zone].value;
}
void RGBController_MSIMysticLight::SetupMode(const char *name, MSI_MODE mod, unsigned int flags)
{
mode Mode;
Mode.name = name;
Mode.value = mod;
Mode.flags = flags;
if(flags & MODE_FLAG_HAS_PER_LED_COLOR)
{
Mode.color_mode = MODE_COLORS_PER_LED;
}
else
{
Mode.color_mode = MODE_COLORS_RANDOM;
}
if(flags & MODE_FLAG_HAS_SPEED)
{
Mode.speed = MSI_SPEED_MEDIUM;
Mode.speed_max = MSI_SPEED_HIGH;
Mode.speed_min = MSI_SPEED_LOW;
}
modes.push_back(Mode);
}

View file

@ -1,39 +0,0 @@
/*-----------------------------------------*\
| RGBController_MSIMysticLight.h |
| |
| Generic RGB Interface for OpenRGB |
| MSI Mystic Light USB Driver |
| |
| T-bond 3/4/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "MSIMysticLightController.h"
#include <vector>
class RGBController_MSIMysticLight: public RGBController
{
public:
RGBController_MSIMysticLight(MSIMysticLightController* controller_ptr);
~RGBController_MSIMysticLight();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
void SetupModes();
void UpdateLed(int zone, int led);
MSI_ZONE ZoneFromPos(int zone);
void SetupMode(const char *name, MSI_MODE mode, unsigned int flags);
MSIMysticLightController* controller;
};

View file

@ -1,85 +0,0 @@
/*-----------------------------------------*\
| RGBController_MSIRGB.cpp |
| |
| Generic RGB Interface for MSI-RGB |
| |
| Adam Honse (CalcProgrammer1) 2/14/2020 |
\*-----------------------------------------*/
#include "RGBController_MSIRGB.h"
RGBController_MSIRGB::RGBController_MSIRGB(MSIRGBController* msi_ptr)
{
msi = msi_ptr;
name = "MSI Motherboard";
type = DEVICE_TYPE_MOTHERBOARD;
description = "MSI-RGB Device";
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_MSIRGB::~RGBController_MSIRGB()
{
}
void RGBController_MSIRGB::SetupZones()
{
zone msi_zone;
msi_zone.name = "MSI Zone";
msi_zone.type = ZONE_TYPE_SINGLE;
msi_zone.leds_min = 1;
msi_zone.leds_max = 1;
msi_zone.leds_count = 1;
msi_zone.matrix_map = NULL;
zones.push_back(msi_zone);
led msi_led;
msi_led.name = "MSI LED";
leds.push_back(msi_led);
SetupColors();
}
void RGBController_MSIRGB::ResizeZone(int /*zone*/, int /*new_size*/)
{
}
void RGBController_MSIRGB::DeviceUpdateLEDs()
{
RGBColor color = colors[0];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
msi->SetColor(red, grn, blu);
}
void RGBController_MSIRGB::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_MSIRGB::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_MSIRGB::SetCustomMode()
{
}
void RGBController_MSIRGB::DeviceUpdateMode()
{
}

View file

@ -1,32 +0,0 @@
/*-----------------------------------------*\
| RGBController_MSIRGB.h |
| |
| Generic RGB Interface for MSI-RGB |
| |
| Adam Honse (CalcProgrammer1) 2/14/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "MSIRGBController.h"
class RGBController_MSIRGB : public RGBController
{
public:
RGBController_MSIRGB(MSIRGBController* msi_ptr);
~RGBController_MSIRGB();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
MSIRGBController* msi;
};

View file

@ -1,238 +0,0 @@
/*-----------------------------------------*\
| RGBController_NZXTHue2.cpp |
| |
| Generic RGB Interface for NZXT Hue 2 |
| |
| Adam Honse (CalcProgrammer1) 12/29/2019 |
\*-----------------------------------------*/
#include "RGBController_NZXTHue2.h"
RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* hue2_ptr)
{
hue2 = hue2_ptr;
name = "NZXT Hue 2";
type = DEVICE_TYPE_LEDSTRIP;
description = "NZXT Hue 2 Device";
version = hue2->GetFirmwareVersion();
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = HUE_2_MODE_FIXED;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
mode Fading;
Fading.name = "Fading";
Fading.value = HUE_2_MODE_FADING;
Fading.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Fading.speed_min = HUE_2_SPEED_SLOWEST;
Fading.speed_max = HUE_2_SPEED_FASTEST;
Fading.colors_min = 1;
Fading.colors_max = 8;
Fading.speed = HUE_2_SPEED_NORMAL;
Fading.color_mode = MODE_COLORS_MODE_SPECIFIC;
Fading.colors.resize(1);
modes.push_back(Fading);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = HUE_2_MODE_SPECTRUM;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
SpectrumCycle.speed_min = HUE_2_SPEED_SLOWEST;
SpectrumCycle.speed_max = HUE_2_SPEED_FASTEST;
SpectrumCycle.speed = HUE_2_SPEED_NORMAL;
SpectrumCycle.direction = MODE_DIRECTION_RIGHT;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = HUE_2_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Marquee.speed_min = HUE_2_SPEED_SLOWEST;
Marquee.speed_max = HUE_2_SPEED_FASTEST;
Marquee.colors_min = 1;
Marquee.colors_max = 1;
Marquee.speed = HUE_2_SPEED_NORMAL;
Marquee.direction = MODE_DIRECTION_RIGHT;
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
Marquee.colors.resize(1);
modes.push_back(Marquee);
mode CoverMarquee;
CoverMarquee.name = "Cover Marquee";
CoverMarquee.value = HUE_2_MODE_COVER_MARQUEE;
CoverMarquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
CoverMarquee.speed_min = HUE_2_SPEED_SLOWEST;
CoverMarquee.speed_max = HUE_2_SPEED_FASTEST;
CoverMarquee.colors_min = 1;
CoverMarquee.colors_max = 8;
CoverMarquee.speed = HUE_2_SPEED_NORMAL;
CoverMarquee.direction = MODE_DIRECTION_RIGHT;
CoverMarquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
CoverMarquee.colors.resize(1);
modes.push_back(CoverMarquee);
mode Alternating;
Alternating.name = "Alternating";
Alternating.value = HUE_2_MODE_ALTERNATING;
Alternating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Alternating.speed_min = HUE_2_SPEED_SLOWEST;
Alternating.speed_max = HUE_2_SPEED_FASTEST;
Alternating.colors_min = 1;
Alternating.colors_max = 2;
Alternating.speed = HUE_2_SPEED_NORMAL;
Alternating.direction = MODE_DIRECTION_RIGHT;
Alternating.color_mode = MODE_COLORS_MODE_SPECIFIC;
Alternating.colors.resize(1);
modes.push_back(Alternating);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = HUE_2_MODE_PULSING;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Pulsing.speed_min = HUE_2_SPEED_SLOWEST;
Pulsing.speed_max = HUE_2_SPEED_FASTEST;
Pulsing.colors_min = 1;
Pulsing.colors_max = 8;
Pulsing.speed = HUE_2_SPEED_NORMAL;
Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Pulsing.colors.resize(1);
modes.push_back(Pulsing);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HUE_2_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = HUE_2_SPEED_SLOWEST;
Breathing.speed_max = HUE_2_SPEED_FASTEST;
Breathing.colors_min = 1;
Breathing.colors_max = 8;
Breathing.speed = HUE_2_SPEED_NORMAL;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
modes.push_back(Breathing);
SetupZones();
}
void RGBController_NZXTHue2::SetupZones()
{
/*-------------------------------------------------*\
| Set up zones |
\*-------------------------------------------------*/
for(unsigned int zone_idx = 0; zone_idx < hue2->GetNumRGBChannels(); zone_idx++)
{
zone* new_zone = new zone;
new_zone->name = "Hue 2 Channel ";
new_zone->name.append(std::to_string(zone_idx + 1));
new_zone->type = ZONE_TYPE_LINEAR;
new_zone->leds_min = 0;
new_zone->leds_max = 40;
new_zone->leds_count = hue2->channel_leds[zone_idx];
new_zone->matrix_map = NULL;
zones.push_back(*new_zone);
}
/*-------------------------------------------------*\
| Set up LEDs |
\*-------------------------------------------------*/
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 = "Hue 2 Channel ";
new_led.name.append(std::to_string(zone_idx + 1));
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_idx + 1));
new_led.value = zone_idx;
leds.push_back(new_led);
}
}
SetupColors();
}
void RGBController_NZXTHue2::ResizeZone(int /*zone*/, int /*new_size*/)
{
}
void RGBController_NZXTHue2::DeviceUpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
hue2->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
}
}
void RGBController_NZXTHue2::UpdateZoneLEDs(int zone)
{
hue2->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
}
void RGBController_NZXTHue2::UpdateSingleLED(int led)
{
unsigned int zone_idx = leds[led].value;
hue2->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
}
void RGBController_NZXTHue2::SetCustomMode()
{
active_mode = 0;
}
void RGBController_NZXTHue2::DeviceUpdateMode()
{
if(modes[active_mode].value == 0xFFFF)
{
DeviceUpdateLEDs();
}
else
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
RGBColor* colors = NULL;
bool direction = false;
if(modes[active_mode].direction == MODE_DIRECTION_LEFT)
{
direction = true;
}
if(modes[active_mode].colors.size() > 0)
{
colors = &modes[active_mode].colors[0];
}
hue2->SetChannelEffect
(
zone_idx,
modes[active_mode].value,
modes[active_mode].speed,
direction,
colors,
modes[active_mode].colors.size()
);
}
}
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_NZXTHue2.h |
| |
| Generic RGB Interface for NZXT Hue 2 |
| |
| Adam Honse (CalcProgrammer1) 12/29/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "NZXTHue2Controller.h"
class RGBController_NZXTHue2 : public RGBController
{
public:
RGBController_NZXTHue2(NZXTHue2Controller* hue2_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:
NZXTHue2Controller* hue2;
std::vector<unsigned int> leds_channel;
std::vector<unsigned int> zones_channel;
};

View file

@ -1,350 +0,0 @@
/*-----------------------------------------*\
| RGBController_NZXTKraken.cpp |
| |
| Generic RGB Interface for NZXT Kraken |
| |
| Martin Hartl (inlart) 04/04/2020 |
\*-----------------------------------------*/
#include "RGBController_NZXTKraken.h"
#include <iostream>
RGBController_NZXTKraken::RGBController_NZXTKraken(NZXTKrakenController* nzxtkraken_ptr)
{
nzxtkraken = nzxtkraken_ptr;
name = "NZXT Kraken X/M";
type = DEVICE_TYPE_COOLER;
description = "NZXT Kraken X42/X52/X62/X72/M22";
version = nzxtkraken->GetFirmwareVersion();
mode Direct;
Direct.name = "Direct";
Direct.value = NZXT_KRAKEN_MODE_FIXED;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Fading;
Fading.name = "Fading";
Fading.value = NZXT_KRAKEN_MODE_FADING;
Fading.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Fading.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
Fading.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
Fading.colors_min = 2;
Fading.colors_max = 8;
Fading.speed = NZXT_KRAKEN_SPEED_NORMAL;
Fading.color_mode = MODE_COLORS_MODE_SPECIFIC;
Fading.colors.resize(2);
modes.push_back(Fading);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = NZXT_KRAKEN_MODE_SPECTRUM;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
SpectrumCycle.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
SpectrumCycle.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
SpectrumCycle.speed = NZXT_KRAKEN_SPEED_NORMAL;
SpectrumCycle.direction = MODE_DIRECTION_RIGHT;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = NZXT_KRAKEN_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Marquee.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
Marquee.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
Marquee.colors_min = 1;
Marquee.colors_max = 1;
Marquee.speed = NZXT_KRAKEN_SPEED_NORMAL;
Marquee.direction = MODE_DIRECTION_RIGHT;
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
Marquee.colors.resize(1);
modes.push_back(Marquee);
mode CoverMarquee;
CoverMarquee.name = "Cover Marquee";
CoverMarquee.value = NZXT_KRAKEN_MODE_COVER_MARQUEE;
CoverMarquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
CoverMarquee.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
CoverMarquee.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
CoverMarquee.colors_min = 1;
CoverMarquee.colors_max = 8;
CoverMarquee.speed = NZXT_KRAKEN_SPEED_NORMAL;
CoverMarquee.direction = MODE_DIRECTION_RIGHT;
CoverMarquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
CoverMarquee.colors.resize(2);
modes.push_back(CoverMarquee);
mode Alternating;
Alternating.name = "Alternating";
Alternating.value = NZXT_KRAKEN_MODE_ALTERNATING;
Alternating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Alternating.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
Alternating.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
Alternating.colors_min = 2;
Alternating.colors_max = 2;
Alternating.speed = NZXT_KRAKEN_SPEED_NORMAL;
Alternating.direction = MODE_DIRECTION_RIGHT;
Alternating.color_mode = MODE_COLORS_MODE_SPECIFIC;
Alternating.colors.resize(2);
modes.push_back(Alternating);
mode Pulse;
Pulse.name = "Pulse";
Pulse.value = NZXT_KRAKEN_MODE_PULSE;
Pulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Pulse.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
Pulse.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
Pulse.colors_min = 1;
Pulse.colors_max = 8;
Pulse.speed = NZXT_KRAKEN_SPEED_NORMAL;
Pulse.color_mode = MODE_COLORS_MODE_SPECIFIC;
Pulse.colors.resize(1);
modes.push_back(Pulse);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = NZXT_KRAKEN_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
Breathing.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
Breathing.colors_min = 1;
Breathing.colors_max = 8;
Breathing.speed = NZXT_KRAKEN_SPEED_NORMAL;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode ThaiChi;
ThaiChi.name = "Thai Chi";
ThaiChi.value = NZXT_KRAKEN_MODE_TAI_CHI;
ThaiChi.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
ThaiChi.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
ThaiChi.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
ThaiChi.speed = NZXT_KRAKEN_SPEED_NORMAL;
ThaiChi.colors_min = 2;
ThaiChi.colors_max = 2;
ThaiChi.color_mode = MODE_COLORS_MODE_SPECIFIC;
ThaiChi.colors.resize(2);
modes.push_back(ThaiChi);
mode WaterCooler;
WaterCooler.name = "Water Cooler";
WaterCooler.value = NZXT_KRAKEN_MODE_WATER_COOLER;
WaterCooler.flags = MODE_FLAG_HAS_SPEED;
WaterCooler.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
WaterCooler.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
WaterCooler.speed = NZXT_KRAKEN_SPEED_NORMAL;
WaterCooler.colors_min = 1;
WaterCooler.colors_max = 1;
WaterCooler.color_mode = MODE_COLORS_NONE;
WaterCooler.colors.resize(1);
modes.push_back(WaterCooler);
mode Loading;
Loading.name = "Loading";
Loading.value = NZXT_KRAKEN_MODE_LOADING;
Loading.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Loading.colors_min = 1;
Loading.colors_max = 1;
Loading.color_mode = MODE_COLORS_MODE_SPECIFIC;
Loading.colors.resize(1);
modes.push_back(Loading);
mode Wings;
Wings.name = "Wings";
Wings.value = NZXT_KRAKEN_MODE_WINGS;
Wings.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Wings.speed_min = NZXT_KRAKEN_SPEED_SLOWEST;
Wings.speed_max = NZXT_KRAKEN_SPEED_FASTEST;
Wings.speed = NZXT_KRAKEN_SPEED_NORMAL;
Wings.colors_min = 1;
Wings.colors_max = 1;
Wings.color_mode = MODE_COLORS_MODE_SPECIFIC;
Wings.colors.resize(1);
modes.push_back(Wings);
/*---------------------------------------------------------*\
| Fixed is the default mode |
\*---------------------------------------------------------*/
default_mode = 0;
/*---------------------------------------------------------*\
| Modes supported by the LOGO LED |
\*---------------------------------------------------------*/
logo_modes =
{
NZXT_KRAKEN_MODE_FIXED,
NZXT_KRAKEN_MODE_FADING,
NZXT_KRAKEN_MODE_SPECTRUM,
NZXT_KRAKEN_MODE_BREATHING,
NZXT_KRAKEN_MODE_PULSE
};
SetupZones();
}
void RGBController_NZXTKraken::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
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);
zone ring_zone;
ring_zone.name = "Ring";
ring_zone.type = ZONE_TYPE_LINEAR;
ring_zone.leds_min = 8;
ring_zone.leds_max = 8;
ring_zone.leds_count = 8;
ring_zone.matrix_map = NULL;
zones.push_back(ring_zone);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
led logo_led;
logo_led.name = "Logo LED";
leds.push_back(logo_led);
led ring_led;
for(int i = 1; i < 9; i++)
{
ring_led.name = std::string("Ring LED ") + std::to_string(i);
leds.push_back(ring_led);
}
SetupColors();
}
void RGBController_NZXTKraken::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
std::vector<std::vector<RGBColor>> RGBController_NZXTKraken::GetColors(int zone, const mode& channel_mode)
{
std::vector<std::vector<RGBColor>> result;
int length = zone < 0 ? leds.size() : zones[zone].leds_count;
if(channel_mode.color_mode == MODE_COLORS_NONE)
{
result.push_back(std::vector<RGBColor>());
}
else if(channel_mode.color_mode == MODE_COLORS_PER_LED)
{
if(zone < 0)
{
result.push_back(colors);
}
else
{
std::vector<RGBColor> led_colors;
for(std::size_t idx = 0; idx < zones[zone].leds_count; ++idx)
{
led_colors.push_back(zones[zone].colors[idx]);
}
result.push_back(led_colors);
}
}
else if(channel_mode.color_mode == MODE_COLORS_MODE_SPECIFIC)
{
for(std::size_t idx = 0; idx < channel_mode.colors.size(); ++idx)
{
result.push_back(std::vector<RGBColor>(length, channel_mode.colors[idx]));
}
}
return result;
}
void RGBController_NZXTKraken::UpdateChannel(NZXTKrakenChannel_t channel, int zone, const mode& channel_mode)
{
bool direction = false;
if((channel_mode.flags & MODE_FLAG_HAS_DIRECTION_LR)
&&(channel_mode.direction == MODE_DIRECTION_LEFT ))
{
direction = true;
}
unsigned char speed = NZXT_KRAKEN_SPEED_NORMAL;
if(channel_mode.flags & MODE_FLAG_HAS_SPEED)
{
speed = channel_mode.speed;
}
std::vector<std::vector<RGBColor>> update_colors = GetColors(zone, channel_mode);
for(std::size_t idx = 0; idx < update_colors.size(); ++idx)
{
nzxtkraken->UpdateEffect(
channel,
channel_mode.value,
direction,
speed,
idx,
update_colors[idx]
);
}
}
void RGBController_NZXTKraken::DeviceUpdateLEDs()
{
if(logo_modes.find(modes[active_mode].value) == logo_modes.end())
{
UpdateChannel(NZXT_KRAKEN_CHANNEL_LOGO, 0, modes[default_mode]);
UpdateChannel(NZXT_KRAKEN_CHANNEL_RING, 1, modes[active_mode]);
}
else
{
UpdateChannel(NZXT_KRAKEN_CHANNEL_SYNC, -1, modes[active_mode]);
}
}
void RGBController_NZXTKraken::UpdateZoneLEDs(int zone)
{
NZXTKrakenChannel_t channel;
mode channel_mode = modes[active_mode];
if(zone == 0)
{
channel = NZXT_KRAKEN_CHANNEL_LOGO;
if(logo_modes.find(modes[active_mode].value) == logo_modes.end())
{
channel_mode = modes[default_mode];
}
}
else
{
channel = NZXT_KRAKEN_CHANNEL_RING;
}
UpdateChannel(channel, zone, channel_mode);
}
void RGBController_NZXTKraken::UpdateSingleLED(int led)
{
int zone = (led > 0) ? 1 : 0;
UpdateZoneLEDs(zone);
}
void RGBController_NZXTKraken::SetCustomMode()
{
active_mode = 0;
}
void RGBController_NZXTKraken::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

View file

@ -1,48 +0,0 @@
/*-----------------------------------------*\
| RGBController_NZXTKraken.h |
| |
| Generic RGB Interface for NZXT Kraken |
| |
| Martin Hartl (inlart) 04/04/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "NZXTKrakenController.h"
#include <set>
class RGBController_NZXTKraken : public RGBController
{
public:
RGBController_NZXTKraken(NZXTKrakenController* nzxtkraken_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:
std::vector<std::vector<RGBColor>> GetColors
(
int zone,
const mode& channel_mode
);
void UpdateChannel
(
NZXTKrakenChannel_t channel,
int zone,
const mode& channel_mode
);
NZXTKrakenController* nzxtkraken;
std::set<unsigned int> logo_modes;
int default_mode;
};

View file

@ -1,982 +0,0 @@
/*-----------------------------------------*\
| RGBController_OpenRazer.cpp |
| |
| Generic RGB Interface for OpenRazer |
| kernel drivers for Chroma peripherals |
| |
| Adam Honse (CalcProgrammer1) 6/15/2019 |
\*-----------------------------------------*/
#include "RGBController_OpenRazer.h"
#include "OpenRazerDevices.h"
#include <fstream>
#include <unistd.h>
using namespace std::chrono_literals;
void RGBController_OpenRazer::DeviceUpdateLEDs()
{
switch(matrix_type)
{
case RAZER_TYPE_MATRIX_FRAME:
case RAZER_TYPE_MATRIX_NOFRAME:
case RAZER_TYPE_MATRIX_STATIC:
{
char update_value = 1;
for (unsigned int row = 0; row < matrix_rows; row++)
{
unsigned int output_array_size;
unsigned int output_offset;
unsigned int row_offset = (row * matrix_cols);
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
{
output_array_size = 3 + (matrix_cols* 3);
output_offset = 3;
}
else
{
output_array_size = 3;
output_offset = 0;
}
char* output_array = new char[output_array_size];
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
{
output_array[0] = row;
output_array[1] = 0;
output_array[2] = matrix_cols - 1;
}
for(unsigned int col = 0; col < matrix_cols; col++)
{
unsigned int color_idx = col + row_offset;
output_array[(col * 3) + 0 + output_offset] = (char)RGBGetRValue(colors[color_idx]);
output_array[(col * 3) + 1 + output_offset] = (char)RGBGetGValue(colors[color_idx]);
output_array[(col * 3) + 2 + output_offset] = (char)RGBGetBValue(colors[color_idx]);
}
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
{
matrix_custom_frame.write(output_array, output_array_size);
matrix_custom_frame.flush();
}
else if(matrix_type == RAZER_TYPE_MATRIX_NOFRAME)
{
matrix_effect_custom.write(output_array, output_array_size);
matrix_effect_custom.flush();
}
else
{
matrix_effect_static.write(output_array, output_array_size);
matrix_effect_static.flush();
}
delete[] output_array;
std::this_thread::sleep_for(1ms);
}
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
{
matrix_effect_custom.write(&update_value, 1);
matrix_effect_custom.flush();
}
}
break;
case RAZER_TYPE_NOMATRIX:
{
DeviceUpdateMode();
}
break;
}
}
void RGBController_OpenRazer::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_OpenRazer::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_OpenRazer::SetupMatrixDevice(unsigned int rows, unsigned int cols)
{
if(!matrix_custom_frame)
{
if(!matrix_effect_custom)
{
matrix_type = RAZER_TYPE_MATRIX_STATIC;
}
else
{
matrix_type = RAZER_TYPE_MATRIX_NOFRAME;
}
matrix_rows = 1;
matrix_cols = 1;
}
else
{
matrix_type = RAZER_TYPE_MATRIX_FRAME;
matrix_rows = rows;
matrix_cols = cols;
}
}
void RGBController_OpenRazer::SetupNonMatrixDevice()
{
matrix_type = RAZER_TYPE_NOMATRIX;
}
void RGBController_OpenRazer::OpenFunctions(std::string dev_path)
{
device_type.open( dev_path + "/device_type");
device_serial.open( dev_path + "/device_serial");
firmware_version.open( dev_path + "/firmware_version");
matrix_custom_frame.open( dev_path + "/matrix_custom_frame");
matrix_brightness.open( dev_path + "/matrix_brightness");
matrix_effect_custom.open( dev_path + "/matrix_effect_custom");
matrix_effect_none.open( dev_path + "/matrix_effect_none");
matrix_effect_static.open( dev_path + "/matrix_effect_static");
matrix_effect_breath.open( dev_path + "/matrix_effect_breath");
matrix_effect_spectrum.open( dev_path + "/matrix_effect_spectrum");
matrix_effect_reactive.open( dev_path + "/matrix_effect_reactive");
matrix_effect_wave.open( dev_path + "/matrix_effect_wave");
logo_led_brightness.open( dev_path + "/logo_led_brightness");
logo_matrix_effect_none.open( dev_path + "/logo_matrix_effect_none");
logo_matrix_effect_static.open( dev_path + "/logo_matrix_effect_static");
logo_matrix_effect_breath.open( dev_path + "/logo_matrix_effect_breath");
logo_matrix_effect_spectrum.open( dev_path + "/logo_matrix_effect_spectrum");
logo_matrix_effect_reactive.open( dev_path + "/logo_matrix_effect_reactive");
scroll_led_brightness.open( dev_path + "/scroll_led_brightness");
scroll_matrix_effect_none.open( dev_path + "/scroll_matrix_effect_none");
scroll_matrix_effect_static.open( dev_path + "/scroll_matrix_effect_static");
scroll_matrix_effect_breath.open( dev_path + "/scroll_matrix_effect_breath");
scroll_matrix_effect_spectrum.open(dev_path + "/scroll_matrix_effect_spectrum");
scroll_matrix_effect_reactive.open(dev_path + "/scroll_matrix_effect_reactive");
backlight_led_effect.open( dev_path + "/backlight_led_effect");
backlight_led_rgb.open( dev_path + "/backlight_led_rgb");
backlight_led_state.open( dev_path + "/backlight_led_state");
logo_led_effect.open( dev_path + "/logo_led_effect");
logo_led_rgb.open( dev_path + "/logo_led_rgb");
logo_led_state.open( dev_path + "/logo_led_state");
scroll_led_effect.open( dev_path + "/scroll_led_effect");
scroll_led_rgb.open( dev_path + "/scroll_led_rgb");
scroll_led_state.open( dev_path + "/scroll_led_state");
/*-----------------------------------------------------------------*\
| The Naga Chroma (and possibly others) expose a useless |
| matrix_effect_custom interface because they use the matrix_ name |
| for the keypad LED. Close this useless interface in this case. |
| We can detect this when there is a logo matrix or scroll matrix |
| at the same time as matrix_effect_custom. |
\*-----------------------------------------------------------------*/
if((logo_matrix_effect_none || scroll_matrix_effect_none) && matrix_effect_custom)
{
matrix_effect_custom.close();
matrix_effect_custom.setstate(std::ios::failbit);
}
}
RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
{
/*-----------------------------------------------------------------*\
| Open the OpenRazer device functions |
\*-----------------------------------------------------------------*/
OpenFunctions(dev_path);
/*-----------------------------------------------------------------*\
| Start device at -1. This indicates the device was not detected |
\*-----------------------------------------------------------------*/
device_index = -1;
/*-----------------------------------------------------------------*\
| Get the device name from the OpenRazer driver |
\*-----------------------------------------------------------------*/
std::getline(device_type, name);
/*-----------------------------------------------------------------*\
| Set the description to indicate this is an OpenRazer device |
\*-----------------------------------------------------------------*/
description = "OpenRazer Device";
/*-----------------------------------------------------------------*\
| Set the device path as the location |
\*-----------------------------------------------------------------*/
location = dev_path;
/*-----------------------------------------------------------------*\
| Get the serial number from the dev path |
\*-----------------------------------------------------------------*/
std::getline(device_serial, serial);
/*-----------------------------------------------------------------*\
| Get the firmware version from the dev path |
\*-----------------------------------------------------------------*/
std::getline(firmware_version, version);
/*-----------------------------------------------------------------*\
| Loop through all known devices to look for a name match |
\*-----------------------------------------------------------------*/
for (std::size_t i = 0; i < RAZER_NUM_DEVICES; i++)
{
if (device_list[i]->name == name)
{
/*---------------------------------------------------------*\
| Set device ID |
\*---------------------------------------------------------*/
device_index = i;
/*---------------------------------------------------------*\
| Set device type |
\*---------------------------------------------------------*/
type = device_list[i]->type;
/*---------------------------------------------------------*\
| Initialize modes |
\*---------------------------------------------------------*/
if(matrix_effect_custom)
{
mode Direct;
Direct.name = "Direct";
Direct.value = RAZER_MODE_CUSTOM;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
}
if(matrix_effect_none || logo_matrix_effect_none || scroll_matrix_effect_none || backlight_led_state || logo_led_state || scroll_led_state)
{
mode Off;
Off.name = "Off";
Off.value = RAZER_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
}
if(matrix_effect_static || logo_matrix_effect_static || scroll_matrix_effect_static || backlight_led_effect || logo_led_effect || scroll_led_effect)
{
mode Static;
Static.name = "Static";
Static.value = RAZER_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
}
if(matrix_effect_breath || logo_matrix_effect_breath || scroll_matrix_effect_breath)
{
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = RAZER_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Breathing.colors_min = 1;
Breathing.colors_max = 2;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
modes.push_back(Breathing);
}
if(backlight_led_effect || logo_led_effect || scroll_led_effect)
{
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = RAZER_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
modes.push_back(Breathing);
}
if(backlight_led_effect || logo_led_effect || scroll_led_effect)
{
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = RAZER_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Flashing.colors_min = 1;
Flashing.colors_max = 1;
Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Flashing.colors.resize(1);
modes.push_back(Flashing);
}
if(matrix_effect_spectrum || logo_matrix_effect_spectrum || scroll_matrix_effect_spectrum || backlight_led_effect || logo_led_effect || scroll_led_effect)
{
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = RAZER_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = 0;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
}
if(matrix_effect_wave)
{
mode Wave;
Wave.name = "Wave";
Wave.value = RAZER_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_DIRECTION_LR;
Wave.direction = MODE_DIRECTION_RIGHT;
Wave.color_mode = MODE_COLORS_NONE;
modes.push_back(Wave);
}
if(matrix_effect_reactive || logo_matrix_effect_reactive || scroll_matrix_effect_reactive)
{
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = RAZER_MODE_REACTIVE;
Reactive.flags = 0;
Reactive.color_mode = MODE_COLORS_NONE;
modes.push_back(Reactive);
}
/*---------------------------------------------------------*\
| Initialize file descriptors |
\*---------------------------------------------------------*/
if(device_list[i]->matrix_type == true)
{
SetupMatrixDevice(device_list[i]->rows, device_list[i]->cols);
}
else
{
SetupNonMatrixDevice();
}
SetupZones();
}
}
}
RGBController_OpenRazer::~RGBController_OpenRazer()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
if(zones[zone_index].matrix_map->map != NULL)
{
delete zones[zone_index].matrix_map->map;
}
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_OpenRazer::SetupZones()
{
/*---------------------------------------------------------*\
| Fill in zone information based on device table |
\*---------------------------------------------------------*/
for(unsigned int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
{
if(device_list[device_index]->zones[zone_id] != NULL)
{
zone new_zone;
new_zone.name = device_list[device_index]->zones[zone_id]->name;
new_zone.type = device_list[device_index]->zones[zone_id]->type;
new_zone.leds_count = device_list[device_index]->zones[zone_id]->rows * device_list[device_index]->zones[zone_id]->cols;
new_zone.leds_min = new_zone.leds_count;
new_zone.leds_max = new_zone.leds_count;
if(new_zone.type == ZONE_TYPE_MATRIX)
{
matrix_map_type * new_map = new matrix_map_type;
new_zone.matrix_map = new_map;
new_map->height = device_list[device_index]->zones[zone_id]->rows;
new_map->width = device_list[device_index]->zones[zone_id]->cols;
new_map->map = new unsigned int[new_map->height * new_map->width];
for(unsigned int y = 0; y < new_map->height; y++)
{
for(unsigned int x = 0; x < new_map->width; x++)
{
new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x;
}
}
}
else
{
new_zone.matrix_map = NULL;
}
zones.push_back(new_zone);
}
}
for(unsigned int zone_id = 0; zone_id < zones.size(); zone_id++)
{
for (unsigned int row_id = 0; row_id < device_list[device_index]->zones[zone_id]->rows; row_id++)
{
for (unsigned int col_id = 0; col_id < device_list[device_index]->zones[zone_id]->cols; col_id++)
{
led* new_led = new led();
new_led->name = device_list[device_index]->zones[zone_id]->name;
if(zones[zone_id].leds_count > 1)
{
new_led->name.append(" LED ");
new_led->name.append(std::to_string(col_id + 1));
}
if(device_list[device_index]->keymap != NULL)
{
for(unsigned int i = 0; i < device_list[device_index]->keymap_size; i++)
{
if(zone_id == device_list[device_index]->keymap[i].zone &&
row_id == device_list[device_index]->keymap[i].row &&
col_id == device_list[device_index]->keymap[i].col)
{
new_led->name = device_list[device_index]->keymap[i].name;
}
}
}
leds.push_back(*new_led);
}
}
}
SetupColors();
}
void RGBController_OpenRazer::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_OpenRazer::SetCustomMode()
{
/*---------------------------------------------------------*\
| If device supports custom mode, it will be mode index 0 |
\*---------------------------------------------------------*/
if(modes[0].value == RAZER_MODE_CUSTOM)
{
active_mode = 0;
}
/*---------------------------------------------------------*\
| If not, use static mode. |
\*---------------------------------------------------------*/
else
{
for(unsigned int i = 0; i < modes.size(); i++)
{
if(modes[i].value == RAZER_MODE_STATIC)
{
active_mode = i;
break;
}
}
}
}
void RGBController_OpenRazer::DeviceUpdateMode()
{
char update_value[6];
char effect_value[1];
update_value[0] = 1;
switch(matrix_type)
{
case RAZER_TYPE_MATRIX_FRAME:
case RAZER_TYPE_MATRIX_NOFRAME:
{
switch(modes[active_mode].value)
{
case RAZER_MODE_CUSTOM:
matrix_effect_custom.write(update_value, 1);
matrix_effect_custom.flush();
break;
case RAZER_MODE_OFF:
matrix_effect_none.write(update_value, 1);
matrix_effect_none.flush();
break;
case RAZER_MODE_STATIC:
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
matrix_effect_static.write(update_value, 3);
matrix_effect_static.flush();
break;
case RAZER_MODE_BREATHING:
switch(modes[active_mode].color_mode)
{
case MODE_COLORS_MODE_SPECIFIC:
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
if(modes[active_mode].colors.size() == 2)
{
update_value[3] = RGBGetRValue(modes[active_mode].colors[1]);
update_value[4] = RGBGetGValue(modes[active_mode].colors[1]);
update_value[5] = RGBGetBValue(modes[active_mode].colors[1]);
matrix_effect_breath.write(update_value, 6);
matrix_effect_breath.flush();
}
else
{
matrix_effect_breath.write(update_value, 3);
matrix_effect_breath.flush();
}
break;
case MODE_COLORS_RANDOM:
matrix_effect_breath.write(update_value, 1);
matrix_effect_breath.flush();
break;
}
break;
case RAZER_MODE_SPECTRUM_CYCLE:
matrix_effect_spectrum.write(update_value, 1);
matrix_effect_spectrum.flush();
break;
case RAZER_MODE_WAVE:
switch(modes[active_mode].direction)
{
case MODE_DIRECTION_LEFT:
update_value[0] = '2';
break;
default:
update_value[0] = '1';
break;
}
matrix_effect_wave.write(update_value, 1);
matrix_effect_wave.flush();
break;
case RAZER_MODE_REACTIVE:
matrix_effect_reactive.write(update_value, 1);
matrix_effect_reactive.flush();
break;
}
std::this_thread::sleep_for(20ms);
}
break;
case RAZER_TYPE_NOMATRIX:
{
switch(modes[active_mode].value)
{
case RAZER_MODE_CUSTOM:
matrix_effect_custom.write(update_value, 1);
matrix_effect_custom.flush();
break;
case RAZER_MODE_OFF:
if(matrix_effect_none)
{
matrix_effect_none.write(update_value, 1);
matrix_effect_none.flush();
}
if(logo_matrix_effect_none)
{
logo_matrix_effect_none.write(update_value, 1);
logo_matrix_effect_none.flush();
}
if(scroll_matrix_effect_none)
{
scroll_matrix_effect_none.write(update_value, 1);
scroll_matrix_effect_none.flush();
}
if(backlight_led_state)
{
update_value[0] = '0';
backlight_led_state.write(update_value, 1);
backlight_led_state.flush();
}
if(logo_led_state)
{
update_value[0] = '0';
logo_led_state.write(update_value, 1);
logo_led_state.flush();
}
if(scroll_led_state)
{
update_value[0] = '0';
scroll_led_state.write(update_value, 1);
scroll_led_state.flush();
}
break;
case RAZER_MODE_STATIC:
effect_value[0] = '0';
if(backlight_led_state)
{
update_value[0] = '1';
backlight_led_state.write(update_value, 1);
backlight_led_state.flush();
}
if(logo_led_state)
{
update_value[0] = '1';
logo_led_state.write(update_value, 1);
logo_led_state.flush();
}
if(scroll_led_state)
{
update_value[0] = '1';
scroll_led_state.write(update_value, 1);
scroll_led_state.flush();
}
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
if(matrix_effect_static)
{
matrix_effect_static.write(update_value, 3);
matrix_effect_static.flush();
}
if(logo_matrix_effect_static)
{
logo_matrix_effect_static.write(update_value, 3);
logo_matrix_effect_static.flush();
}
if(scroll_matrix_effect_static)
{
scroll_matrix_effect_static.write(update_value, 3);
scroll_matrix_effect_static.flush();
}
if(backlight_led_effect && backlight_led_rgb)
{
backlight_led_rgb.write(update_value, 3);
backlight_led_rgb.flush();
backlight_led_effect.write(effect_value, 1);
backlight_led_effect.flush();
}
if(logo_led_effect && logo_led_rgb)
{
logo_led_rgb.write(update_value, 3);
logo_led_rgb.flush();
logo_led_effect.write(effect_value, 1);
logo_led_effect.flush();
}
if(scroll_led_effect && scroll_led_rgb)
{
scroll_led_rgb.write(update_value, 3);
scroll_led_rgb.flush();
scroll_led_effect.write(effect_value, 1);
scroll_led_effect.flush();
}
break;
case RAZER_MODE_FLASHING:
effect_value[0] = '1';
if(backlight_led_state)
{
update_value[0] = '1';
backlight_led_state.write(update_value, 1);
backlight_led_state.flush();
}
if(logo_led_state)
{
update_value[0] = '1';
logo_led_state.write(update_value, 1);
logo_led_state.flush();
}
if(scroll_led_state)
{
update_value[0] = '1';
scroll_led_state.write(update_value, 1);
scroll_led_state.flush();
}
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
if(backlight_led_effect && backlight_led_rgb)
{
backlight_led_rgb.write(update_value, 3);
backlight_led_rgb.flush();
backlight_led_effect.write(effect_value, 1);
backlight_led_effect.flush();
}
if(logo_led_effect && logo_led_rgb)
{
logo_led_rgb.write(update_value, 3);
logo_led_rgb.flush();
logo_led_effect.write(effect_value, 1);
logo_led_effect.flush();
}
if(scroll_led_effect && scroll_led_rgb)
{
scroll_led_rgb.write(update_value, 3);
scroll_led_rgb.flush();
scroll_led_effect.write(effect_value, 1);
scroll_led_effect.flush();
}
break;
case RAZER_MODE_BREATHING:
effect_value[0] = '2';
switch(modes[active_mode].color_mode)
{
case MODE_COLORS_MODE_SPECIFIC:
if(backlight_led_state)
{
update_value[0] = '1';
backlight_led_state.write(update_value, 1);
backlight_led_state.flush();
}
if(logo_led_state)
{
update_value[0] = '1';
logo_led_state.write(update_value, 1);
logo_led_state.flush();
}
if(scroll_led_state)
{
update_value[0] = '1';
scroll_led_state.write(update_value, 1);
scroll_led_state.flush();
}
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
if(modes[active_mode].colors.size() == 2)
{
update_value[3] = RGBGetRValue(modes[active_mode].colors[1]);
update_value[4] = RGBGetGValue(modes[active_mode].colors[1]);
update_value[5] = RGBGetBValue(modes[active_mode].colors[1]);
if(matrix_effect_breath)
{
matrix_effect_breath.write(update_value, 6);
matrix_effect_breath.flush();
}
if(logo_matrix_effect_breath)
{
logo_matrix_effect_breath.write(update_value, 6);
logo_matrix_effect_breath.flush();
}
if(scroll_matrix_effect_breath)
{
scroll_matrix_effect_breath.write(update_value, 6);
scroll_matrix_effect_breath.flush();
}
}
else
{
if(matrix_effect_breath)
{
matrix_effect_breath.write(update_value, 3);
matrix_effect_breath.flush();
}
if(logo_matrix_effect_breath)
{
logo_matrix_effect_breath.write(update_value, 3);
logo_matrix_effect_breath.flush();
}
if(scroll_matrix_effect_breath)
{
scroll_matrix_effect_breath.write(update_value, 3);
scroll_matrix_effect_breath.flush();
}
if(backlight_led_effect && backlight_led_rgb)
{
backlight_led_rgb.write(update_value, 3);
backlight_led_rgb.flush();
backlight_led_effect.write(effect_value, 1);
backlight_led_effect.flush();
}
if(logo_led_effect && logo_led_rgb)
{
logo_led_rgb.write(update_value, 3);
logo_led_rgb.flush();
logo_led_effect.write(effect_value, 1);
logo_led_effect.flush();
}
if(scroll_led_effect && scroll_led_rgb)
{
scroll_led_rgb.write(update_value, 3);
scroll_led_rgb.flush();
scroll_led_effect.write(effect_value, 1);
scroll_led_effect.flush();
}
}
break;
case MODE_COLORS_RANDOM:
if(matrix_effect_breath)
{
matrix_effect_breath.write(update_value, 1);
matrix_effect_breath.flush();
}
if(logo_matrix_effect_breath)
{
logo_matrix_effect_breath.write(update_value, 1);
logo_matrix_effect_breath.flush();
}
if(scroll_matrix_effect_breath)
{
scroll_matrix_effect_breath.write(update_value, 1);
scroll_matrix_effect_breath.flush();
}
break;
}
break;
case RAZER_MODE_SPECTRUM_CYCLE:
effect_value[0] = '4';
if(backlight_led_state)
{
update_value[0] = '1';
backlight_led_state.write(update_value, 1);
backlight_led_state.flush();
}
if(logo_led_state)
{
update_value[0] = '1';
logo_led_state.write(update_value, 1);
logo_led_state.flush();
}
if(scroll_led_state)
{
update_value[0] = '1';
scroll_led_state.write(update_value, 1);
scroll_led_state.flush();
}
if(matrix_effect_spectrum)
{
matrix_effect_spectrum.write(update_value, 1);
matrix_effect_spectrum.flush();
}
if(logo_matrix_effect_spectrum)
{
logo_matrix_effect_spectrum.write(update_value, 1);
logo_matrix_effect_spectrum.flush();
}
if(scroll_matrix_effect_spectrum)
{
scroll_matrix_effect_spectrum.write(update_value, 1);
scroll_matrix_effect_spectrum.flush();
}
if(backlight_led_effect)
{
backlight_led_effect.write(effect_value, 1);
backlight_led_effect.flush();
}
if(logo_led_effect)
{
logo_led_effect.write(effect_value, 1);
logo_led_effect.flush();
}
if(scroll_led_effect)
{
scroll_led_effect.write(effect_value, 1);
scroll_led_effect.flush();
}
break;
case RAZER_MODE_REACTIVE:
if(matrix_effect_reactive)
{
matrix_effect_reactive.write(update_value, 1);
matrix_effect_reactive.flush();
}
if(logo_matrix_effect_reactive)
{
logo_matrix_effect_reactive.write(update_value, 1);
logo_matrix_effect_reactive.flush();
}
if(scroll_matrix_effect_reactive)
{
scroll_matrix_effect_reactive.write(update_value, 1);
scroll_matrix_effect_reactive.flush();
}
break;
}
}
break;
}
}

View file

@ -1,108 +0,0 @@
/*-----------------------------------------*\
| RGBController_OpenRazer.h |
| |
| Generic RGB Interface for OpenRazer |
| kernel drivers for Chroma peripherals |
| |
| Adam Honse (CalcProgrammer1) 6/15/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include <fstream>
class RGBController_OpenRazer : public RGBController
{
public:
enum
{
RAZER_MODE_CUSTOM,
RAZER_MODE_OFF,
RAZER_MODE_STATIC,
RAZER_MODE_BREATHING,
RAZER_MODE_SPECTRUM_CYCLE,
RAZER_MODE_WAVE,
RAZER_MODE_REACTIVE,
RAZER_MODE_FLASHING,
RAZER_NUM_MODES
};
enum
{
RAZER_TYPE_MATRIX_FRAME,
RAZER_TYPE_MATRIX_NOFRAME,
RAZER_TYPE_MATRIX_STATIC,
RAZER_TYPE_NOMATRIX,
RAZER_NUM_TYPES
};
public:
RGBController_OpenRazer(std::string dev_path);
~RGBController_OpenRazer();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
int device_index;
private:
void SetupMatrixDevice(unsigned int rows, unsigned int cols);
void SetupNonMatrixDevice();
unsigned int matrix_type;
unsigned int matrix_rows;
unsigned int matrix_cols;
void OpenFunctions(std::string dev_path);
std::ifstream device_type;
std::ifstream device_serial;
std::ifstream firmware_version;
std::ofstream matrix_custom_frame;
std::ofstream matrix_brightness;
std::ofstream matrix_effect_custom;
std::ofstream matrix_effect_none;
std::ofstream matrix_effect_static;
std::ofstream matrix_effect_breath;
std::ofstream matrix_effect_spectrum;
std::ofstream matrix_effect_reactive;
std::ofstream matrix_effect_wave;
std::ofstream logo_led_brightness;
std::ofstream logo_matrix_effect_none;
std::ofstream logo_matrix_effect_static;
std::ofstream logo_matrix_effect_breath;
std::ofstream logo_matrix_effect_spectrum;
std::ofstream logo_matrix_effect_reactive;
std::ofstream scroll_led_brightness;
std::ofstream scroll_matrix_effect_none;
std::ofstream scroll_matrix_effect_static;
std::ofstream scroll_matrix_effect_breath;
std::ofstream scroll_matrix_effect_spectrum;
std::ofstream scroll_matrix_effect_reactive;
std::ofstream backlight_led_effect;
std::ofstream backlight_led_rgb;
std::ofstream backlight_led_state;
std::ofstream logo_led_effect;
std::ofstream logo_led_rgb;
std::ofstream logo_led_state;
std::ofstream scroll_led_effect;
std::ofstream scroll_led_rgb;
std::ofstream scroll_led_state;
};

File diff suppressed because it is too large Load diff

View file

@ -1,142 +0,0 @@
/*-----------------------------------------*\
| RGBController_OpenRazerWindows.h |
| |
| Generic RGB Interface for OpenRazer |
| kernel drivers for Chroma peripherals |
| |
| Adam Honse (CalcProgrammer1) 6/15/2019 |
\*-----------------------------------------*/
#include "RGBController.h"
#include "OpenRazerDevices.h"
#include <fstream>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hid.h>
typedef struct
{
struct device_attribute* device_type;
struct device_attribute* device_serial;
struct device_attribute* firmware_version;
struct device_attribute* matrix_custom_frame;
struct device_attribute* matrix_brightness;
struct device_attribute* matrix_effect_custom;
struct device_attribute* matrix_effect_none;
struct device_attribute* matrix_effect_static;
struct device_attribute* matrix_effect_breath;
struct device_attribute* matrix_effect_spectrum;
struct device_attribute* matrix_effect_reactive;
struct device_attribute* matrix_effect_wave;
struct device_attribute* logo_led_brightness;
struct device_attribute* logo_matrix_effect_none;
struct device_attribute* logo_matrix_effect_static;
struct device_attribute* logo_matrix_effect_breath;
struct device_attribute* logo_matrix_effect_spectrum;
struct device_attribute* logo_matrix_effect_reactive;
struct device_attribute* scroll_led_brightness;
struct device_attribute* scroll_matrix_effect_none;
struct device_attribute* scroll_matrix_effect_static;
struct device_attribute* scroll_matrix_effect_breath;
struct device_attribute* scroll_matrix_effect_spectrum;
struct device_attribute* scroll_matrix_effect_reactive;
struct device_attribute* left_led_brightness;
struct device_attribute* left_matrix_effect_none;
struct device_attribute* left_matrix_effect_static;
struct device_attribute* left_matrix_effect_breath;
struct device_attribute* left_matrix_effect_spectrum;
struct device_attribute* left_matrix_effect_reactive;
struct device_attribute* left_matrix_effect_wave;
struct device_attribute* right_led_brightness;
struct device_attribute* right_matrix_effect_none;
struct device_attribute* right_matrix_effect_static;
struct device_attribute* right_matrix_effect_breath;
struct device_attribute* right_matrix_effect_spectrum;
struct device_attribute* right_matrix_effect_reactive;
struct device_attribute* right_matrix_effect_wave;
struct device_attribute* logo_led_effect;
struct device_attribute* logo_led_rgb;
struct device_attribute* logo_led_state;
struct device_attribute* scroll_led_effect;
struct device_attribute* scroll_led_rgb;
struct device_attribute* scroll_led_state;
} device_fn_type;
class RGBController_OpenRazer : public RGBController
{
public:
enum
{
RAZER_MODE_CUSTOM,
RAZER_MODE_OFF,
RAZER_MODE_STATIC,
RAZER_MODE_BREATHING,
RAZER_MODE_SPECTRUM_CYCLE,
RAZER_MODE_WAVE,
RAZER_MODE_REACTIVE,
RAZER_MODE_FLASHING,
RAZER_NUM_MODES
};
enum
{
RAZER_TYPE_MATRIX_FRAME,
RAZER_TYPE_MATRIX_NOFRAME,
RAZER_TYPE_MATRIX_STATIC,
RAZER_TYPE_NOMATRIX,
RAZER_NUM_TYPES
};
public:
RGBController_OpenRazer(device * razer_device, device_fn_type* razer_functions);
~RGBController_OpenRazer();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
int device_index;
private:
void SetupMatrixDevice(device_fn_type* razer_functions, unsigned int rows, unsigned int cols);
void SetupNonMatrixDevice();
unsigned int matrix_type;
unsigned int matrix_rows;
unsigned int matrix_cols;
device* razer_device;
device_fn_type* razer_functions;
//OpenRazer Sysfs Entries for Matrix Devices
std::ofstream matrix_custom_frame;
std::ofstream matrix_effect_custom;
std::ofstream matrix_effect_breath;
std::ofstream matrix_effect_none;
std::ofstream matrix_effect_reactive;
std::ofstream matrix_effect_spectrum;
std::ofstream matrix_effect_static;
std::ofstream matrix_effect_wave;
//OpenRazer Sysfs Entries for Non-Matrix Devices
std::ofstream logo_led_effect;
std::ofstream logo_led_rgb;
std::ofstream scroll_led_effect;
std::ofstream scroll_led_rgb;
};

View file

@ -1,206 +0,0 @@
/*-----------------------------------------*\
| RGBController_PatriotViper.cpp |
| |
| Generic RGB Interface for OpenRGB |
| Patriot Viper RGB interface |
| |
| Adam Honse (CalcProgrammer1) 1/1/2020 |
\*-----------------------------------------*/
#include "RGBController_PatriotViper.h"
RGBController_PatriotViper::RGBController_PatriotViper(PatriotViperController* viper_ptr)
{
viper = viper_ptr;
name = viper->GetDeviceName();
type = DEVICE_TYPE_DRAM;
description = "Patriot Viper Device";
location = viper->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.speed_min = 0;
Direct.speed_max = 0;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.speed = 0;
modes.push_back(Direct);
mode Dark;
Dark.name = "Dark";
Dark.value = VIPER_MODE_DARK;
Dark.flags = 0;
Dark.speed_min = 0;
Dark.speed_max = 0;
Dark.color_mode = MODE_COLORS_NONE;
Dark.speed = 0;
modes.push_back(Dark);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = VIPER_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = VIPER_SPEED_BREATHING_MIN;
Breathing.speed_max = VIPER_SPEED_BREATHING_MAX;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed = VIPER_SPEED_BREATHING_DEFAULT;
modes.push_back(Breathing);
mode Viper;
Viper.name = "Viper";
Viper.value = VIPER_MODE_VIPER;
Viper.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Viper.speed_min = VIPER_SPEED_MIN;
Viper.speed_max = VIPER_SPEED_MAX;
Viper.color_mode = MODE_COLORS_PER_LED;
Viper.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Viper);
mode Heartbeat;
Heartbeat.name = "Heartbeat";
Heartbeat.value = VIPER_MODE_HEARTBEAT;
Heartbeat.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Heartbeat.speed_min = VIPER_SPEED_MIN;
Heartbeat.speed_max = VIPER_SPEED_MAX;
Heartbeat.color_mode = MODE_COLORS_PER_LED;
Heartbeat.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Heartbeat);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = VIPER_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Marquee.speed_min = VIPER_SPEED_MIN;
Marquee.speed_max = VIPER_SPEED_MAX;
Marquee.color_mode = MODE_COLORS_PER_LED;
Marquee.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Marquee);
mode Raindrop;
Raindrop.name = "Raindrop";
Raindrop.value = VIPER_MODE_RAINDROP;
Raindrop.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Raindrop.speed_min = VIPER_SPEED_MIN;
Raindrop.speed_max = VIPER_SPEED_MAX;
Raindrop.color_mode = MODE_COLORS_PER_LED;
Raindrop.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Raindrop);
mode Aurora;
Aurora.name = "Aurora";
Aurora.value = VIPER_MODE_AURORA;
Aurora.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Aurora.speed_min = VIPER_SPEED_MIN;
Aurora.speed_max = VIPER_SPEED_MAX;
Aurora.color_mode = MODE_COLORS_PER_LED;
Aurora.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Aurora);
SetupZones();
}
void RGBController_PatriotViper::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
for(unsigned int slot = 0; slot < viper->GetSlotCount(); slot++)
{
zone* new_zone = new zone;
new_zone->name = "Patriot Viper RGB";
new_zone->type = ZONE_TYPE_LINEAR;
new_zone->leds_min = 5;
new_zone->leds_max = 5;
new_zone->leds_count = 5;
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 = "Patriot Viper RGB LED ";
new_led->name.append(std::to_string(led_idx + 1));
leds.push_back(*new_led);
}
SetupColors();
}
void RGBController_PatriotViper::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_PatriotViper::DeviceUpdateLEDs()
{
if(viper->direct == true)
{
for(int led = 0; led < 5; led++)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
viper->SetLEDColor(led, red, grn, blu);
}
}
else
{
for(int led = 0; led < 5; led++)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
viper->SetLEDEffectColor(led, red, grn, blu);
}
}
}
void RGBController_PatriotViper::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_PatriotViper::UpdateSingleLED(int led)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if(viper->direct == true)
{
viper->SetLEDColor(led, red, grn, blu);
}
else
{
viper->SetLEDEffectColor(led, red, grn, blu);
}
}
void RGBController_PatriotViper::SetCustomMode()
{
active_mode = 0;
}
void RGBController_PatriotViper::DeviceUpdateMode()
{
if(modes[active_mode].value == 0xFFFF)
{
viper->SetDirect();
}
else
{
viper->SetMode(modes[active_mode].value, modes[active_mode].speed);
}
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_PatriotViper.h |
| |
| Generic RGB Interface for OpenRGB |
| Patriot Viper RGB interface |
| |
| Adam Honse (CalcProgrammer1) 1/1/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "PatriotViperController.h"
class RGBController_PatriotViper : public RGBController
{
public:
RGBController_PatriotViper(PatriotViperController* viper_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:
PatriotViperController* viper;
};

View file

@ -1,629 +0,0 @@
/*-----------------------------------------*\
| RGBController_Polychrome.cpp |
| |
| Generic RGB Interface for OpenRGB |
| ASRock ASR LED and Polychrome RGB Driver |
| |
| Adam Honse (CalcProgrammer1) 12/15/2019 |
\*-----------------------------------------*/
#include "RGBController_Polychrome.h"
#define ASROCK_MAX_ZONES 4
#define ASROCK_MAX_LEDS 22
static const char* polychrome_v1_zone_names[] =
{
"RGB LED 1 Header",
"RGB LED 2 Header",
"PCH",
"IO Cover",
"Audio",
"Addressable Header"
};
static const char* polychrome_v2_zone_names[] =
{
"RGB LED 1 Header",
"RGB LED 2 Header",
"Audio",
"PCH",
"IO Cover",
"Addressable Header"
};
RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychrome_ptr)
{
polychrome = polychrome_ptr;
name = polychrome->GetDeviceName();
version = polychrome->GetFirmwareVersion();
type = DEVICE_TYPE_MOTHERBOARD;
description = "ASRock ASR LED/Polychrome Device";
location = polychrome->GetDeviceLocation();
switch(polychrome->GetASRockType())
{
case ASROCK_TYPE_ASRLED:
{
mode Off;
Off.name = "Off";
Off.value = ASRLED_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = ASRLED_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 = ASRLED_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = ASRLED_SPEED_MIN;
Breathing.speed_max = ASRLED_SPEED_MAX;
Breathing.speed = ASRLED_SPEED_DEFAULT;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode Strobe;
Strobe.name = "Strobe";
Strobe.value = ASRLED_MODE_STROBE;
Strobe.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Strobe.speed_min = ASRLED_SPEED_MIN;
Strobe.speed_max = ASRLED_SPEED_MAX;
Strobe.speed = ASRLED_SPEED_DEFAULT;
Strobe.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Strobe);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = ASRLED_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
SpectrumCycle.speed_min = ASRLED_SPEED_MIN;
SpectrumCycle.speed_max = ASRLED_SPEED_MAX;
SpectrumCycle.speed = ASRLED_SPEED_DEFAULT;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Random;
Random.name = "Random";
Random.value = ASRLED_MODE_RANDOM;
Random.flags = MODE_FLAG_HAS_SPEED;
Random.speed_min = ASRLED_SPEED_MIN;
Random.speed_max = ASRLED_SPEED_MAX;
Random.speed = ASRLED_SPEED_DEFAULT;
Random.color_mode = MODE_COLORS_NONE;
modes.push_back(Random);
mode Music;
Music.name = "Music";
Music.value = ASRLED_MODE_MUSIC;
Music.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Music.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Music);
mode Wave;
Wave.name = "Wave";
Wave.value = ASRLED_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED;
Wave.speed_min = ASRLED_SPEED_MIN;
Wave.speed_max = ASRLED_SPEED_MAX;
Wave.speed = ASRLED_SPEED_DEFAULT;
Wave.color_mode = MODE_COLORS_NONE;
modes.push_back(Wave);
}
break;
case ASROCK_TYPE_POLYCHROME_V1:
{
mode Off;
Off.name = "Off";
Off.value = POLYCHROME_V1_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = POLYCHROME_V1_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 = POLYCHROME_V1_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = POLYCHROME_V1_SPEED_MIN_BREATHING;
Breathing.speed_max = POLYCHROME_V1_SPEED_MAX_BREATHING;
Breathing.speed = POLYCHROME_V1_SPEED_DEFAULT_BREATHING;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode Strobe;
Strobe.name = "Strobe";
Strobe.value = POLYCHROME_V1_MODE_STROBE;
Strobe.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Strobe.speed_min = POLYCHROME_V1_SPEED_MIN_STROBE;
Strobe.speed_max = POLYCHROME_V1_SPEED_MAX_STROBE;
Strobe.speed = POLYCHROME_V1_SPEED_DEFAULT_STROBE;
Strobe.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Strobe);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = POLYCHROME_V1_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
SpectrumCycle.speed_min = POLYCHROME_V1_SPEED_MIN_CYCLE;
SpectrumCycle.speed_max = POLYCHROME_V1_SPEED_MAX_CYCLE;
SpectrumCycle.speed = POLYCHROME_V1_SPEED_DEFAULT_CYCLE;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Random;
Random.name = "Random";
Random.value = POLYCHROME_V1_MODE_RANDOM;
Random.flags = MODE_FLAG_HAS_SPEED;
Random.speed_min = POLYCHROME_V1_SPEED_MIN_RANDOM;
Random.speed_max = POLYCHROME_V1_SPEED_MAX_RANDOM;
Random.speed = POLYCHROME_V1_SPEED_DEFAULT_RANDOM;
Random.color_mode = MODE_COLORS_NONE;
modes.push_back(Random);
mode Music;
Music.name = "Music";
Music.value = POLYCHROME_V1_MODE_MUSIC;
Music.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Music.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Music);
mode Wave;
Wave.name = "Wave";
Wave.value = POLYCHROME_V1_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED;
Wave.speed_min = POLYCHROME_V1_SPEED_MIN_WAVE;
Wave.speed_max = POLYCHROME_V1_SPEED_MAX_WAVE;
Wave.speed = POLYCHROME_V1_SPEED_DEFAULT_WAVE;
Wave.color_mode = MODE_COLORS_NONE;
modes.push_back(Wave);
/*---------------------------------------------------------------------*\
| Comment out until per zone modes are working. These are only for ARGB |
\*---------------------------------------------------------------------*/
// mode Spring;
// Spring.name = "Spring";
// Spring.value = POLYCHROME_V1_MODE_SPRING;
// Spring.flags = MODE_FLAG_HAS_SPEED;
// Spring.speed_min = POLYCHROME_V1_SPEED_MIN_ARGB;
// Spring.speed_max = POLYCHROME_V1_SPEED_MAX_ARGB;
// Spring.speed = POLYCHROME_V1_SPEED_DEFAULT_SPRING;
// Spring.color_mode = MODE_COLORS_PER_LED;
// modes.push_back(Spring);
// mode Stack;
// Stack.name = "Stack";
// Stack.value = POLYCHROME_V1_MODE_STACK;
// Stack.flags = MODE_FLAG_HAS_SPEED;
// Stack.speed_min = POLYCHROME_V1_SPEED_MIN_ARGB;
// Stack.speed_max = POLYCHROME_V1_SPEED_MAX_ARGB;
// Stack.speed = POLYCHROME_V1_SPEED_DEFAULT_STACK;
// Stack.color_mode = MODE_COLORS_PER_LED;
// modes.push_back(Stack);
// mode Cram;
// Cram.name = "Cram";
// Cram.value = POLYCHROME_V1_MODE_CRAM;
// Cram.flags = MODE_FLAG_HAS_SPEED;
// Cram.speed_min = POLYCHROME_V1_SPEED_MIN_ARGB;
// Cram.speed_max = POLYCHROME_V1_SPEED_MAX_ARGB;
// Cram.speed = POLYCHROME_V1_SPEED_DEFAULT_CRAM;
// Cram.color_mode = MODE_COLORS_PER_LED;
// modes.push_back(Cram);
// mode Scan;
// Scan.name = "Scan";
// Scan.value = POLYCHROME_V1_MODE_SCAN;
// Scan.flags = MODE_FLAG_HAS_SPEED;
// Scan.speed_min = POLYCHROME_V1_SPEED_MIN_ARGB;
// Scan.speed_max = POLYCHROME_V1_SPEED_MAX_ARGB;
// Scan.speed = POLYCHROME_V1_SPEED_DEFAULT_SCAN;
// Scan.color_mode = MODE_COLORS_PER_LED;
// modes.push_back(Scan);
// mode Neon;
// Neon.name = "Neon";
// Neon.value = POLYCHROME_V1_MODE_NEON;
// Neon.flags = MODE_FLAG_HAS_SPEED;
// Neon.speed_min = POLYCHROME_V1_SPEED_MIN_ARGB;
// Neon.speed_max = POLYCHROME_V1_SPEED_MAX_ARGB;
// Neon.speed = POLYCHROME_V1_SPEED_DEFAULT_NEON;
// Neon.color_mode = MODE_COLORS_PER_LED;
// modes.push_back(Neon);
// mode Water;
// Water.name = "Water";
// Water.value = POLYCHROME_V1_MODE_WATER;
// Water.flags = MODE_FLAG_HAS_SPEED;
// Water.speed_min = POLYCHROME_V1_SPEED_MIN_ARGB;
// Water.speed_max = POLYCHROME_V1_SPEED_MAX_ARGB;
// Water.speed = POLYCHROME_V1_SPEED_DEFAULT_WATER;
// Water.color_mode = MODE_COLORS_PER_LED;
// modes.push_back(Water);
// mode Rainbow;
// Rainbow.name = "Rainbow";
// Rainbow.value = POLYCHROME_V1_MODE_RAINBOW;
// Rainbow.flags = MODE_FLAG_HAS_SPEED;
// Rainbow.speed_min = POLYCHROME_V1_SPEED_MIN_RAINBOW;
// Rainbow.speed_max = POLYCHROME_V1_SPEED_MAX_RAINBOW;
// Rainbow.speed = POLYCHROME_V1_SPEED_DEFAULT_RAINBOW;
// Rainbow.color_mode = MODE_COLORS_NONE;
// modes.push_back(Rainbow);
}
break;
case ASROCK_TYPE_POLYCHROME_V2:
{
mode Off;
Off.name = "Off";
Off.value = POLYCHROME_V2_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = POLYCHROME_V2_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 = POLYCHROME_V2_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = POLYCHROME_V2_SPEED_MIN;
Breathing.speed_max = POLYCHROME_V2_SPEED_MAX;
Breathing.speed = POLYCHROME_V2_SPEED_DEFAULT;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode Strobe;
Strobe.name = "Strobe";
Strobe.value = POLYCHROME_V2_MODE_STROBE;
Strobe.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Strobe.speed_min = POLYCHROME_V2_SPEED_MIN;
Strobe.speed_max = POLYCHROME_V2_SPEED_MAX;
Strobe.speed = POLYCHROME_V2_SPEED_DEFAULT;
Strobe.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Strobe);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = POLYCHROME_V2_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
SpectrumCycle.speed_min = POLYCHROME_V2_SPEED_MIN;
SpectrumCycle.speed_max = POLYCHROME_V2_SPEED_MAX;
SpectrumCycle.speed = POLYCHROME_V2_SPEED_DEFAULT;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Random;
Random.name = "Random";
Random.value = POLYCHROME_V2_MODE_RANDOM;
Random.flags = MODE_FLAG_HAS_SPEED;
Random.speed_min = POLYCHROME_V2_SPEED_MIN;
Random.speed_max = POLYCHROME_V2_SPEED_MAX;
Random.speed = POLYCHROME_V2_SPEED_DEFAULT;
Random.color_mode = MODE_COLORS_NONE;
modes.push_back(Random);
mode Wave;
Wave.name = "Wave";
Wave.value = POLYCHROME_V2_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED;
Wave.speed_min = POLYCHROME_V2_SPEED_MIN;
Wave.speed_max = POLYCHROME_V2_SPEED_MAX;
Wave.speed = POLYCHROME_V2_SPEED_DEFAULT;
Wave.color_mode = MODE_COLORS_NONE;
modes.push_back(Wave);
mode Spring;
Spring.name = "Spring";
Spring.value = POLYCHROME_V2_MODE_SPRING;
Spring.flags = MODE_FLAG_HAS_SPEED;
Spring.speed_min = POLYCHROME_V2_SPEED_MIN;
Spring.speed_max = POLYCHROME_V2_SPEED_MAX;
Spring.speed = POLYCHROME_V2_SPEED_DEFAULT;
Spring.color_mode = MODE_COLORS_NONE;
modes.push_back(Spring);
mode Stack;
Stack.name = "Stack";
Stack.value = POLYCHROME_V2_MODE_STACK;
Stack.flags = MODE_FLAG_HAS_SPEED;
Stack.speed_min = POLYCHROME_V2_SPEED_MIN;
Stack.speed_max = POLYCHROME_V2_SPEED_MAX;
Stack.speed = POLYCHROME_V2_SPEED_DEFAULT;
Stack.color_mode = MODE_COLORS_NONE;
modes.push_back(Stack);
mode Cram;
Cram.name = "Cram";
Cram.value = POLYCHROME_V2_MODE_CRAM;
Cram.flags = MODE_FLAG_HAS_SPEED;
Cram.speed_min = POLYCHROME_V2_SPEED_MIN;
Cram.speed_max = POLYCHROME_V2_SPEED_MAX;
Cram.speed = POLYCHROME_V2_SPEED_DEFAULT;
Cram.color_mode = MODE_COLORS_NONE;
modes.push_back(Cram);
mode Scan;
Scan.name = "Scan";
Scan.value = POLYCHROME_V2_MODE_SCAN;
Scan.flags = MODE_FLAG_HAS_SPEED;
Scan.speed_min = POLYCHROME_V2_SPEED_MIN;
Scan.speed_max = POLYCHROME_V2_SPEED_MAX;
Scan.speed = POLYCHROME_V2_SPEED_DEFAULT;
Scan.color_mode = MODE_COLORS_NONE;
modes.push_back(Scan);
mode Neon;
Neon.name = "Neon";
Neon.value = POLYCHROME_V2_MODE_NEON;
Neon.flags = 0;
Neon.color_mode = MODE_COLORS_NONE;
modes.push_back(Neon);
mode Water;
Water.name = "Water";
Water.value = POLYCHROME_V2_MODE_WATER;
Water.flags = MODE_FLAG_HAS_SPEED;
Water.speed_min = POLYCHROME_V2_SPEED_MIN;
Water.speed_max = POLYCHROME_V2_SPEED_MAX;
Water.speed = POLYCHROME_V2_SPEED_DEFAULT;
Water.color_mode = MODE_COLORS_NONE;
modes.push_back(Water);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = POLYCHROME_V2_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = POLYCHROME_V2_SPEED_MIN;
Rainbow.speed_max = POLYCHROME_V2_SPEED_MAX;
Rainbow.speed = POLYCHROME_V2_SPEED_DEFAULT;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
}
break;
}
SetupZones();
}
void RGBController_Polychrome::SetupZones()
{
switch(polychrome->GetASRockType())
{
/*---------------------------------------------------------*\
| ASR LED motherboards only have a single zone/LED |
\*---------------------------------------------------------*/
case ASROCK_TYPE_ASRLED:
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
zone* new_zone = new zone();
/*---------------------------------------------------------*\
| Set single zone name to "Motherboard" |
\*---------------------------------------------------------*/
new_zone->name = "Motherboard";
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;
/*---------------------------------------------------------*\
| Push new zone to zones vector |
\*---------------------------------------------------------*/
zones.push_back(*new_zone);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
led* new_led = new led();
/*---------------------------------------------------------*\
| Set single LED name to "Motherboard" |
\*---------------------------------------------------------*/
new_led->name = "Motherboard";
/*---------------------------------------------------------*\
| Push new LED to LEDs vector |
\*---------------------------------------------------------*/
leds.push_back(*new_led);
}
break;
/*---------------------------------------------------------*\
| Polychrome motherboards should set up zones based on LED |
| configuration register read from device |
\*---------------------------------------------------------*/
case ASROCK_TYPE_POLYCHROME_V1:
case ASROCK_TYPE_POLYCHROME_V2:
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
for(unsigned int zone_idx = 0; zone_idx < POLYCHROME_ZONE_COUNT; zone_idx++)
{
if(polychrome->zone_led_count[zone_idx] > 0)
{
zone* new_zone = new zone();
/*---------------------------------------------------------*\
| Set zone name to channel name |
\*---------------------------------------------------------*/
if(polychrome->GetASRockType() == ASROCK_TYPE_POLYCHROME_V1)
{
new_zone->name = polychrome_v1_zone_names[zone_idx];
}
else
{
new_zone->name = polychrome_v2_zone_names[zone_idx];
}
if(zone_idx == POLYCHROME_ZONE_ADDRESSABLE)
{
new_zone->leds_min = 1;
new_zone->leds_max = 1;
new_zone->leds_count = 1;
}
else
{
new_zone->leds_min = polychrome->zone_led_count[zone_idx];
new_zone->leds_max = polychrome->zone_led_count[zone_idx];
new_zone->leds_count = polychrome->zone_led_count[zone_idx];
}
if(new_zone->leds_count > 1)
{
new_zone->type = ZONE_TYPE_LINEAR;
}
else
{
new_zone->type = ZONE_TYPE_SINGLE;
}
new_zone->matrix_map = NULL;
/*---------------------------------------------------------*\
| Push new zone to zones vector |
\*---------------------------------------------------------*/
zones.push_back(*new_zone);
}
}
unsigned int led_count = 0;
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
for(unsigned int zone_idx = 0; zone_idx < POLYCHROME_ZONE_COUNT; zone_idx++)
{
if(polychrome->zone_led_count[zone_idx] > 0)
{
for(unsigned int led_idx = 0; led_idx < polychrome->zone_led_count[zone_idx]; led_idx++)
{
/*---------------------------------------------------------*\
| Each zone only has one LED |
\*---------------------------------------------------------*/
led* new_led = new led();
if(polychrome->GetASRockType() == ASROCK_TYPE_POLYCHROME_V1)
{
new_led->name = polychrome_v1_zone_names[zone_idx];
}
else
{
new_led->name = polychrome_v2_zone_names[zone_idx];
}
new_led->name.append(" " + std::to_string(led_idx + 1));
new_led->value = 0;
if(polychrome->GetASRockType() == ASROCK_TYPE_POLYCHROME_V1)
{
new_led->value = zone_idx;
}
else if(zone_idx == POLYCHROME_ZONE_ADDRESSABLE)
{
new_led->value = 0x19;
}
/*---------------------------------------------------------*\
| Push new LED to LEDs vector |
\*---------------------------------------------------------*/
leds.push_back(*new_led);
led_count++;
if(zone_idx == POLYCHROME_ZONE_ADDRESSABLE)
{
break;
}
}
}
}
}
break;
}
SetupColors();
}
void RGBController_Polychrome::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_Polychrome::DeviceUpdateLEDs()
{
for (std::size_t led = 0; led < colors.size(); led++)
{
UpdateSingleLED(led);
}
}
void RGBController_Polychrome::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_Polychrome::UpdateSingleLED(int led)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
/*---------------------------------------------------------*\
| If the LED value is non-zero, this LED overrides the LED |
| index |
\*---------------------------------------------------------*/
if(leds[led].value != 0)
{
led = leds[led].value;
}
polychrome->SetColorsAndSpeed(led, red, grn, blu);
}
void RGBController_Polychrome::SetCustomMode()
{
active_mode = 1;
}
void RGBController_Polychrome::DeviceUpdateMode()
{
if(polychrome->GetASRockType() == ASROCK_TYPE_POLYCHROME_V1)
{
for(unsigned int led_idx = 0; led_idx <= leds.size(); led_idx++)
{
polychrome->SetMode(led_idx, modes[active_mode].value, modes[active_mode].speed);
}
}
else
{
polychrome->SetMode(0, modes[active_mode].value, modes[active_mode].speed);
}
DeviceUpdateLEDs();
}

View file

@ -1,33 +0,0 @@
/*-----------------------------------------*\
| RGBController_Polychrome.h |
| |
| Generic RGB Interface for OpenRGB |
| ASRock ASR LED and Polychrome RGB Driver |
| |
| Adam Honse (CalcProgrammer1) 12/15/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "PolychromeController.h"
class RGBController_Polychrome : public RGBController
{
public:
RGBController_Polychrome(PolychromeController* polychrome_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:
PolychromeController* polychrome;
};

View file

@ -1,280 +0,0 @@
/*-----------------------------------------*\
| RGBController_PoseidonZRGB.cpp |
| |
| Generic RGB Interface for Thermaltake |
| Poseidon Z RGB Keyboard |
| |
| Adam Honse (CalcProgrammer1) 12/25/2019 |
\*-----------------------------------------*/
#include "RGBController_PoseidonZRGB.h"
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 8, 15, 22, 29, NA, 37, 44, 51, 58, NA, 65, 73, 81, 88, 94, 100, 102, NA, NA, NA, NA },
{ 1, 9, 16, 23, 30, 38, 45, 52, 59, 66, 74, NA, 82, 89, 103, NA, 7, 21, 36, 50, 64, 80, 93 },
{ 2, NA, 10, 17, 24, 31, NA, 39, 46, 53, 60, 67, 75, 83, 90, 95, 14, 28, 43, 57, 72, 87, 86 },
{ 3, NA, 11, 18, 25, 32, NA, 40, 47, 54, 61, 68, 76, 84, 96, NA, NA, NA, NA, 35, 99, 63, NA },
{ 4, NA, 26, 33, 41, 48, NA, 55, NA, 62, 69, 77, 85, 91, 101, NA, NA, 27, NA, 42, 49, 71, 98 },
{ 5, 12, 19, NA, NA, NA, NA, 34, NA, NA, NA, NA, 70, 78, 92, 97, 6, 13, 20, 56, NA, 79, NA } };
static const char* zone_names[] =
{
"Keyboard"
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
104
};
static const char* led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Key: Left Arrow",
"Key: Insert",
"Key: F1",
"Key: 1",
"Key: Q",
"Key: A",
"Key: Left Windows",
"Key: Down Arrow",
"Key: Delete",
"Key: F2",
"Key: 2",
"Key: W",
"Key: S",
"Key: Left Alt",
"Key: Right Arrow",
"Key: Home",
"Key: F3",
"Key: 3",
"Key: E",
"Key: D",
"Key: Z",
"Key: Up Arrow",
"Key: End",
"Key: F4",
"Key: 4",
"Key: R",
"Key: F",
"Key: X",
"Key: Space",
"Key: Number Pad 4",
"Key: Page Up",
"Key: F5",
"Key: 5",
"Key: T",
"Key: G",
"Key: C",
"Key: Number Pad 1",
"Key: Page Down",
"Key: F6",
"Key: 6",
"Key: Y",
"Key: H",
"Key: V",
"Key: Number Pad 2",
"Key: Num Lock",
"Key: F7",
"Key: 7",
"Key: U",
"Key: J",
"Key: B",
"Key: Number Pad 0",
"Key: Number Pad 7",
"Key: F8",
"Key: 8",
"Key: I",
"Key: K",
"Key: N",
"Key: Number Pad 6",
"Key: Number Pad /",
"Key: F9",
"Key: 9",
"Key: O",
"Key: L",
"Key: M",
"Key: Right Alt",
"Key: Number Pad 3",
"Key: Number Pad 8",
"Key: F10",
"Key: 0",
"Key: P",
"Key: ;",
"Key: ,",
"Key: Right Fn",
"Key: Number Pad .",
"Key: Number Pad *",
"Key: F11",
"Key: -",
"Key: [",
"Key: '",
"Key: .",
"Key: Number Pad +",
"Key: Number Pad 9",
"Key: F12",
"Key: =",
"Key: ]",
"Key: /",
"Key: Menu",
"Key: Number Pad -",
"Key: Print Screen",
"Key: \\ (ANSI)",
"Key: Enter",
"Key: Right Control",
"Key: Number Pad Enter",
"Key: Number Pad 5",
"Key: Scroll Lock",
"Key: Right Shift",
"Key: Pause/Break",
"Key: Backspace"
};
RGBController_PoseidonZRGB::RGBController_PoseidonZRGB(PoseidonZRGBController* poseidon_ptr)
{
poseidon = poseidon_ptr;
name = "Thermaltake Poseidon Z RGB";
type = DEVICE_TYPE_KEYBOARD;
description = "Thermaltake Poseidon Z RGB Device";
mode Direct;
Direct.name = "Direct";
Direct.value = POSEIDONZ_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = POSEIDONZ_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Wave;
Wave.name = "Wave";
Wave.value = POSEIDONZ_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
Wave.speed_min = POSEIDONZ_SPEED_SLOW;
Wave.speed_max = POSEIDONZ_SPEED_FAST;
Wave.color_mode = MODE_COLORS_NONE;
Wave.speed = POSEIDONZ_SPEED_FAST;
Wave.direction = MODE_DIRECTION_LEFT;
modes.push_back(Wave);
mode Ripple;
Ripple.name = "Ripple";
Ripple.value = POSEIDONZ_MODE_RIPPLE;
Ripple.flags = 0;
Ripple.color_mode = MODE_COLORS_NONE;
modes.push_back(Ripple);
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = POSEIDONZ_MODE_REACTIVE;
Reactive.flags = 0;
Reactive.color_mode = MODE_COLORS_NONE;
modes.push_back(Reactive);
SetupZones();
}
RGBController_PoseidonZRGB::~RGBController_PoseidonZRGB()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_PoseidonZRGB::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 = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
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_PoseidonZRGB::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_PoseidonZRGB::DeviceUpdateLEDs()
{
if(active_mode == 0)
{
poseidon->SetLEDsDirect(colors);
}
else
{
poseidon->SetLEDs(colors);
}
}
void RGBController_PoseidonZRGB::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_PoseidonZRGB::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_PoseidonZRGB::SetCustomMode()
{
active_mode = 0;
}
void RGBController_PoseidonZRGB::DeviceUpdateMode()
{
poseidon->SetMode(modes[active_mode].value, modes[active_mode].direction, modes[active_mode].speed);
}

Some files were not shown because too many files have changed in this diff Show more