mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-31 11:17:52 -05:00
Add ASUS ROG Strix Scope, Scope RX, and Scope TKL keyboards
Commits merged and amended for code style by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
@@ -65,6 +65,9 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18cf", TAG+="uacces
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18e5", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18e3", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1958", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18f8", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1951", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="190c", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18a0", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
|
||||
@@ -26,17 +26,42 @@
|
||||
#define AURA_MOTHERBOARD_3_PID 0x19AF
|
||||
#define AURA_ROG_GLADIUS_II_CORE_PID 0x18DD
|
||||
#define AURA_ROG_GLADIUS_II_PID 0x1845
|
||||
#define AURA_ROG_STRIX_FLARE_PID 0x1875
|
||||
#define AURA_ROG_GLADIUS_II_ORIGIN_PID 0x1877
|
||||
#define AURA_ROG_GLADIUS_II_ORIGIN_PNK_LTD_PID 0x18CD
|
||||
#define AURA_ROG_GLADIUS_II_WIRELESS_PID 0x18A0
|
||||
#define AURA_ROG_STRIX_FLARE_PID 0x1875
|
||||
#define AURA_ROG_STRIX_FLARE_PNK_LTD_PID 0x18CF
|
||||
#define AURA_ROG_STRIX_SCOPE_PID 0x18F8
|
||||
#define AURA_ROG_STRIX_SCOPE_RX_PID 0x1951
|
||||
#define AURA_ROG_STRIX_SCOPE_TKL_PID 0x190C
|
||||
#define AURA_ROG_CHAKRAM_WIRELESS_PID 0x18E5
|
||||
#define AURA_ROG_CHAKRAM_WIRED_1_PID 0x18E3
|
||||
#define AURA_ROG_CHAKRAM_WIRED_2_PID 0x1958
|
||||
#define AURA_ROG_THRONE_QI_PID 0x18C5
|
||||
#define AURA_TUF_K7_GAMING_PID 0x18AA
|
||||
|
||||
AuraKeyboardMappingLayoutType GetKeyboardMappingLayoutType(int pid)
|
||||
{
|
||||
switch(pid)
|
||||
{
|
||||
case AURA_ROG_STRIX_FLARE_PID:
|
||||
case AURA_ROG_STRIX_FLARE_PNK_LTD_PID:
|
||||
return FLARE_LAYOUT;
|
||||
|
||||
case AURA_ROG_STRIX_SCOPE_PID:
|
||||
return SCOPE_LAYOUT;
|
||||
|
||||
case AURA_ROG_STRIX_SCOPE_RX_PID:
|
||||
return SCOPE_RX_LAYOUT;
|
||||
|
||||
case AURA_ROG_STRIX_SCOPE_TKL_PID:
|
||||
return SCOPE_TKL_LAYOUT;
|
||||
|
||||
default:
|
||||
return FLARE_LAYOUT;
|
||||
}
|
||||
}
|
||||
|
||||
void DetectAsusAuraUSBTerminal(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
@@ -89,8 +114,9 @@ void DetectAsusAuraUSBKeyboards(hid_device_info* info, const std::string& name)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
AuraKeyboardController* controller = new AuraKeyboardController(dev, info->path);
|
||||
RGBController_AuraKeyboard* rgb_controller = new RGBController_AuraKeyboard(controller);
|
||||
AuraKeyboardController* controller = new AuraKeyboardController(dev, info->path);
|
||||
AuraKeyboardMappingLayoutType layout = GetKeyboardMappingLayoutType(info->product_id);
|
||||
RGBController_AuraKeyboard* rgb_controller = new RGBController_AuraKeyboard(controller, layout);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
@@ -150,5 +176,8 @@ REGISTER_HID_DETECTOR_IP("Asus ROG Chakram (Wired)", DetectAsusAuraUS
|
||||
REGISTER_HID_DETECTOR_IP("Asus ROG Chakram (Wired)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_CHAKRAM_WIRED_2_PID, 0, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Flare", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_FLARE_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Flare PNK LTD", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_FLARE_PNK_LTD_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_PID, 0);
|
||||
REGISTER_HID_DETECTOR_I ("ASUS TUF Gaming K7", DetectAsusAuraTUFUSBKeyboard, AURA_USB_VID, AURA_TUF_K7_GAMING_PID, 1);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Scope", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_SCOPE_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Scope RX", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_SCOPE_RX_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Scope TKL", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_SCOPE_TKL_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_PID, 0);
|
||||
REGISTER_HID_DETECTOR_I ("ASUS TUF Gaming K7", DetectAsusAuraTUFUSBKeyboard, AURA_USB_VID, AURA_TUF_K7_GAMING_PID, 1);
|
||||
|
||||
@@ -12,42 +12,31 @@
|
||||
//0xFFFFFFFF indicates an unused entry in matrix
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
static unsigned int matrix_map[6][22] =
|
||||
static unsigned int flare_matrix_map[6][22] =
|
||||
{ { 0, NA, 13, 18, 23, 28, 38, 43, 49, 54, 60, 65, 69, 70, NA, 76, 80, 85, NA, NA, NA, NA },
|
||||
{ 1, 8, 14, 19, 24, 29, 34, 39, 44, 50, 55, 61, 66, 71, NA, 77, 81, 86, 89, 94, 98, 103 },
|
||||
{ 2, NA, 9, 15, 20, 25, 30, 35, 40, 45, 51, 56, 62, 67, 72, 78, 82, 87, 90, 95, 99, 104 },
|
||||
{ 3, NA, 10, 16, 21, 26, 31, 36, 41, 46, 52, 57, 63, 68, 73, NA, NA, NA, 91, 96, 100, NA },
|
||||
{ 4, 6, 11, 17, 22, 27, 32, 37, 42, 47, 53, 58, NA, NA, 74, NA, 83, NA, 92, 97, 101, 105 },
|
||||
{ 4, 6, 11, 17, 22, 27, 32, 37, 42, 47, 53, 58, 74, NA, NA, NA, 83, NA, 92, 97, 101, 105 },
|
||||
{ 5, 7, 12, NA, NA, NA, NA, 33, NA, 48, NA, 59, 64, 75, NA, 79, 84, 88, 93, NA, 102, NA } };
|
||||
|
||||
static const char* zone_names[] =
|
||||
{
|
||||
"Keyboard",
|
||||
"Logo",
|
||||
"Underglow"
|
||||
};
|
||||
static unsigned int scope_matrix_map[6][22] =
|
||||
{ { 0, NA, 13, 18, 23, 28, 38, 43, 49, 54, 60, 65, 69, 70, NA, 76, 80, 85, NA, NA, NA, NA },
|
||||
{ 1, 8, 14, 19, 24, 29, 34, 39, 44, 50, 55, 61, 66, 71, NA, 77, 81, 86, 89, 94, 98, 103 },
|
||||
{ 2, NA, 9, 15, 20, 25, 30, 35, 40, 45, 51, 56, 62, 67, 72, 78, 82, 87, 90, 95, 99, 104 },
|
||||
{ 3, NA, 10, 16, 21, 26, 31, 36, 41, 46, 52, 57, 63, 68, 73, NA, NA, NA, 91, 96, 100, NA },
|
||||
{ 4, 6, 11, 17, 22, 27, 32, 37, 42, 47, 53, 58, 74, NA, NA, NA, 83, NA, 92, 97, 101, 105 },
|
||||
{ 5, NA, 7, 12, NA, NA, NA, 33, NA, 48, NA, 59, 64, 75, NA, 79, 84, 88, 93, NA, 102, NA } };
|
||||
|
||||
static zone_type zone_types[] =
|
||||
{
|
||||
ZONE_TYPE_MATRIX,
|
||||
ZONE_TYPE_SINGLE,
|
||||
ZONE_TYPE_SINGLE
|
||||
};
|
||||
static unsigned int scope_tkl_matrix_map[6][18] =
|
||||
{ { 0, NA, 13, 18, 23, 28, 38, 43, 49, 54, 60, 65, 69, 70, NA, NA, NA, NA },
|
||||
{ 1, 8, 14, 19, 24, 29, 34, 39, 44, 50, 55, 61, 66, 71, NA, 76, 79, 83 },
|
||||
{ 2, NA, 9, 15, 20, 25, 30, 35, 40, 45, 51, 56, 62, 67, 72, 77, 80, 84 },
|
||||
{ 3, NA, 10, 16, 21, 26, 31, 36, 41, 46, 52, 57, 63, 68, 73, NA, NA, NA },
|
||||
{ 4, 6, 11, 17, 22, 27, 32, 37, 42, 47, 53, 58, 74, NA, NA, NA, 81, NA },
|
||||
{ 5, NA, 7, 12, NA, NA, NA, 33, NA, 48, NA, 59, 64, 75, NA, 78, 82, 85 } };
|
||||
|
||||
static const unsigned int zone_sizes[] =
|
||||
{
|
||||
106,
|
||||
1,
|
||||
2,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char * name;
|
||||
const unsigned char idx;
|
||||
} led_type;
|
||||
|
||||
static const led_type led_names[] =
|
||||
static const std::vector<led_type> default_led_names =
|
||||
{
|
||||
/* Key Label Index */
|
||||
{ "Key: Escape", 0x00 },
|
||||
@@ -57,12 +46,10 @@ static const led_type led_names[] =
|
||||
{ "Key: Left Shift", 0x04 },
|
||||
{ "Key: Left Control", 0x05 },
|
||||
{ "Key: \\ (ISO)", 0x0C },
|
||||
{ "Key: Left Windows", 0x0D },
|
||||
{ "Key: 1", 0x11 },
|
||||
{ "Key: Q", 0x12 },
|
||||
{ "Key: A", 0x13 },
|
||||
{ "Key: Z", 0x14 },
|
||||
{ "Key: Left Alt", 0x15 },
|
||||
{ "Key: F1", 0x18 },
|
||||
{ "Key: 2", 0x19 },
|
||||
{ "Key: W", 0x1A },
|
||||
@@ -156,14 +143,129 @@ static const led_type led_names[] =
|
||||
{ "Key: Number Pad -", 0xB1 },
|
||||
{ "Key: Number Pad +", 0xB2 },
|
||||
{ "Key: Number Pad Enter", 0xB4 },
|
||||
{ "Logo", 0xB8 },
|
||||
{ "Left Underglow", 0xB9 },
|
||||
{ "Right Underglow", 0xBA },
|
||||
};
|
||||
|
||||
RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* aura_ptr)
|
||||
static const std::vector<led_type> default_tkl_led_names =
|
||||
{
|
||||
aura = aura_ptr;
|
||||
/* Key Label Index */
|
||||
{ "Key: Escape", 0x00 },
|
||||
{ "Key: `", 0x01 },
|
||||
{ "Key: Tab", 0x02 },
|
||||
{ "Key: Caps Lock", 0x03 },
|
||||
{ "Key: Left Shift", 0x04 },
|
||||
{ "Key: Left Control", 0x05 },
|
||||
{ "Key: \\ (ISO)", 0x0C },
|
||||
{ "Key: 1", 0x11 },
|
||||
{ "Key: Q", 0x12 },
|
||||
{ "Key: A", 0x13 },
|
||||
{ "Key: Z", 0x14 },
|
||||
{ "Key: F1", 0x18 },
|
||||
{ "Key: 2", 0x19 },
|
||||
{ "Key: W", 0x1A },
|
||||
{ "Key: S", 0x1B },
|
||||
{ "Key: X", 0x1C },
|
||||
{ "Key: F2", 0x20 },
|
||||
{ "Key: 3", 0x21 },
|
||||
{ "Key: E", 0x22 },
|
||||
{ "Key: D", 0x23 },
|
||||
{ "Key: C", 0x24 },
|
||||
{ "Key: F3", 0x28 },
|
||||
{ "Key: 4", 0x29 },
|
||||
{ "Key: R", 0x2A },
|
||||
{ "Key: F", 0x2B },
|
||||
{ "Key: V", 0x2C },
|
||||
{ "Key: F4", 0x30 },
|
||||
{ "Key: 5", 0x31 },
|
||||
{ "Key: T", 0x32 },
|
||||
{ "Key: G", 0x33 },
|
||||
{ "Key: B", 0x34 },
|
||||
{ "Key: Space", 0x35 },
|
||||
{ "Key: 6", 0x39 },
|
||||
{ "Key: Y", 0x3A },
|
||||
{ "Key: H", 0x3B },
|
||||
{ "Key: N", 0x3C },
|
||||
{ "Key: F5", 0x40 },
|
||||
{ "Key: 7", 0x41 },
|
||||
{ "Key: U", 0x42 },
|
||||
{ "Key: J", 0x43 },
|
||||
{ "Key: M", 0x44 },
|
||||
{ "Key: F6", 0x48 },
|
||||
{ "Key: 8", 0x49 },
|
||||
{ "Key: I", 0x4A },
|
||||
{ "Key: K", 0x4B },
|
||||
{ "Key: ,", 0x4C },
|
||||
{ "Key: Right Alt", 0x4D },
|
||||
{ "Key: F7", 0x50 },
|
||||
{ "Key: 9", 0x51 },
|
||||
{ "Key: O", 0x52 },
|
||||
{ "Key: L", 0x53 },
|
||||
{ "Key: .", 0x54 },
|
||||
{ "Key: F8", 0x58 },
|
||||
{ "Key: 0", 0x59 },
|
||||
{ "Key: P", 0x5A },
|
||||
{ "Key: ;", 0x5B },
|
||||
{ "Key: /", 0x5C },
|
||||
{ "Key: Right Fn", 0x5D },
|
||||
{ "Key: F9", 0x60 },
|
||||
{ "Key: -", 0x61 },
|
||||
{ "Key: [", 0x62 },
|
||||
{ "Key: '", 0x63 },
|
||||
{ "Key: Menu", 0x65 },
|
||||
{ "Key: F10", 0x68 },
|
||||
{ "Key: =", 0x69 },
|
||||
{ "Key: ]", 0x6A },
|
||||
{ "Key: #", 0x6B },
|
||||
{ "Key: F11", 0x70 },
|
||||
{ "Key: F12", 0x78 },
|
||||
{ "Key: Backspace", 0x79 },
|
||||
{ "Key: \\ (ANSI)", 0x7A },
|
||||
{ "Key: Enter", 0x7B },
|
||||
{ "Key: Right Shift", 0x7C },
|
||||
{ "Key: Right Control", 0x7D },
|
||||
{ "Key: Insert", 0x81 },
|
||||
{ "Key: Delete", 0x82 },
|
||||
{ "Key: Left Arrow", 0x85 },
|
||||
{ "Key: Home", 0x89 },
|
||||
{ "Key: End", 0x8A },
|
||||
{ "Key: Up Arrow", 0x8C },
|
||||
{ "Key: Down Arrow", 0x8D },
|
||||
{ "Key: Page Up", 0x91 },
|
||||
{ "Key: Page Down", 0x92 },
|
||||
{ "Key: Right Arrow", 0x95 },
|
||||
{ "Logo 1", 0x80 },
|
||||
{ "Logo 2", 0x90 },
|
||||
{ "Underglow 1", 0x06 },
|
||||
{ "Underglow 2", 0x0E },
|
||||
{ "Underglow 3", 0x16 },
|
||||
{ "Underglow 4", 0x1E },
|
||||
{ "Underglow 5", 0x26 },
|
||||
{ "Underglow 6", 0x2E },
|
||||
{ "Underglow 7", 0x36 },
|
||||
{ "Underglow 8", 0x3E },
|
||||
{ "Underglow 9", 0x46 },
|
||||
{ "Underglow 10", 0x4E },
|
||||
{ "Underglow 11", 0x56 },
|
||||
{ "Underglow 12", 0x5E },
|
||||
{ "Underglow 13", 0x66 },
|
||||
{ "Underglow 14", 0x6E },
|
||||
{ "Underglow 15", 0x76 },
|
||||
{ "Underglow 16", 0x7E },
|
||||
{ "Underglow 17", 0x86 },
|
||||
{ "Underglow 18", 0x8E },
|
||||
{ "Underglow 19", 0x96 },
|
||||
{ "Underglow 20", 0x9E },
|
||||
{ "Underglow 21", 0xA6 },
|
||||
{ "Underglow 22", 0xAE },
|
||||
{ "Underglow 23", 0xB6 },
|
||||
{ "Underglow 24", 0xBE },
|
||||
{ "Underglow 25", 0xC6 },
|
||||
{ "Underglow 26", 0xCE },
|
||||
|
||||
};
|
||||
RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* aura_ptr, AuraKeyboardMappingLayoutType keyboard_layout)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
layout = keyboard_layout;
|
||||
|
||||
name = "ASUS Aura Keyboard";
|
||||
vendor = "ASUS";
|
||||
@@ -184,6 +286,13 @@ RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* a
|
||||
|
||||
RGBController_AuraKeyboard::~RGBController_AuraKeyboard()
|
||||
{
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
if(zones[zone_idx].type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
delete zones[zone_idx].matrix_map;
|
||||
}
|
||||
}
|
||||
delete aura;
|
||||
}
|
||||
|
||||
@@ -192,22 +301,71 @@ void RGBController_AuraKeyboard::SetupZones()
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
std::vector<led_zone> led_zones;
|
||||
std::vector<led_type> led_names;
|
||||
|
||||
switch(layout)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| On the ROG Scope keyboards Ctrl key is double sized, |
|
||||
| so there is a layout shift |
|
||||
\*-----------------------------------------------------*/
|
||||
case SCOPE_LAYOUT:
|
||||
led_names = default_led_names;
|
||||
led_zones.push_back({"Keyboard", ZONE_TYPE_MATRIX, 106, new matrix_map_type{6, 22, (unsigned int *)&scope_matrix_map}});
|
||||
|
||||
led_names.insert(led_names.begin() + 7, {"Key: Left Windows", 0x15});
|
||||
led_names.insert(led_names.begin() + 12, {"Key: Left Alt", 0x1D});
|
||||
break;
|
||||
|
||||
case SCOPE_RX_LAYOUT:
|
||||
led_names = default_led_names;
|
||||
led_zones.push_back({"Keyboard", ZONE_TYPE_MATRIX, 106, new matrix_map_type{6, 22, (unsigned int *)&scope_matrix_map}});
|
||||
led_zones.push_back({"Logo", ZONE_TYPE_SINGLE, 1});
|
||||
|
||||
led_names.insert(led_names.begin() + 7, {"Key: Left Windows", 0x15});
|
||||
led_names.insert(led_names.begin() + 12, {"Key: Left Alt", 0x1D});
|
||||
led_names.push_back({ "Logo", 0xB0});
|
||||
break;
|
||||
|
||||
case SCOPE_TKL_LAYOUT:
|
||||
led_names = default_tkl_led_names;
|
||||
led_zones.push_back({"Keyboard", ZONE_TYPE_MATRIX, 86, new matrix_map_type{6, 18, (unsigned int *)&scope_tkl_matrix_map}});
|
||||
led_zones.push_back({"Logo", ZONE_TYPE_LINEAR, 2});
|
||||
led_zones.push_back({"Underglow", ZONE_TYPE_LINEAR, 26});
|
||||
|
||||
led_names.insert(led_names.begin() + 7, {"Key: Left Windows", 0x15});
|
||||
led_names.insert(led_names.begin() + 12, {"Key: Left Alt", 0x1D});
|
||||
break;
|
||||
|
||||
case FLARE_LAYOUT:
|
||||
led_names = default_led_names;
|
||||
led_zones.push_back({"Keyboard", ZONE_TYPE_MATRIX, 106, new matrix_map_type{6, 22, (unsigned int *)&flare_matrix_map}});
|
||||
led_zones.push_back({"Logo", ZONE_TYPE_SINGLE, 1});
|
||||
led_zones.push_back({"Underglow", ZONE_TYPE_SINGLE, 2});
|
||||
|
||||
led_names.insert(led_names.begin() + 7, {"Key: Left Windows", 0x0D});
|
||||
led_names.insert(led_names.begin() + 12, {"Key: Left Alt", 0x15});
|
||||
|
||||
led_names.push_back({ "Logo", 0xB8});
|
||||
led_names.push_back({ "Left Underglow", 0xB9});
|
||||
led_names.push_back({ "Right Underglow", 0xBA});
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned int total_led_count = 0;
|
||||
for(unsigned int zone_idx = 0; zone_idx < 3; zone_idx++)
|
||||
for(unsigned int zone_idx = 0; zone_idx < led_zones.size(); 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.name = led_zones[zone_idx].name;
|
||||
new_zone.type = led_zones[zone_idx].type;
|
||||
new_zone.leds_min = led_zones[zone_idx].size;
|
||||
new_zone.leds_max = led_zones[zone_idx].size;
|
||||
new_zone.leds_count = led_zones[zone_idx].size;
|
||||
|
||||
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
|
||||
if(led_zones[zone_idx].type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
new_zone.matrix_map = new matrix_map_type;
|
||||
new_zone.matrix_map->height = 6;
|
||||
new_zone.matrix_map->width = 22;
|
||||
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
|
||||
new_zone.matrix_map = led_zones[zone_idx].matrix;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -216,7 +374,7 @@ void RGBController_AuraKeyboard::SetupZones()
|
||||
|
||||
zones.push_back(new_zone);
|
||||
|
||||
total_led_count += zone_sizes[zone_idx];
|
||||
total_led_count += led_zones[zone_idx].size;
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
@@ -224,6 +382,7 @@ void RGBController_AuraKeyboard::SetupZones()
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx].name;
|
||||
new_led.value = led_names[led_idx].idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
@@ -239,20 +398,25 @@ void RGBController_AuraKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
|
||||
void RGBController_AuraKeyboard::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char frame_buf[109 * 4];
|
||||
std::vector<unsigned char> frame_buf;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| TODO: Send packets with multiple LED frames |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
frame_buf[(led_idx * 4) + 0] = leds[led_idx].value;
|
||||
frame_buf[(led_idx * 4) + 1] = RGBGetRValue(colors[led_idx]);
|
||||
frame_buf[(led_idx * 4) + 2] = RGBGetGValue(colors[led_idx]);
|
||||
frame_buf[(led_idx * 4) + 3] = RGBGetBValue(colors[led_idx]);
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
| Resize the frame buffer, 4 bytes per LED |
|
||||
\*---------------------------------------------------------*/
|
||||
frame_buf.resize(leds.size() * 4);
|
||||
|
||||
aura->SendDirect(109, frame_buf);
|
||||
/*---------------------------------------------------------*\
|
||||
| TODO: Send packets with multiple LED frames |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
frame_buf[(led_idx * 4) + 0] = leds[led_idx].value;
|
||||
frame_buf[(led_idx * 4) + 1] = RGBGetRValue(colors[led_idx]);
|
||||
frame_buf[(led_idx * 4) + 2] = RGBGetGValue(colors[led_idx]);
|
||||
frame_buf[(led_idx * 4) + 3] = RGBGetBValue(colors[led_idx]);
|
||||
}
|
||||
|
||||
aura->SendDirect(leds.size(), frame_buf.data());
|
||||
}
|
||||
|
||||
void RGBController_AuraKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
|
||||
@@ -11,10 +11,32 @@
|
||||
#include "RGBController.h"
|
||||
#include "AsusAuraKeyboardController.h"
|
||||
|
||||
enum AuraKeyboardMappingLayoutType
|
||||
{
|
||||
FLARE_LAYOUT,
|
||||
SCOPE_LAYOUT,
|
||||
SCOPE_RX_LAYOUT,
|
||||
SCOPE_TKL_LAYOUT,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
unsigned char idx;
|
||||
} led_type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
const zone_type type;
|
||||
const unsigned int size;
|
||||
matrix_map_type* matrix;
|
||||
} led_zone;
|
||||
|
||||
class RGBController_AuraKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraKeyboard(AuraKeyboardController* aura_ptr);
|
||||
RGBController_AuraKeyboard(AuraKeyboardController* aura_ptr, AuraKeyboardMappingLayoutType keyboard_layout);
|
||||
~RGBController_AuraKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
@@ -29,5 +51,6 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraKeyboardController* aura;
|
||||
AuraKeyboardController* aura;
|
||||
AuraKeyboardMappingLayoutType layout;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user