14
14
15
15
static unsigned int full_matrix_map[6 ][21 ] =
16
16
{
17
- { 0 , NA, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 104 , 105 , 106 , 107 },
18
- { 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 87 , 88 , 89 , 90 },
19
- { 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 99 , 100 , 101 , 91 },
20
- { 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , 62 , NA, NA, NA, NA, 96 , 97 , 98 , NA},
21
- { 63 , NA, 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , NA, NA, 75 , NA, 93 , 94 , 95 , 92 },
22
- { 76 , 77 , 78 , NA, NA, NA, 79 , NA, NA, NA, 80 , 81 , 82 , 83 , 84 , 85 , 86 , 102 , NA, 103 , NA}
17
+ { 0 , NA, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 104 , 105 , 106 , 107 },
18
+ { 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 87 , 88 , 89 , 90 },
19
+ { 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 99 , 100 , 101 , 91 },
20
+ { 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , 62 , NA, NA, NA, NA, 96 , 97 , 98 , NA },
21
+ { 63 , NA, 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , NA, NA, 75 , NA, 93 , 94 , 95 , 92 },
22
+ { 76 , 77 , 78 , NA, NA, NA, 79 , NA, NA, NA, 80 , 81 , 82 , 83 , 84 , 85 , 86 , 102 , NA, 103 , NA }
23
23
};
24
24
25
- static unsigned int Z20_right_side_matrix[ 1 ][9 ] =
25
+ static unsigned int Z20_extra_zones[EVGA_KEYBOARD_Z20_EXTRA_ZONES ][9 ] =
26
26
{
27
- { 116 , 118 , 120 , 122 , 124 , 126 , 128 , 130 , 132 }
27
+ { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }, // Index 108
28
+ { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }, // Index 117
29
+ { 0 , 1 , 2 , 3 , 4 , 5 , NA, NA, NA } // Index 126
28
30
};
29
31
30
- static unsigned int Z20_left_side_matrix[ 1 ][ 9 ] =
32
+ const char * Z20_zone_names[EVGA_KEYBOARD_Z20_EXTRA_ZONES ] =
31
33
{
32
- { 115 , 117 , 119 , 121 , 123 , 125 , 127 , 129 , 131 }
33
- };
34
-
35
- static unsigned int Z20_macro_matrix[1 ][6 ] =
36
- {
37
- {109 , 110 , 111 , 112 , 113 , 114 }
34
+ " Right Side LEDs" ,
35
+ " Left Side LEDs" ,
36
+ " Macro Keys"
38
37
};
39
38
40
39
static const char *led_names[] =
@@ -154,16 +153,46 @@ static const char *led_names[] =
154
153
KEY_EN_MEDIA_PLAY_PAUSE,
155
154
KEY_EN_MEDIA_NEXT,
156
155
KEY_EN_MEDIA_MUTE,
157
- },
158
- {
159
- " Key: Feature Button" , " Key: Macro 1" , " Key: Macro 2" , " Key: Macro 3" , " Key: Macro 4" , " Key: Macro 5"
160
- },
161
- {
162
- " Key: Number Pad 1" , " Key: Number Pad 2" , " Key: Number Pad 3" , " Key: Number Pad 4" , " Key: Number Pad 5" , " Key: Number Pad 6" , " Key: Number Pad 7" , " Key: Number Pad 8" , " Key: Number Pad 9" },
163
- {
164
- " Key: Number Pad 1" , " Key: Number Pad 2" , " Key: Number Pad 3" , " Key: Number Pad 4" , " Key: Number Pad 5" , " Key: Number Pad 6" , " Key: Number Pad 7" , " Key: Number Pad 8" , " Key: Number Pad 9" },
156
+
157
+ " Key: Right LED 1" ,
158
+ " Key: Right LED 2" ,
159
+ " Key: Right LED 3" , // 110
160
+ " Key: Right LED 4" ,
161
+ " Key: Right LED 5" ,
162
+ " Key: Right LED 6" ,
163
+ " Key: Right LED 7" ,
164
+ " Key: Right LED 8" ,
165
+ " Key: Right LED 9" ,
166
+
167
+ " Key: Left LED 1" ,
168
+ " Key: Left LED 2" ,
169
+ " Key: Left LED 3" ,
170
+ " Key: Left LED 4" , // 120
171
+ " Key: Left LED 5" ,
172
+ " Key: Left LED 6" ,
173
+ " Key: Left LED 7" ,
174
+ " Key: Left LED 8" ,
175
+ " Key: Left LED 9" ,
176
+
177
+ " Key: Feature Button" ,
178
+ " Key: Macro 1" ,
179
+ " Key: Macro 2" ,
180
+ " Key: Macro 3" ,
181
+ " Key: Macro 4" , // 130
182
+ " Key: Macro 5" ,
165
183
};
166
184
185
+ /* *
186
+ @name EVGA USB Keyboard
187
+ @type USB
188
+ @save :x:
189
+ @direct :white_check_mark:
190
+ @effects :white_check_mark:
191
+ @detectors DetectEVGAKeyboardControllers
192
+ @comment The EVGA USB keyboard controller currently supports
193
+ the Z15 (both ISO & ANSI) as well as the Z20 ANSI keyboards
194
+ */
195
+
167
196
RGBController_EVGAKeyboard::RGBController_EVGAKeyboard (EVGAKeyboardController* controller_ptr)
168
197
{
169
198
/* -----------------------------------------------------*\
@@ -364,7 +393,8 @@ RGBController_EVGAKeyboard::~RGBController_EVGAKeyboard()
364
393
void RGBController_EVGAKeyboard::SetupZones ()
365
394
{
366
395
/* -------------------------------------------------*\
367
- | Clear any existing color/LED configuration |
396
+ | Set up the base configuration common to |
397
+ | Z15 and Z20 |
368
398
\*-------------------------------------------------*/
369
399
zone KB_zone;
370
400
KB_zone.name = " Keyboard Zone" ;
@@ -378,63 +408,59 @@ void RGBController_EVGAKeyboard::SetupZones()
378
408
KB_zone.matrix_map ->width = 21 ;
379
409
KB_zone.matrix_map ->map = (unsigned int *)&full_matrix_map;
380
410
zones.push_back (KB_zone);
381
- if (controller->GetDeviceName () == " EVGA Corporation EVGA Z20 Elite Gaming Keyboard" ){
382
- zone KB_right_sidelights;
383
- KB_right_sidelights.name = " Right Side Lights" ;
384
- KB_right_sidelights.type = 1 ;
385
- KB_right_sidelights.leds_min = 9 ;
386
- KB_right_sidelights.leds_max = 9 ;
387
- KB_right_sidelights.leds_count = 9 ;
388
- KB_right_sidelights.matrix_map = new matrix_map_type;
389
-
390
- zone KB_left_sidelights;
391
- KB_left_sidelights.name = " Left Side Lights" ;
392
- KB_left_sidelights.type = 1 ;
393
- KB_left_sidelights.leds_min = 9 ;
394
- KB_left_sidelights.leds_max = 9 ;
395
- KB_left_sidelights.leds_count = 9 ;
396
- KB_left_sidelights.matrix_map = new matrix_map_type;
397
-
398
- zone KB_macros;
399
- KB_macros.name = " Macros" ;
400
- KB_macros.type = 1 ;
401
- KB_macros.leds_min = 6 ;
402
- KB_macros.leds_max = 6 ;
403
- KB_macros.leds_count = 6 ;
404
- KB_macros.matrix_map = new matrix_map_type;
405
-
406
- KB_right_sidelights.matrix_map ->height = 1 ;
407
- KB_right_sidelights.matrix_map ->width = 9 ;
408
- KB_right_sidelights.matrix_map ->map = (unsigned int *)&Z20_right_side_matrix;
409
-
410
- KB_left_sidelights.matrix_map ->height = 1 ;
411
- KB_left_sidelights.matrix_map ->width = 9 ;
412
- KB_left_sidelights.matrix_map ->map = (unsigned int *)&Z20_right_side_matrix;
413
-
414
- KB_macros.matrix_map ->height = 1 ;
415
- KB_macros.matrix_map ->width = 6 ;
416
- KB_macros.matrix_map ->map = (unsigned int *)&Z20_macro_matrix;
417
-
418
- zones.push_back (KB_macros);
419
- zones.push_back (KB_left_sidelights);
420
- zones.push_back (KB_right_sidelights);
411
+
412
+ /* -------------------------------------------------*\
413
+ | Add configuration for the Z20 |
414
+ \*-------------------------------------------------*/
415
+ if (controller->GetPid () == 0x260A )
416
+ {
417
+
418
+ for (uint8_t i = 0 ; i < EVGA_KEYBOARD_Z20_EXTRA_ZONES; i++)
419
+ {
420
+ uint8_t zone_size = sizeof (Z20_extra_zones[i]) / sizeof (Z20_extra_zones[i][0 ]);
421
+
422
+ for (uint8_t count = 0 ; count < zone_size; count++)
423
+ {
424
+ if (Z20_extra_zones[i][count] == NA)
425
+ {
426
+ zone_size = count;
427
+ break ;
428
+ }
429
+ }
430
+
431
+ zone new_zone;
432
+ new_zone.name = Z20_zone_names[i];
433
+ new_zone.type = ZONE_TYPE_MATRIX;
434
+ new_zone.leds_min = zone_size;
435
+ new_zone.leds_max = zone_size;
436
+ new_zone.leds_count = zone_size;
437
+
438
+ new_zone.matrix_map = new matrix_map_type;
439
+ new_zone.matrix_map ->height = 1 ;
440
+ new_zone.matrix_map ->width = zone_size;
441
+ new_zone.matrix_map ->map = (unsigned int *)&Z20_extra_zones[i];
442
+ zones.push_back (new_zone);
443
+ }
421
444
}
445
+
422
446
/* -------------------------------------------------*\
423
447
| Clear any existing color/LED configuration |
424
448
\*-------------------------------------------------*/
425
449
leds.clear ();
426
450
colors.clear ();
427
451
428
452
/* ---------------------------------------------------------*\
429
- | Set up zones |
453
+ | Set up leds |
430
454
\*---------------------------------------------------------*/
431
455
for (std::size_t zone_index = 0 ; zone_index < zones.size (); zone_index++)
432
456
{
457
+ int zone_offset = leds.size ();
458
+
433
459
for (unsigned int led_index = 0 ; led_index < zones[zone_index].leds_count ; led_index++)
434
460
{
435
461
led new_led;
436
- new_led.name = led_names[ led_index] ;
437
- new_led.value = led_index ;
462
+ new_led.value = led_index + zone_offset ;
463
+ new_led.name = led_names[new_led. value ] ;
438
464
leds.push_back (new_led);
439
465
}
440
466
}
0 commit comments