Initial commit for the Corsair K60 RGB PRO to resolve #1240
+ Adding K60 and K60 Low Profile PID to CorsairPeripheralV2Devices.h + Adding device layout + Registering detector + Adding pointer layout map and changing calls to accomodate.
This commit is contained in:
parent
a1be27ad61
commit
de3d2c7e22
9 changed files with 256 additions and 49 deletions
|
|
@ -202,7 +202,7 @@ void CorsairPeripheralV2Controller::SetLEDs(uint8_t *data, uint16_t data_size)
|
|||
/*---------------------------------------------------------*\
|
||||
| Check if the data needs more than 1 packet |
|
||||
\*---------------------------------------------------------*/
|
||||
uint8_t copy_bytes = CORSAIR_V2_WRITE_SIZE - offset1;
|
||||
uint16_t copy_bytes = CORSAIR_V2_WRITE_SIZE - offset1;
|
||||
if(remaining < copy_bytes)
|
||||
{
|
||||
copy_bytes = remaining;
|
||||
|
|
@ -221,7 +221,7 @@ void CorsairPeripheralV2Controller::SetLEDs(uint8_t *data, uint16_t data_size)
|
|||
\*---------------------------------------------------------*/
|
||||
while(remaining)
|
||||
{
|
||||
uint8_t index = data_size - remaining;
|
||||
uint16_t index = data_size - remaining;
|
||||
if(remaining < copy_bytes)
|
||||
{
|
||||
memset(&buffer[offset2], 0, copy_bytes);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public:
|
|||
void UpdateHWMode(uint16_t mode, corsair_v2_color color_mode, uint8_t speed,
|
||||
uint8_t direction, uint8_t brightness, std::vector<RGBColor> colors);
|
||||
|
||||
virtual void SetLedsDirect(std::vector<RGBColor> colors) = 0;
|
||||
virtual void SetLedsDirect(std::vector<RGBColor *> colors) = 0;
|
||||
private:
|
||||
void GetAddress(uint8_t address);
|
||||
void StartTransaction(uint8_t opt1);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ void DetectCorsairV2SoftwareControllers(hid_device_info* info, const std::string
|
|||
| Keyboards |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K55 RGB PRO", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K55_RGB_PRO_PID, 1, 0xFF42);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K60 RGB PRO", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K60_RGB_PRO_PID, 1, 0xFF42);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K60 RGB PRO Low Profile", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K60_RGB_PRO_LP_PID, 1, 0xFF42);
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Mousemat |
|
||||
|
|
|
|||
|
|
@ -1,5 +1,127 @@
|
|||
#include "CorsairPeripheralV2Devices.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| KEYMAPS |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
#define K60_KEYMAP_SIZE (sizeof(K60_keymap) / sizeof(K60_keymap[0]))
|
||||
|
||||
static const corsair_v2_led K60_keymap[] =
|
||||
{
|
||||
/*---------------------------------------------------------------------*\
|
||||
| Zone, Row, Column, Index, Name |
|
||||
\*---------------------------------------------------------------------*/
|
||||
{ 0, 0, 0, 41, KEY_EN_ESCAPE },
|
||||
{ 0, 0, 2, 58, KEY_EN_F1 },
|
||||
{ 0, 0, 3, 59, KEY_EN_F2 },
|
||||
{ 0, 0, 4, 60, KEY_EN_F3 },
|
||||
{ 0, 0, 5, 61, KEY_EN_F4 },
|
||||
{ 0, 0, 6, 62, KEY_EN_F5 },
|
||||
{ 0, 0, 7, 63, KEY_EN_F6 },
|
||||
{ 0, 0, 8, 64, KEY_EN_F7 },
|
||||
{ 0, 0, 9, 65, KEY_EN_F8 },
|
||||
{ 0, 0, 10, 66, KEY_EN_F9 },
|
||||
{ 0, 0, 11, 67, KEY_EN_F10 },
|
||||
{ 0, 0, 12, 68, KEY_EN_F11 },
|
||||
{ 0, 0, 13, 69, KEY_EN_F12 },
|
||||
{ 0, 0, 14, 70, KEY_EN_PRINT_SCREEN },
|
||||
{ 0, 0, 15, 71, KEY_EN_SCROLL_LOCK },
|
||||
{ 0, 0, 16, 72, KEY_EN_PAUSE_BREAK },
|
||||
{ 0, 1, 0, 53, KEY_EN_BACK_TICK },
|
||||
{ 0, 1, 1, 30, KEY_EN_1 },
|
||||
{ 0, 1, 2, 31, KEY_EN_2 },
|
||||
{ 0, 1, 3, 32, KEY_EN_3 },
|
||||
{ 0, 1, 4, 33, KEY_EN_4 },
|
||||
{ 0, 1, 5, 34, KEY_EN_5 },
|
||||
{ 0, 1, 6, 35, KEY_EN_6 },
|
||||
{ 0, 1, 7, 36, KEY_EN_7 },
|
||||
{ 0, 1, 8, 37, KEY_EN_8 },
|
||||
{ 0, 1, 9, 38, KEY_EN_9 },
|
||||
{ 0, 1, 10, 39, KEY_EN_0 },
|
||||
{ 0, 1, 11, 45, KEY_EN_MINUS },
|
||||
{ 0, 1, 12, 46, KEY_EN_EQUALS },
|
||||
{ 0, 1, 13, 42, KEY_EN_BACKSPACE },
|
||||
{ 0, 1, 14, 73, KEY_EN_INSERT },
|
||||
{ 0, 1, 15, 74, KEY_EN_HOME },
|
||||
{ 0, 1, 16, 75, KEY_EN_PAGE_UP },
|
||||
{ 0, 1, 17, 83, KEY_EN_NUMPAD_LOCK },
|
||||
{ 0, 1, 18, 84, KEY_EN_NUMPAD_DIVIDE },
|
||||
{ 0, 1, 19, 85, KEY_EN_NUMPAD_TIMES },
|
||||
{ 0, 1, 20, 86, KEY_EN_NUMPAD_MINUS },
|
||||
{ 0, 2, 0, 43, KEY_EN_TAB },
|
||||
{ 0, 2, 1, 20, KEY_EN_Q },
|
||||
{ 0, 2, 2, 26, KEY_EN_W },
|
||||
{ 0, 2, 3, 8, KEY_EN_E },
|
||||
{ 0, 2, 4, 21, KEY_EN_R },
|
||||
{ 0, 2, 5, 23, KEY_EN_T },
|
||||
{ 0, 2, 6, 28, KEY_EN_Y },
|
||||
{ 0, 2, 7, 24, KEY_EN_U },
|
||||
{ 0, 2, 8, 12, KEY_EN_I },
|
||||
{ 0, 2, 9, 18, KEY_EN_O },
|
||||
{ 0, 2, 10, 19, KEY_EN_P },
|
||||
{ 0, 2, 11, 47, KEY_EN_LEFT_BRACKET },
|
||||
{ 0, 2, 12, 48, KEY_EN_RIGHT_BRACKET },
|
||||
{ 0, 2, 13, 49, KEY_EN_ANSI_BACK_SLASH },
|
||||
{ 0, 2, 14, 76, KEY_EN_DELETE },
|
||||
{ 0, 2, 15, 77, KEY_EN_END },
|
||||
{ 0, 2, 16, 78, KEY_EN_PAGE_DOWN },
|
||||
{ 0, 2, 17, 95, KEY_EN_NUMPAD_7 },
|
||||
{ 0, 2, 18, 96, KEY_EN_NUMPAD_8 },
|
||||
{ 0, 2, 19, 97, KEY_EN_NUMPAD_9 },
|
||||
{ 0, 2, 20, 87, KEY_EN_NUMPAD_PLUS },
|
||||
{ 0, 3, 0, 57, KEY_EN_CAPS_LOCK },
|
||||
{ 0, 3, 1, 4, KEY_EN_A },
|
||||
{ 0, 3, 2, 22, KEY_EN_S },
|
||||
{ 0, 3, 3, 7, KEY_EN_D },
|
||||
{ 0, 3, 4, 9, KEY_EN_F },
|
||||
{ 0, 3, 5, 10, KEY_EN_G },
|
||||
{ 0, 3, 6, 11, KEY_EN_H },
|
||||
{ 0, 3, 7, 13, KEY_EN_J },
|
||||
{ 0, 3, 8, 14, KEY_EN_K },
|
||||
{ 0, 3, 9, 15, KEY_EN_L },
|
||||
{ 0, 3, 10, 51, KEY_EN_SEMICOLON },
|
||||
{ 0, 3, 11, 52, KEY_EN_QUOTE },
|
||||
{ 0, 3, 12, 50, KEY_EN_POUND },
|
||||
{ 0, 3, 13, 40, KEY_EN_ANSI_ENTER },
|
||||
{ 0, 3, 17, 92, KEY_EN_NUMPAD_4 },
|
||||
{ 0, 3, 18, 93, KEY_EN_NUMPAD_5 },
|
||||
{ 0, 3, 19, 94, KEY_EN_NUMPAD_6 },
|
||||
{ 0, 4, 0, 106, KEY_EN_LEFT_SHIFT },
|
||||
{ 0, 4, 1, 100, KEY_EN_ISO_BACK_SLASH },
|
||||
{ 0, 4, 2, 29, KEY_EN_Z },
|
||||
{ 0, 4, 3, 27, KEY_EN_X },
|
||||
{ 0, 4, 4, 6, KEY_EN_C },
|
||||
{ 0, 4, 5, 25, KEY_EN_V },
|
||||
{ 0, 4, 6, 5, KEY_EN_B },
|
||||
{ 0, 4, 7, 17, KEY_EN_N },
|
||||
{ 0, 4, 8, 16, KEY_EN_M },
|
||||
{ 0, 4, 9, 54, KEY_EN_COMMA },
|
||||
{ 0, 4, 10, 55, KEY_EN_PERIOD },
|
||||
{ 0, 4, 11, 56, KEY_EN_FORWARD_SLASH },
|
||||
{ 0, 4, 13, 110, KEY_EN_RIGHT_SHIFT },
|
||||
{ 0, 4, 15, 82, KEY_EN_UP_ARROW },
|
||||
{ 0, 4, 17, 89, KEY_EN_NUMPAD_1 },
|
||||
{ 0, 4, 18, 90, KEY_EN_NUMPAD_2 },
|
||||
{ 0, 4, 19, 91, KEY_EN_NUMPAD_3 },
|
||||
{ 0, 4, 20, 88, KEY_EN_NUMPAD_ENTER },
|
||||
{ 0, 5, 0, 105, KEY_EN_LEFT_CONTROL },
|
||||
{ 0, 5, 1, 108, KEY_EN_LEFT_WINDOWS },
|
||||
{ 0, 5, 2, 107, KEY_EN_LEFT_ALT },
|
||||
{ 0, 5, 6, 44, KEY_EN_SPACE },
|
||||
{ 0, 5, 10, 111, KEY_EN_RIGHT_ALT },
|
||||
{ 0, 5, 11, 122, KEY_EN_RIGHT_FUNCTION },
|
||||
{ 0, 5, 12, 101, KEY_EN_MENU },
|
||||
{ 0, 5, 13, 109, KEY_EN_RIGHT_CONTROL },
|
||||
{ 0, 5, 14, 80, KEY_EN_LEFT_ARROW },
|
||||
{ 0, 5, 15, 81, KEY_EN_DOWN_ARROW },
|
||||
{ 0, 5, 16, 79, KEY_EN_RIGHT_ARROW },
|
||||
{ 0, 5, 18, 98, KEY_EN_NUMPAD_0 },
|
||||
{ 0, 5, 19, 99, KEY_EN_NUMPAD_PERIOD },
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| CORSAIR DEVICES |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Corsair K55 RGB Pro 1B1C:1BA4 |
|
||||
| |
|
||||
|
|
@ -28,12 +150,83 @@ static const corsair_v2_device k55_rgb_pro_device =
|
|||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
},
|
||||
nullptr,
|
||||
0
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Corsair K60 RGB Pro 1B1C:1BA0 |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Matrix |
|
||||
| 6 Rows, 21 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const corsair_v2_zone k60_rgb_pro_zone =
|
||||
{
|
||||
ZONE_EN_KEYBOARD,
|
||||
ZONE_TYPE_MATRIX,
|
||||
6,
|
||||
21
|
||||
};
|
||||
|
||||
static const corsair_v2_device k60_rgb_pro_device =
|
||||
{
|
||||
CORSAIR_K60_RGB_PRO_PID,
|
||||
false,
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
CORSAIR_V2_MODE_SW,
|
||||
6,
|
||||
21,
|
||||
{
|
||||
&k60_rgb_pro_zone,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
},
|
||||
K60_keymap,
|
||||
K60_KEYMAP_SIZE
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Corsair K60 RGB Pro Low Profile 1B1C:1BAD |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Matrix |
|
||||
| 6 Rows, 21 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const corsair_v2_zone k60_rgb_pro_lp_zone =
|
||||
{
|
||||
ZONE_EN_KEYBOARD,
|
||||
ZONE_TYPE_MATRIX,
|
||||
6,
|
||||
21
|
||||
};
|
||||
|
||||
static const corsair_v2_device k60_rgb_pro_lp_device =
|
||||
{
|
||||
CORSAIR_K60_RGB_PRO_LP_PID,
|
||||
false,
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
CORSAIR_V2_MODE_SW,
|
||||
6,
|
||||
21,
|
||||
{
|
||||
&k60_rgb_pro_lp_zone,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
},
|
||||
K60_keymap,
|
||||
K60_KEYMAP_SIZE
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Corsair MM700 1B1C:1B9B |
|
||||
| |
|
||||
|
|
@ -81,6 +274,7 @@ static const corsair_v2_device mm700_device =
|
|||
&mm700_right_zone,
|
||||
&mm700_logo_zone,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
},
|
||||
nullptr,
|
||||
|
|
@ -96,6 +290,8 @@ const corsair_v2_device* corsair_v2_device_list_data[] =
|
|||
| KEYBOARDS |
|
||||
\*-----------------------------------------------------------------*/
|
||||
&k55_rgb_pro_device,
|
||||
&k60_rgb_pro_device,
|
||||
&k60_rgb_pro_lp_device,
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| MOUSEMATS |
|
||||
|
|
@ -104,4 +300,4 @@ const corsair_v2_device* corsair_v2_device_list_data[] =
|
|||
};
|
||||
|
||||
const unsigned int CORSAIR_V2_DEVICE_COUNT = (sizeof(corsair_v2_device_list_data) / sizeof(corsair_v2_device_list_data[ 0 ]));
|
||||
const corsair_v2_device** corsair_v2_device_list = corsair_v2_device_list_data;
|
||||
const corsair_v2_device** corsair_v2_device_list = corsair_v2_device_list_data;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "RGBController.h"
|
||||
#include "RGBControllerKeyNames.h"
|
||||
|
||||
#define CORSAIR_ZONES_MAX 5
|
||||
#define CORSAIR_ZONES_MAX 6
|
||||
|
||||
enum corsair_v2_device_mode
|
||||
{
|
||||
|
|
@ -25,6 +25,7 @@ typedef struct
|
|||
uint8_t zone;
|
||||
uint8_t row;
|
||||
uint8_t col;
|
||||
uint8_t index;
|
||||
const char* name;
|
||||
} corsair_v2_led;
|
||||
|
||||
|
|
@ -45,6 +46,8 @@ typedef struct
|
|||
| Corsair V2 Protocol Keyboards |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_K55_RGB_PRO_PID 0x1BA4
|
||||
#define CORSAIR_K60_RGB_PRO_PID 0x1BA0
|
||||
#define CORSAIR_K60_RGB_PRO_LP_PID 0x1BAD
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Corsair V2 Protocol Mousemats |
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ CorsairPeripheralV2SWController::~CorsairPeripheralV2SWController()
|
|||
|
||||
}
|
||||
|
||||
void CorsairPeripheralV2SWController::SetLedsDirect(std::vector<RGBColor>colors)
|
||||
void CorsairPeripheralV2SWController::SetLedsDirect(std::vector<RGBColor *>colors)
|
||||
{
|
||||
uint16_t count = colors.size();
|
||||
uint16_t green = count;
|
||||
|
|
@ -33,7 +33,7 @@ void CorsairPeripheralV2SWController::SetLedsDirect(std::vector<RGBColor>colors)
|
|||
|
||||
for(std::size_t i = 0; i < count; i++)
|
||||
{
|
||||
RGBColor color = colors[i];
|
||||
RGBColor color = *colors[i];
|
||||
|
||||
buffer[i] = RGBGetRValue(color);
|
||||
buffer[green + i] = RGBGetGValue(color);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public:
|
|||
CorsairPeripheralV2SWController(hid_device* dev_handle, const char* path, std::string name, uint16_t pid);
|
||||
~CorsairPeripheralV2SWController();
|
||||
|
||||
void SetLedsDirect(std::vector<RGBColor> colors);
|
||||
void SetLedsDirect(std::vector<RGBColor *> colors);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ RGBController_CorsairV2SW::~RGBController_CorsairV2SW()
|
|||
|
||||
void RGBController_CorsairV2SW::SetupZones()
|
||||
{
|
||||
unsigned int max_led_value = 0;
|
||||
const corsair_v2_device* corsair = controller->GetDeviceData();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -114,10 +115,10 @@ void RGBController_CorsairV2SW::SetupZones()
|
|||
|
||||
new_zone.name = corsair->zones[i]->name;
|
||||
new_zone.type = corsair->zones[i]->type;
|
||||
new_zone.leds_count = corsair->zones[i]->rows * corsair->zones[i]->cols;
|
||||
|
||||
if(new_zone.type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
new_zone.leds_count = corsair->layout_size;
|
||||
matrix_map_type * new_map = new matrix_map_type;
|
||||
new_zone.matrix_map = new_map;
|
||||
|
||||
|
|
@ -126,58 +127,44 @@ void RGBController_CorsairV2SW::SetupZones()
|
|||
|
||||
new_map->map = new unsigned int[new_map->height * new_map->width];
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create an empty matrix |
|
||||
\*---------------------------------------------------------*/
|
||||
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;
|
||||
new_map->map[(y * new_map->width) + x] = NA;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create LEDs for the Matrix zone |
|
||||
| Place keys in the layout to populate the matrix |
|
||||
\*---------------------------------------------------------*/
|
||||
uint8_t blanks = 0;
|
||||
for(size_t led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
bool not_found = true;
|
||||
led new_led;
|
||||
|
||||
for(size_t layout_index = 0; layout_index < corsair->layout_size; layout_index++)
|
||||
{
|
||||
uint8_t row = layout_index / new_map->width;
|
||||
uint8_t col = layout_index % new_map->width;
|
||||
new_led.name = corsair->layout[led_idx].name;
|
||||
new_led.value = corsair->layout[led_idx].index;
|
||||
max_led_value = std::max(max_led_value, new_led.value);
|
||||
leds.push_back(new_led);
|
||||
|
||||
if( i == corsair->layout[layout_index].zone &&
|
||||
row == corsair->layout[layout_index].row &&
|
||||
col == corsair->layout[layout_index].col )
|
||||
{
|
||||
new_led.name = corsair->layout[layout_index].name;
|
||||
not_found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| If this is the "Keyboard" zone and key was not found in the map |
|
||||
| then change the value of the key to hide it from view |
|
||||
\*-----------------------------------------------------------------*/
|
||||
if(not_found && new_zone.name == ZONE_EN_KEYBOARD)
|
||||
{
|
||||
new_zone.matrix_map->map[led_idx] = NA;
|
||||
blanks++;
|
||||
}
|
||||
else
|
||||
{
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
uint8_t layout_index = (corsair->layout[led_idx].row * new_map->width)
|
||||
+ corsair->layout[led_idx].col;
|
||||
new_map->map[layout_index] = led_idx;
|
||||
}
|
||||
|
||||
new_zone.leds_count -= blanks;
|
||||
/*---------------------------------------------------------*\
|
||||
| Add 1 the max_led_value to account for the 0th index |
|
||||
\*---------------------------------------------------------*/
|
||||
max_led_value++;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.matrix_map = NULL;
|
||||
new_zone.leds_count = corsair->zones[i]->rows * corsair->zones[i]->cols;
|
||||
new_zone.matrix_map = NULL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create LEDs for the Linear / Single zone |
|
||||
|
|
@ -186,24 +173,40 @@ void RGBController_CorsairV2SW::SetupZones()
|
|||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = new_zone.name + " ";
|
||||
new_led.name = new_zone.name + " ";
|
||||
new_led.name.append(std::to_string( led_idx ));
|
||||
new_led.value = leds.size();
|
||||
new_led.value = leds.size();
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
max_led_value = std::max(max_led_value, (unsigned int)leds.size());
|
||||
}
|
||||
|
||||
LOG_DEBUG("[%s] Creating a %s zone: %s with %d LEDs", name.c_str(),
|
||||
((new_zone.type == ZONE_TYPE_MATRIX) ? "matrix": "linear"),
|
||||
new_zone.name.c_str(), new_zone.leds_count);
|
||||
new_zone.leds_min = new_zone.leds_count;
|
||||
new_zone.leds_max = new_zone.leds_count;
|
||||
new_zone.leds_min = new_zone.leds_count;
|
||||
new_zone.leds_max = new_zone.leds_count;
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a buffer map of pointers which contains the |
|
||||
| layout order of colors the device expects. |
|
||||
\*---------------------------------------------------------*/
|
||||
for(size_t led_idx = 0; led_idx < max_led_value; led_idx++)
|
||||
{
|
||||
buffer_map.push_back(&null_color);
|
||||
}
|
||||
|
||||
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
buffer_map[leds[led_idx].value] = &colors[led_idx];
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CorsairV2SW::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
|
|
@ -217,17 +220,17 @@ void RGBController_CorsairV2SW::DeviceUpdateLEDs()
|
|||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
controller->SetLedsDirect(colors);
|
||||
controller->SetLedsDirect(buffer_map);
|
||||
}
|
||||
|
||||
void RGBController_CorsairV2SW::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
controller->SetLedsDirect(colors);
|
||||
controller->SetLedsDirect(buffer_map);
|
||||
}
|
||||
|
||||
void RGBController_CorsairV2SW::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
controller->SetLedsDirect(colors);
|
||||
controller->SetLedsDirect(buffer_map);
|
||||
}
|
||||
|
||||
void RGBController_CorsairV2SW::DeviceUpdateMode()
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ public:
|
|||
private:
|
||||
CorsairPeripheralV2Controller* controller;
|
||||
|
||||
RGBColor null_color = 0;
|
||||
std::vector<RGBColor *> buffer_map;
|
||||
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue