Update SteelSeries Apex controller for Apex 7 TKL version

master
edbgon 6 years ago committed by Adam Honse
parent 412c819699
commit 4660870c22

@ -21,11 +21,20 @@ static unsigned int keys[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x
0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
0x60, 0x61, 0x62, 0x63, 0x64, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
0xf0 };
0xf0 };
SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle)
static unsigned int keys_tkl[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
0x64, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xf0 };
SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle, steelseries_type type)
{
dev = dev_handle;
proto_type = type;
}
SteelSeriesApexController::~SteelSeriesApexController()
@ -50,7 +59,16 @@ void SteelSeriesApexController::SetMode
void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
{
unsigned char buf[643];
int num_keys = sizeof(keys)/sizeof(*keys);
int num_keys = 0;
if(proto_type == APEX_7)
{
num_keys = sizeof(keys) / sizeof(*keys);
}
else
{
num_keys = sizeof(keys_tkl) / sizeof(*keys_tkl);
}
/*-----------------------------------------------------*\
| Zero out buffer |
@ -69,7 +87,14 @@ void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
\*-----------------------------------------------------*/
for(int i = 0; i < num_keys; i++)
{
buf[(i*4)+3] = keys[i];
if(proto_type == APEX_7)
{
buf[(i*4)+3] = keys[i];
}
else
{
buf[(i*4)+3] = keys_tkl[i];
}
buf[(i*4)+4] = RGBGetRValue(colors[i]);
buf[(i*4)+5] = RGBGetGValue(colors[i]);
buf[(i*4)+6] = RGBGetBValue(colors[i]);

@ -8,6 +8,7 @@
\*-----------------------------------------*/
#include "RGBController.h"
#include "SteelSeriesGeneric.h"
#include <string>
#include <hidapi/hidapi.h>
@ -22,9 +23,11 @@ enum
class SteelSeriesApexController
{
public:
SteelSeriesApexController(hid_device* dev_handle);
SteelSeriesApexController(hid_device* dev_handle, steelseries_type type);
~SteelSeriesApexController();
steelseries_type proto_type;
void SetMode
(
unsigned char mode,

@ -36,6 +36,7 @@
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define STEELSERIES_APEX_7_PID 0x1612
#define STEELSERIES_APEX_7_TKL_PID 0x1618
typedef struct
{
@ -74,6 +75,7 @@ static const steelseries_device device_list[] =
| Keyboards |
\*-----------------------------------------------------------------------------------------------------------------------------------------------------------------*/
{ STEELSERIES_VID, STEELSERIES_APEX_7_PID, 1, DEVICE_TYPE_KEYBOARD, APEX_7, "SteelSeries Apex 7" },
{ STEELSERIES_VID, STEELSERIES_APEX_7_TKL_PID, 1, DEVICE_TYPE_KEYBOARD, APEX_7_TKL, "SteelSeries Apex 7 TKL" },
};
/******************************************************************************************\
@ -119,7 +121,7 @@ void DetectSteelSeriesControllers(std::vector<RGBController*>& rgb_controllers)
{
case DEVICE_TYPE_KEYBOARD:
{
SteelSeriesApexController* controller = new SteelSeriesApexController(dev);
SteelSeriesApexController* controller = new SteelSeriesApexController(dev, device_list[device_idx].proto_type);
RGBController_SteelSeriesApex* rgb_controller = new RGBController_SteelSeriesApex(controller);
rgb_controller->name = device_list[device_idx].name;

@ -21,5 +21,6 @@ typedef enum
RIVAL_300 = 0x01,
SIBERIA_350 = 0x03,
APEX_7 = 0x04,
APEX_7_TKL = 0x05,
} steelseries_type;

@ -28,7 +28,15 @@ static unsigned int matrix_map[6][23] =
{ 39, NA, 16, 22, 4 , 17, 19, 24, 20, 8 , 14, 15, 43 , 44 , NA , 36 , 71, 72, 73, 90, 91, 92, 82 },
{ 52, NA, 0 , 18, 3 , 5 , 6 , 7 , 9 , 10, 11, 46, 47 , 45 , NA , NA , NA, NA, NA, 87, 88, 89, NA },
{ 97, 95, 25, 23, 2 , 21, NA, 1 , 13, 12, 49, 50, 51 , NA , 101, NA , NA, 77, NA, 84, 85, 86, 83 },
{ 96, 99, 98, NA, NA, NA, NA, 40, NA, NA, NA, NA, 102, 103, 104, 100, 75, 76, 74, 93, NA, 94, NA } };
{ 96, 99, 98, NA, NA, NA, NA, 40, NA, NA, NA, NA, 102, 103, 104, 100, 75, 76, 74, 93, NA, 94, NA } };
static unsigned int matrix_map_tkl[6][19] =
{ { 37, NA, 53, 54, 55, 56, NA, 57, 58, 59, 60, NA, 61 , 62 , 63 , 64 , 65, 66, 67},
{ 48, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 41, 42 , NA , 38 , NA , 68, 69, 70},
{ 39, NA, 16, 22, 4 , 17, 19, 24, 20, 8 , 14, 15, 43 , 44 , NA , 36 , 71, 72, 73},
{ 52, NA, 0 , 18, 3 , 5 , 6 , 7 , 9 , 10, 11, 46, 47 , 45 , NA , NA , NA, NA, NA},
{ 97, 95, 25, 23, 2 , 21, NA, 1 , 13, 12, 49, 50, 51 , NA , 101, NA , NA, 77, NA},
{ 96, 99, 98, NA, NA, NA, NA, 40, NA, NA, NA, NA, 102, 103, 104, 100, 75, 76, 74} };
static const char* zone_names[] =
{
@ -45,6 +53,11 @@ static const unsigned int zone_sizes[] =
105,
};
static const unsigned int zone_sizes_tkl[] =
{
88,
};
static const char *led_names[] =
{
"Key: A",
@ -154,6 +167,98 @@ static const char *led_names[] =
"Key: FN",
};
static const char *led_names_tkl[] =
{
"Key: A",
"Key: B",
"Key: C",
"Key: D",
"Key: E",
"Key: F",
"Key: G",
"Key: H",
"Key: I",
"Key: J",
"Key: K",
"Key: L",
"Key: M",
"Key: N",
"Key: O",
"Key: P",
"Key: Q",
"Key: R",
"Key: S",
"Key: T",
"Key: U",
"Key: V",
"Key: W",
"Key: X",
"Key: Y",
"Key: Z",
"Key: 1",
"Key: 2",
"Key: 3",
"Key: 4",
"Key: 5",
"Key: 6",
"Key: 7",
"Key: 8",
"Key: 9",
"Key: 0",
"Key: Enter",
"Key: Escape",
"Key: Backspace",
"Key: Tab",
"Key: Space",
"Key: -",
"Key: =",
"Key: [",
"Key: ]",
"Key: Non-US #/~",
"Key: ;",
"Key: '",
"Key: Grave Accent/Tilde",
"Key: ,",
"Key: .",
"Key: /",
"Key: Caps Lock",
"Key: F1",
"Key: F2",
"Key: F3",
"Key: F4",
"Key: F5",
"Key: F6",
"Key: F7",
"Key: F8",
"Key: F9",
"Key: F10",
"Key: F11",
"Key: F12",
"Key: Print Screen",
"Key: Scroll Lock",
"Key: Pause",
"Key: Insert",
"Key: Home",
"Key: Page Up",
"Key: Delete",
"Key: End",
"Key: Page Down",
"Key: Right Arrow",
"Key: Left Arrow",
"Key: Down Arrow",
"Key: Up Arrow",
"Key: Non-US \\ and |",
"Key: Left Control",
"Key: Left Shift",
"Key: Left Alt",
"Key: Left Super",
"Key: Right Control",
"Key: Right Shift",
"Key: Right Alt",
"Key: Right Super",
"Key: FN",
};
RGBController_SteelSeriesApex::RGBController_SteelSeriesApex(SteelSeriesApexController* steelseries_ptr)
{
steelseries = steelseries_ptr;
@ -162,6 +267,8 @@ RGBController_SteelSeriesApex::RGBController_SteelSeriesApex(SteelSeriesApexCont
type = DEVICE_TYPE_KEYBOARD;
description = "SteelSeries Apex 7 RGB Device";
proto_type = steelseries->proto_type;
mode Direct;
Direct.name = "Direct";
Direct.value = 0x00;
@ -189,16 +296,34 @@ void RGBController_SteelSeriesApex::SetupZones()
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(proto_type == APEX_7)
{
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
}
else
{
new_zone.leds_min = zone_sizes_tkl[zone_idx];
new_zone.leds_max = zone_sizes_tkl[zone_idx];
new_zone.leds_count = zone_sizes_tkl[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;
if(proto_type == APEX_7)
{
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map->width = 19;
new_zone.matrix_map->map = (unsigned int *)&matrix_map_tkl;
}
}
else
{
@ -207,13 +332,27 @@ void RGBController_SteelSeriesApex::SetupZones()
zones.push_back(new_zone);
total_led_count += zone_sizes[zone_idx];
if(proto_type == APEX_7)
{
total_led_count += zone_sizes[zone_idx];
}
else
{
total_led_count += zone_sizes_tkl[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];
if(proto_type == APEX_7)
{
new_led.name = led_names[led_idx];
}
else
{
new_led.name = led_names_tkl[led_idx];
}
leds.push_back(new_led);
}
@ -250,6 +389,6 @@ void RGBController_SteelSeriesApex::SetCustomMode()
void RGBController_SteelSeriesApex::DeviceUpdateMode()
{
std::vector<RGBColor> temp_colors;
steelseries->SetMode(modes[active_mode].value, temp_colors);
std::vector<RGBColor> temp_colors;
steelseries->SetMode(modes[active_mode].value, temp_colors);
}

@ -12,6 +12,7 @@
#include "RGBController.h"
#include "SteelSeriesApexController.h"
#include "SteelSeriesGeneric.h"
class RGBController_SteelSeriesApex : public RGBController
{
@ -32,6 +33,7 @@ public:
private:
SteelSeriesApexController* steelseries;
steelseries_type proto_type;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};

Loading…
Cancel
Save