1313#define NA 0xFFFFFFFF
1414#define RGB_RAW_BUFFER_SIZE 96
1515
16- static unsigned int matrix_map [6 ][17 ] =
16+ static unsigned int matrix_map_tkl [6 ][17 ] =
1717{
18- {0 , NA, 12 , 18 , 24 , 30 , 36 , 42 , 48 , 54 , 60 , 66 , 72 , 78 , 84 , 90 , 96 },
19- {1 , 7 , 13 , 19 , 25 , 31 , 37 , 43 , 49 , 55 , 61 , 67 , 73 , 79 , 85 , 91 , 97 },
20- {2 , 8 , 14 , 20 , 26 , 32 , 38 , 44 , 50 , 56 , 62 , 68 , 74 , 80 , 86 , 92 , 98 },
21- {3 , 9 , 15 , 21 , 27 , 33 , 39 , 45 , 51 , 57 , 63 , 69 , 75 , 81 , NA, NA, NA},
22- {4 , 10 , 16 , 22 , 28 , 34 , 40 , 46 , 52 , 58 , 64 , 70 , NA, 82 , NA, 94 , NA},
23- {5 , 11 , 17 , NA, NA, NA, 41 , NA, NA, NA, 65 , 71 , 77 , 83 , 89 , 95 , 101 }
18+ { 0 , NA, 12 , 18 , 24 , 30 , 36 , 42 , 48 , 54 , 60 , 66 , 72 , 78 , 84 , 90 , 96 },
19+ { 1 , 7 , 13 , 19 , 25 , 31 , 37 , 43 , 49 , 55 , 61 , 67 , 73 , 79 , 85 , 91 , 97 },
20+ { 2 , 8 , 14 , 20 , 26 , 32 , 38 , 44 , 50 , 56 , 62 , 68 , 74 , 80 , 86 , 92 , 98 },
21+ { 3 , 9 , 15 , 21 , 27 , 33 , 39 , 45 , 51 , 57 , 63 , 69 , 75 , 81 , NA, NA, NA},
22+ { 4 , 10 , 16 , 22 , 28 , 34 , 40 , 46 , 52 , 58 , 64 , 70 , NA, 82 , NA, 94 , NA},
23+ { 5 , 11 , 17 , NA, NA, NA, 41 , NA, NA, NA, 65 , 71 , 77 , 83 , 89 , 95 , 101 }
2424};
2525
26- static const char *zone_names[] =
26+ static unsigned int matrix_map_full[6 ][21 ] =
27+ {
28+ { 0 , NA, 12 , 18 , 24 , 30 , 36 , 42 , 48 , 54 , 60 , 66 , 72 , 78 , 84 , 91 , 90 , 103 , 109 , 115 , 96 },
29+ { 1 , 7 , 13 , 19 , 25 , 31 , 37 , 43 , 49 , 55 , 61 , 67 , 73 , 79 , 85 , 92 , 98 , 104 , 110 , 116 , 122 },
30+ { 2 , 8 , 14 , 20 , 26 , 32 , 38 , 44 , 50 , 56 , 62 , 68 , 74 , 80 , 86 , 93 , 99 , 105 , 111 , 117 , 123 },
31+ { 3 , 9 , 15 , 21 , 27 , 33 , 39 , 45 , 51 , 57 , 63 , 69 , 75 , 81 , NA, NA, NA, 106 , 112 , 118 , NA},
32+ { 4 , 10 , 16 , 22 , 28 , 34 , 40 , 46 , 52 , 58 , 64 , 70 , NA, 82 , NA, 94 , NA, 107 , 113 , 119 , 125 },
33+ { 5 , 11 , 17 , NA, NA, NA, 41 , NA, NA, NA, 65 , 71 , 77 , 83 , 89 , 95 , 102 , NA, 108 , 120 , NA}
34+ };
35+
36+
37+ /* static const char *zone_names[] =
2738{
2839 "Keyboard"
2940};
3041
3142static zone_type zone_types[] =
3243{
3344 ZONE_TYPE_MATRIX,
34- };
45+ };*/
3546
3647static const unsigned int zone_sizes[] =
3748{
38- 102
49+ 102 ,
50+ 126
3951};
4052
4153static const char *led_names[] =
@@ -50,7 +62,7 @@ static const char *led_names[] =
5062 " Key: 1" ,
5163 " Key: Q" ,
5264 " Key: A" ,
53- " Key: \\ (ISO)" , // iso key - 10
65+ " Key: \\ (ISO)" , // iso key - 10
5466 " Key: Left Windows" ,
5567 " Key: F1" ,
5668 " Key: 2" ,
@@ -60,7 +72,7 @@ static const char *led_names[] =
6072 " Key: Left Alt" ,
6173 " Key: F2" ,
6274 " Key: 3" ,
63- " Key: E" , // 20
75+ " Key: E" , // 20
6476 " Key: D" ,
6577 " Key: X" ,
6678 " Unused" , // space
@@ -70,7 +82,7 @@ static const char *led_names[] =
7082 " Key: F" ,
7183 " Key: C" ,
7284 " Unused" , // space
73- " Key: F4" , // 30
85+ " Key: F4" , // 30
7486 " Key: 5" ,
7587 " Key: T" ,
7688 " Key: G" ,
@@ -80,7 +92,7 @@ static const char *led_names[] =
8092 " Key: 6" ,
8193 " Key: Y" ,
8294 " Key: H" ,
83- " Key: B" , // 40
95+ " Key: B" , // 40
8496 " Key: Space" ,
8597 " Key: F6" ,
8698 " Key: 7" ,
@@ -90,7 +102,7 @@ static const char *led_names[] =
90102 " Unused" , // space
91103 " Key: F7" ,
92104 " Key: 8" ,
93- " Key: I" ,
105+ " Key: I" , // 50
94106 " Key: K" ,
95107 " Key: M" ,
96108 " Unused" , // space
@@ -100,7 +112,7 @@ static const char *led_names[] =
100112 " Key: L" ,
101113 " Key: ," ,
102114 " Unused" , // space
103- " Key: F9" ,
115+ " Key: F9" , // 60
104116 " Key: 0" ,
105117 " Key: P" ,
106118 " Key: ;" ,
@@ -110,7 +122,7 @@ static const char *led_names[] =
110122 " Key: -" ,
111123 " Key: [" ,
112124 " Key: '" ,
113- " Key: /" ,
125+ " Key: /" , // 70
114126 " Key: Right Windows" ,
115127 " Key: F11" ,
116128 " Key: =" ,
@@ -120,7 +132,7 @@ static const char *led_names[] =
120132 " Key: Right Fn" ,
121133 " Key: F12" ,
122134 " Key: Backspace" ,
123- " Key: \\ (ANSI)" ,
135+ " Key: \\ (ANSI)" , // 80
124136 " Key: Enter" ,
125137 " Key: Right Shift" ,
126138 " Key: Right Control" ,
@@ -130,7 +142,7 @@ static const char *led_names[] =
130142 " Unused" ,
131143 " Unused" ,
132144 " Key: Left Arrow" ,
133- " Key: Scroll Lock" ,
145+ " Key: Scroll Lock" , // 90
134146 " Key: Pause/Break" ,
135147 " Key: Home" ,
136148 " Key: End" ,
@@ -140,9 +152,33 @@ static const char *led_names[] =
140152 " Key: Mode" ,
141153 " Key: Page Up" ,
142154 " Key: Page Down" ,
155+ " Unused" , // 100
143156 " Unused" ,
157+ " Key: Right Arrow" ,
158+ " Key: A1" ,
159+ " Key: Num Lock" ,
160+ " Key: Number Pad 7" ,
161+ " Key: Number Pad 4" ,
162+ " Key: Number Pad 1" ,
163+ " Key: Number Pad 0" ,
164+ " Key: A2" ,
165+ " Key: Number Pad /" , // 110
166+ " Key: Number Pad 8" ,
167+ " Key: Number Pad 5" ,
168+ " Key: Number Pad 2" ,
144169 " Unused" ,
145- " Key: Right Arrow"
170+ " Key: A3" ,
171+ " Key: Number Pad *" ,
172+ " Key: Number Pad 9" ,
173+ " Key: Number Pad 6" ,
174+ " Key: Number Pad 3" ,
175+ " Key: Number Pad ." , // 120
176+ " Unused" ,
177+ " Key: Number Pad -" ,
178+ " Key: Number Pad +" ,
179+ " Unused" ,
180+ " Key: Number Pad Enter" ,
181+ " Unused"
146182};
147183
148184RGBController_WootingKeyboard::RGBController_WootingKeyboard (WootingKeyboardController *wooting_ptr)
@@ -185,26 +221,27 @@ void RGBController_WootingKeyboard::SetupZones()
185221 /* ---------------------------------------------------------*\
186222 | Set up zones |
187223 \*---------------------------------------------------------*/
188- unsigned int total_led_count = 0 ;
224+ uint8_t wooting_type = wooting->GetWootingType ();
225+ unsigned int total_led_count = zone_sizes[wooting_type];
189226
190- for (unsigned int zone_idx = 0 ; zone_idx < 1 ; zone_idx++)
191- {
227+ /* for (unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
228+ {*/
192229 zone new_zone;
193230
194- new_zone.name = zone_names[zone_idx] ;
195- new_zone.type = zone_types[zone_idx] ;
196- new_zone.leds_min = zone_sizes[zone_idx] ;
197- new_zone.leds_max = zone_sizes[zone_idx] ;
198- new_zone.leds_count = zone_sizes[zone_idx] ;
231+ new_zone.name = name. append ( " zone " ) ;
232+ new_zone.type = ZONE_TYPE_MATRIX ;
233+ new_zone.leds_min = total_led_count ;
234+ new_zone.leds_max = total_led_count ;
235+ new_zone.leds_count = total_led_count ;
199236 new_zone.matrix_map = new matrix_map_type;
200237 new_zone.matrix_map ->height = 6 ;
201- new_zone.matrix_map ->width = 17 ;
202- new_zone.matrix_map ->map = (unsigned int *)&matrix_map ;
238+ new_zone.matrix_map ->width = total_led_count / new_zone. matrix_map -> height ;
239+ new_zone.matrix_map ->map = (wooting_type == WOOTING_KB_TKL) ? ( unsigned int *)&matrix_map_tkl : ( unsigned int *)&matrix_map_full ;
203240
204241 zones.push_back (new_zone);
205242
206- total_led_count += zone_sizes[zone_idx];
207- }
243+ // total_led_count += zone_sizes[zone_idx];
244+ // }
208245
209246 for (unsigned int led_idx = 0 ; led_idx < total_led_count; led_idx++)
210247 {
0 commit comments