diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 91ec77ace..5eb9d5536 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -124,21 +124,25 @@ Configure the hardware via your `config.h`: --- -From this point forward the configuration is the same for all the drivers. The struct rgb_led array tells the system for each led, what key electrical matrix it represents, what the physical position is on the board, and if the led is for a modifier key or not. Here is a brief example: +From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example: ```C -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { -/* {row | col << 4} - * | {x=0..224, y=0..64} - * | | flags - * | | | */ - {{0|(0<<4)}, {20.36*0, 21.33*0}, 1}, - {{0|(1<<4)}, {20.36*1, 21.33*0}, 4}, - .... -} +const led_config_t g_led_config = { { + // Key Matrix to LED Index + { 5, NO_LED, NO_LED, 0 }, + { NO_LED, NO_LED, NO_LED, NO_LED }, + { 4, NO_LED, NO_LED, 1 }, + { 3, NO_LED, NO_LED, 2 } +}, { + // LED Index to Physical Position + { 188, 16 }, { 187, 48 }, { 149, 64 }, { 112, 64 }, { 37, 48 }, { 38, 16 } +}, { + // LED Index to Flag + 1, 4, 4, 4, 4, 1 +} }; ``` -The first part, `{row | col << 4}`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `{x=0..224, y=0..64}` represents the LED's physical position on the keyboard. The `x` is between (inclusive) 0-224, and `y` is between (inclusive) 0-64 as the effects are based on this range. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents x, y coordinate 0, 0 and the bottom right of your keyboard represents 224, 64. Using this as a basis, you can use the following formula to calculate the physical position: +The first part, `// Key Matrix to LED Index`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `// LED Index to Physical Position` represents the LED's physical position on the keyboard. The first value, `x`, is between 0-224 (inclusive), and the second value, `y`, is between 0-64 (inclusive). This range is due to effect that calculate the center or halves for their animations. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents x, y coordinate 0, 0 and the bottom right of your keyboard represents 224, 64. Using this as a basis, you can use the following formula to calculate the physical position: ```C x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION @@ -147,7 +151,7 @@ y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout. -`flags` is a bitmask, whether or not a certain LEDs is of a certain type. It is recommended that LEDs are set to only 1 type. +`// LED Index to Flag` is a bitmask, whether or not a certain LEDs is of a certain type. It is recommended that LEDs are set to only 1 type. ## Flags @@ -155,8 +159,8 @@ Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based |------------------------------------|-------------------------------------------| |`#define HAS_FLAGS(bits, flags)` |Returns true if `bits` has all `flags` set.| |`#define HAS_ANY_FLAGS(bits, flags)`|Returns true if `bits` has any `flags` set.| -|`#define LED_FLAG_NONE 0x00` |If thes LED has no flags. | -|`#define LED_FLAG_ALL 0xFF` |If thes LED has all flags. | +|`#define LED_FLAG_NONE 0x00` |If this LED has no flags. | +|`#define LED_FLAG_ALL 0xFF` |If this LED has all flags. | |`#define LED_FLAG_MODIFIER 0x01` |If the Key for this LED is a modifier. | |`#define LED_FLAG_UNDERGLOW 0x02` |If the LED is for underglow. | |`#define LED_FLAG_KEYLIGHT 0x04` |If the LED is for key backlight. | diff --git a/keyboards/boston_meetup/2019/2019.c b/keyboards/boston_meetup/2019/2019.c index 45c185549..933c14dee 100644 --- a/keyboards/boston_meetup/2019/2019.c +++ b/keyboards/boston_meetup/2019/2019.c @@ -19,20 +19,18 @@ #include "haptic.h" #ifdef RGB_MATRIX_ENABLE -#include "rgblight.h" +#include "rgb_matrix.h" -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - /*{row | col << 4} - | {x=0..224, y=0..64} - | | modifier - | | | */ - {{1|(3<<4)}, {188, 16}, 4}, - {{3|(3<<4)}, {187, 48}, 4}, - {{4|(2<<4)}, {149, 64}, 4}, - {{4|(1<<4)}, {112, 64}, 4}, - {{3|(0<<4)}, {37, 48}, 4}, - {{1|(0<<4)}, {38, 16}, 4} -}; +led_config_t g_led_config = { { + { 5, NO_LED, NO_LED, 0 }, + { NO_LED, NO_LED, NO_LED, NO_LED }, + { 4, NO_LED, NO_LED, 1 }, + { 3, NO_LED, NO_LED, 2 } +}, { + { 188, 16 }, { 187, 48 }, { 149, 64 }, { 112, 64 }, { 37, 48 }, { 38, 16 } +}, { + 4, 4, 4, 4, 4, 4 +} }; #endif uint8_t *o_fb; @@ -48,12 +46,12 @@ uint16_t counterst = 0; #define ScreenOffInterval 60000 /* milliseconds */ static uint16_t last_flush; -volatile uint8_t led_numlock = false; -volatile uint8_t led_capslock = false; +volatile uint8_t led_numlock = false; +volatile uint8_t led_capslock = false; volatile uint8_t led_scrolllock = false; static uint8_t layer; -static bool queue_for_send = false; +static bool queue_for_send = false; static uint8_t encoder_value = 32; __attribute__ ((weak)) @@ -64,13 +62,13 @@ void draw_ui(void) { /* Boston MK title is 55 x 10 pixels */ #define NAME_X 0 -#define NAME_Y 0 +#define NAME_Y 0 draw_string(NAME_X + 1, NAME_Y + 2, "BOSTON MK", PIXEL_ON, NORM, 0); /* Layer indicator is 41 x 10 pixels */ #define LAYER_INDICATOR_X 60 -#define LAYER_INDICATOR_Y 0 +#define LAYER_INDICATOR_Y 0 draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0); draw_rect_filled_soft(LAYER_INDICATOR_X + 32, LAYER_INDICATOR_Y + 1, 9, 9, PIXEL_ON, NORM); @@ -88,7 +86,7 @@ void draw_ui(void) { draw_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 3,(matrix_get_row(x) & (1 << y)) > 0, NORM); } - } + } draw_rect_soft(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y, 12, 12, PIXEL_ON, NORM); /* hadron oled location on thumbnail */ draw_rect_filled_soft(MATRIX_DISPLAY_X + 5, MATRIX_DISPLAY_Y + 2, 6, 2, PIXEL_ON, NORM); @@ -195,7 +193,7 @@ void matrix_init_kb(void) { queue_for_send = true; matrix_init_user(); } - + void matrix_scan_kb(void) { if (queue_for_send) { #ifdef QWIIC_MICRO_OLED_ENABLE diff --git a/keyboards/crkbd/rev1/rev1.c b/keyboards/crkbd/rev1/rev1.c index 2345028d2..38ab92788 100644 --- a/keyboards/crkbd/rev1/rev1.c +++ b/keyboards/crkbd/rev1/rev1.c @@ -51,78 +51,65 @@ void led_set_kb(uint8_t usb_led) { // 05 06 06 05 // 15 14 07 07 14 15 3 -/* {row | col << 4} logical layout rows/cols - * | {x=0..224, y=0..64} physical layout - * | | | modifier - * | | | */ -#define RGB_MATRIX_LEFT_LEDS \ - { { 0xFF }, { 85, 16 }, 2 }, /* 1 */ \ - { { 0xFF }, { 50, 13 }, 2 }, /* 2 */ \ - { { 0xFF }, { 16, 20 }, 2 }, /* 3 */ \ - { { 0xFF }, { 16, 38 }, 2 }, /* 4 */ \ - { { 0xFF }, { 50, 48 }, 2 }, /* 5 */ \ - { { 0xFF }, { 85, 52 }, 2 }, /* 6 */ \ - { { 3 | ( 5 << 4 ) }, { 95, 63 }, 1 }, /* 7 */ \ - { { 2 | ( 5 << 4 ) }, { 85, 39 }, 4 }, /* 8 */ \ - { { 1 | ( 5 << 4 ) }, { 85, 21 }, 4 }, /* 9 */ \ - { { 0 | ( 5 << 4 ) }, { 85, 4 }, 4 }, /* 10 */ \ - { { 0 | ( 4 << 4 ) }, { 68, 02 }, 4 }, /* 11 */ \ - { { 1 | ( 4 << 4 ) }, { 68, 19 }, 4 }, /* 12 */ \ - { { 2 | ( 4 << 4 ) }, { 68, 37 }, 4 }, /* 13 */ \ - { { 3 | ( 4 << 4 ) }, { 80, 58 }, 1 }, /* 14 */ \ - { { 3 | ( 3 << 4 ) }, { 60, 55 }, 1 }, /* 15 */ \ - { { 2 | ( 3 << 4 ) }, { 50, 35 }, 4 }, /* 16 */ \ - { { 1 | ( 3 << 4 ) }, { 50, 13 }, 4 }, /* 17 */ \ - { { 0 | ( 3 << 4 ) }, { 50, 0 }, 4 }, /* 18 */ \ - { { 0 | ( 2 << 4 ) }, { 33, 3 }, 4 }, /* 19 */ \ - { { 1 | ( 2 << 4 ) }, { 33, 20 }, 4 }, /* 20 */ \ - { { 2 | ( 2 << 4 ) }, { 33, 37 }, 4 }, /* 21 */ \ - { { 2 | ( 1 << 4 ) }, { 16, 42 }, 4 }, /* 22 */ \ - { { 1 | ( 1 << 4 ) }, { 16, 24 }, 4 }, /* 23 */ \ - { { 0 | ( 1 << 4 ) }, { 16, 7 }, 4 }, /* 24 */ \ - { { 0 | ( 0 << 4 ) }, { 0, 7 }, 1 }, /* 25 */ \ - { { 1 | ( 0 << 4 ) }, { 0, 24 }, 1 }, /* 26 */ \ - { { 2 | ( 0 << 4 ) }, { 0, 41 }, 1 }, /* 27 */ - -#define RGB_MATRIX_RIGHT_LEDS \ - { { 0xFF }, { 139, 16 }, 2 }, /* 1 */ \ - { { 0xFF }, { 174, 13 }, 2 }, /* 2 */ \ - { { 0xFF }, { 208, 20 }, 2 }, /* 3 */ \ - { { 0xFF }, { 208, 38 }, 2 }, /* 4 */ \ - { { 0xFF }, { 174, 48 }, 2 }, /* 5 */ \ - { { 0xFF }, { 139, 52 }, 2 }, /* 6 */ \ - { { 7 | ( 5 << 4 ) }, { 129, 63 }, 1 }, /* 7 */ \ - { { 6 | ( 5 << 4 ) }, { 139, 39 }, 4 }, /* 8 */ \ - { { 5 | ( 5 << 4 ) }, { 139, 21 }, 4 }, /* 9 */ \ - { { 4 | ( 5 << 4 ) }, { 139, 4 }, 4 }, /* 10 */ \ - { { 4 | ( 4 << 4 ) }, { 156, 02 }, 4 }, /* 11 */ \ - { { 5 | ( 4 << 4 ) }, { 156, 19 }, 4 }, /* 12 */ \ - { { 6 | ( 4 << 4 ) }, { 156, 37 }, 4 }, /* 13 */ \ - { { 7 | ( 4 << 4 ) }, { 144, 58 }, 1 }, /* 14 */ \ - { { 7 | ( 3 << 4 ) }, { 164, 55 }, 1 }, /* 15 */ \ - { { 6 | ( 3 << 4 ) }, { 174, 35 }, 4 }, /* 16 */ \ - { { 5 | ( 3 << 4 ) }, { 174, 13 }, 4 }, /* 17 */ \ - { { 4 | ( 3 << 4 ) }, { 174, 0 }, 4 }, /* 18 */ \ - { { 4 | ( 2 << 4 ) }, { 191, 3 }, 4 }, /* 19 */ \ - { { 5 | ( 2 << 4 ) }, { 191, 20 }, 4 }, /* 20 */ \ - { { 6 | ( 2 << 4 ) }, { 191, 37 }, 4 }, /* 21 */ \ - { { 6 | ( 1 << 4 ) }, { 208, 42 }, 4 }, /* 22 */ \ - { { 5 | ( 1 << 4 ) }, { 208, 24 }, 4 }, /* 23 */ \ - { { 4 | ( 1 << 4 ) }, { 208, 7 }, 4 }, /* 24 */ \ - { { 4 | ( 0 << 4 ) }, { 224, 7 }, 1 }, /* 25 */ \ - { { 5 | ( 0 << 4 ) }, { 224, 24 }, 1 }, /* 26 */ \ - { { 6 | ( 0 << 4 ) }, { 224, 41 }, 1 }, /* 27 */ #ifdef RGB_MATRIX_SPLIT_RIGHT -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - RGB_MATRIX_RIGHT_LEDS - RGB_MATRIX_LEFT_LEDS - }; +led_config_t g_led_config = { { + { 51, 50, 45, 44, 37, 36, NO_LED }, + { 52, 49, 46, 43, 38, 35, NO_LED }, + { 53, 48, 47, 42, 39, 34, NO_LED }, + { NO_LED, NO_LED, NO_LED, 41, 40, 33, NO_LED }, + { 24, 23, 18, 17, 10, 9, NO_LED }, + { 25, 22, 19, 16, 11, 8, NO_LED }, + { 26, 21, 20, 15, 12, 7, NO_LED }, + { NO_LED, NO_LED, NO_LED, 14, 13, 6, NO_LED } +}, { + { 139, 16 }, { 174, 13 }, { 208, 20 }, { 208, 38 }, { 174, 48 }, { 139, 52 }, { 129, 63 }, + { 139, 39 }, { 139, 21 }, { 139, 4 }, { 156, 2 }, { 156, 19 }, { 156, 37 }, { 144, 58 }, + { 164, 55 }, { 174, 35 }, { 174, 13 }, { 174, 0 }, { 191, 3 }, { 191, 20 }, { 191, 37 }, + { 208, 42 }, { 208, 24 }, { 208, 7 }, { 224, 7 }, { 224, 24 }, { 224, 41 }, { 85, 16 }, + { 50, 13 }, { 16, 20 }, { 16, 38 }, { 50, 48 }, { 85, 52 }, { 95, 63 }, { 85, 39 }, + { 85, 21 }, { 85, 4 }, { 68, 2 }, { 68, 19 }, { 68, 37 }, { 80, 58 }, { 60, 55 }, + { 50, 35 }, { 50, 13 }, { 50, 0 }, { 33, 3 }, { 33, 20 }, { 33, 37 }, { 16, 42 }, + { 16, 24 }, { 16, 7 }, { 0, 7 }, { 0, 24 }, { 0, 41 } +}, { + 2, 2, 2, 2, 2, 2, 1, + 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 1, 4, + 4, 4, 4, 4, 4, 1, 1, + 4, 4, 4, 4, 4, 4, 4, + 4, 4, 1, 1, 1 +} }; #else -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - RGB_MATRIX_LEFT_LEDS - RGB_MATRIX_RIGHT_LEDS - }; +led_config_t g_led_config = { { + { 24, 23, 18, 17, 10, 9, NO_LED }, + { 25, 22, 19, 16, 11, 8, NO_LED }, + { 26, 21, 20, 15, 12, 7, NO_LED }, + { NO_LED, NO_LED, NO_LED, 14, 13, 6, NO_LED }, + { 51, 50, 45, 44, 37, 36, NO_LED }, + { 52, 49, 46, 43, 38, 35, NO_LED }, + { 53, 48, 47, 42, 39, 34, NO_LED }, + { NO_LED, NO_LED, NO_LED, 41, 40, 33, NO_LED } +}, { + { 85, 16 }, { 50, 13 }, { 16, 20 }, { 16, 38 }, { 50, 48 }, { 85, 52 }, { 95, 63 }, + { 85, 39 }, { 85, 21 }, { 85, 4 }, { 68, 2 }, { 68, 19 }, { 68, 37 }, { 80, 58 }, + { 60, 55 }, { 50, 35 }, { 50, 13 }, { 50, 0 }, { 33, 3 }, { 33, 20 }, { 33, 37 }, + { 16, 42 }, { 16, 24 }, { 16, 7 }, { 0, 7 }, { 0, 24 }, { 0, 41 }, { 139, 16 }, + { 174, 13 }, { 208, 20 }, { 208, 38 }, { 174, 48 }, { 139, 52 }, { 129, 63 }, { 139, 39 }, + { 139, 21 }, { 139, 4 }, { 156, 2 }, { 156, 19 }, { 156, 37 }, { 144, 58 }, { 164, 55 }, + { 174, 35 }, { 174, 13 }, { 174, 0 }, { 191, 3 }, { 191, 20 }, { 191, 37 }, { 208, 42 }, + { 208, 24 }, { 208, 7 }, { 224, 7 }, { 224, 24 }, { 224, 41 } +}, { + 2, 2, 2, 2, 2, 2, 1, + 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 1, 4, + 4, 4, 4, 4, 4, 1, 1, + 4, 4, 4, 4, 4, 4, 4, + 4, 4, 1, 1, 1 +} }; #endif #endif diff --git a/keyboards/doro67/rgb/rgb.c b/keyboards/doro67/rgb/rgb.c index 8aaf6ef4a..e8c9ac632 100644 --- a/keyboards/doro67/rgb/rgb.c +++ b/keyboards/doro67/rgb/rgb.c @@ -14,6 +14,7 @@ * along with this program. If not, see . */ #include "rgb.h" +#include "rgb_matrix_types.h" // Optional override functions below. // You can leave any or all of these undefined. @@ -52,76 +53,32 @@ void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); } -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - {{0|(0<<4)}, {15*0, 0}, 4}, // Esc - {{0|(1<<4)}, {15*1, 0}, 4}, // 1 - {{0|(2<<4)}, {15*2, 0}, 4}, // 2 - {{0|(3<<4)}, {15*3, 0}, 4}, // 3 - {{0|(4<<4)}, {15*4, 0}, 4}, // 4 - {{0|(5<<4)}, {15*5, 0}, 4}, // 5 - {{0|(6<<4)}, {15*6, 0}, 4}, // 6 - {{0|(7<<4)}, {15*7, 0}, 4}, // 7 - {{0|(8<<4)}, {15*8, 0}, 4}, // 8 - {{0|(9<<4)}, {15*9, 0}, 4}, // 9 - {{0|(10<<4)}, {15*10, 0}, 4}, // 0 - {{0|(11<<4)}, {15*11, 0}, 4}, // - - {{0|(12<<4)}, {15*12, 0}, 4}, // = - {{0|(13<<4)}, {15*13.5, 0}, 1}, // Backspace - {{0|(14<<4)}, {15*15, 0}, 1}, // Ins - - {{1|(0<<4)}, {15*0.5, 16}, 1}, // Tab - {{1|(1<<4)}, {15*1.5, 16}, 4}, // Q - {{1|(2<<4)}, {15*2.5, 16}, 4}, // W - {{1|(3<<4)}, {15*3.5, 16}, 4}, // E - {{1|(4<<4)}, {15*4.5, 16}, 4}, // R - {{1|(5<<4)}, {15*5.5, 16}, 4}, // T - {{1|(6<<4)}, {15*6.5, 16}, 4}, // Y - {{1|(7<<4)}, {15*7.5, 16}, 4}, // U - {{1|(8<<4)}, {15*8.5, 16}, 4}, // I - {{1|(9<<4)}, {15*9.5, 16}, 4}, // O - {{1|(10<<4)}, {15*10.5, 16}, 4}, // P - {{1|(11<<4)}, {15*11.5, 16}, 4}, // [ - {{1|(12<<4)}, {15*12.5, 16}, 4}, // ] - {{1|(13<<4)}, {15*13.75, 16}, 1}, // - {{1|(14<<4)}, {15*15, 16}, 1}, // Del - - {{2|(0<<4)}, {15*0.75, 32}, 1}, // Capslock - {{2|(1<<4)}, {15*1.75, 32}, 4}, // A - {{2|(2<<4)}, {15*2.75, 32}, 4}, // S - {{2|(3<<4)}, {15*3.75, 32}, 4}, // D - {{2|(4<<4)}, {15*4.75, 32}, 4}, // F - {{2|(5<<4)}, {15*5.75, 32}, 4}, // G - {{2|(6<<4)}, {15*6.75, 32}, 4}, // H - {{2|(7<<4)}, {15*7.75, 32}, 4}, // J - {{2|(8<<4)}, {15*8.75, 32}, 4}, // K - {{2|(9<<4)}, {15*9.75, 32}, 4}, // L - {{2|(10<<4)}, {15*10.75, 32}, 4}, // ; - {{2|(11<<4)}, {15*11.75, 32}, 4}, // ' - {{2|(13<<4)}, {15*13.25, 32}, 1}, // Enter - {{2|(14<<4)}, {15*15, 32}, 1}, // Pgup - - {{3|(0<<4)}, {15*1.25, 48}, 1}, // LShift - {{3|(2<<4)}, {15*2, 48}, 4}, // Z - {{3|(3<<4)}, {15*3, 48}, 4}, // X - {{3|(4<<4)}, {15*4, 48}, 4}, // C - {{3|(5<<4)}, {15*5, 48}, 4}, // V - {{3|(6<<4)}, {15*6, 48}, 4}, // B - {{3|(7<<4)}, {15*7, 48}, 4}, // N - {{3|(8<<4)}, {15*8, 48}, 4}, // M - {{3|(9<<4)}, {15*9, 48}, 4}, // , - {{3|(10<<4)}, {15*10, 48}, 4}, // . - {{3|(11<<4)}, {15*11, 48}, 4}, // / - {{3|(12<<4)}, {15*12.75, 48}, 1}, // Shift - {{3|(13<<4)}, {15*14, 48}, 1}, // Up - {{3|(14<<4)}, {15*15, 48}, 1}, // Pgdn - - {{4|(0<<4)}, {15*0.25, 64}, 1}, // Ctrl - {{4|(1<<4)}, {15*1.5, 64}, 1}, // GUI - {{4|(2<<4)}, {15*2.25, 64}, 1}, // Alt - {{4|(3<<4)}, {15*6.75, 64}, 4}, // Space - {{4|(9<<4)}, {15*9, 64}, 1}, // RAlt - {{4|(10<<4)}, {15*10.25, 64}, 1}, // FN - {{4|(12<<4)}, {15*13, 64}, 1}, // Left - {{4|(13<<4)}, {15*14, 64}, 1}, // Down - {{4|(14<<4)}, {15*15, 64}, 1}, // Right -}; +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, + { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, + { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, NO_LED, 42, 43 }, + { 44, NO_LED, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 }, + { 58, 59, 60, 61, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 62, 63, NO_LED, 64, 65, 66 } +}, { + // Esc, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, Backspace, Ins + { 0, 0 }, { 15, 0 }, { 30, 0 }, { 45, 0 }, { 60, 0 }, { 75, 0 }, { 90, 0 }, { 105, 0 }, { 120, 0 }, { 135, 0 }, { 150, 0 }, { 165, 0 }, { 180, 0 }, { 202, 0 }, { 225, 0 }, + // Tab, Q, W, E, R, T, Y, U, I, O, P, [, ], , Del + { 7, 16 }, { 22, 16 }, { 37, 16 }, { 52, 16 }, { 67, 16 }, { 82, 16 }, { 97, 16 }, { 112, 16 }, { 127, 16 }, { 142, 16 }, { 157, 16 }, { 172, 16 }, { 187, 16 }, { 206, 16 }, { 225, 16 }, + // Capslock, A, S, D, F, G, H, J, K, L, ;, ', Enter, Pgup + { 11, 32 }, { 26, 32 }, { 41, 32 }, { 56, 32 }, { 71, 32 }, { 86, 32 }, { 101, 32 }, { 116, 32 }, { 131, 32 }, { 146, 32 }, { 161, 32 }, { 176, 32 }, { 198, 32 }, { 225, 32 }, + // LShift, Z, X, C, V, B, N, M, ,, ., /, Shift, Up, Pgdn + { 18, 48 }, { 30, 48 }, { 45, 48 }, { 60, 48 }, { 75, 48 }, { 90, 48 }, { 105, 48 }, { 120, 48 }, { 135, 48 }, { 150, 48 }, { 165, 48 }, { 191, 48 }, { 210, 48 }, { 225, 48 }, + // Ctrl, GUI, Alt, Space, RAlt, FN, Left, Down, Right + { 3, 64 }, { 22, 64 }, { 33, 64 }, { 101, 64 }, { 135, 64 }, { 153, 64 }, { 195, 64 }, { 210, 64 }, { 225, 64 } +}, { + // Esc, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, Backspace, Ins + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + // Tab, Q, W, E, R, T, Y, U, I, O, P, [, ], , Del + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + // Capslock, A, S, D, F, G, H, J, K, L, ;, ', Enter, Pgup + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + // LShift, Z, X, C, V, B, N, M, ,, ., /, Shift, Up, Pgdn + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, + // Ctrl, GUI, Alt, Space, RAlt, FN, Left, Down, Right + 1, 1, 1, 4, 1, 1, 1, 1, 1 +} }; diff --git a/keyboards/dztech/dz40rgb/dz40rgb.c b/keyboards/dztech/dz40rgb/dz40rgb.c index 34bfc4366..e5e39c92a 100644 --- a/keyboards/dztech/dz40rgb/dz40rgb.c +++ b/keyboards/dztech/dz40rgb/dz40rgb.c @@ -52,7 +52,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, E_3, D_3, F_3}, {0, E_2, D_2, F_2}, {0, E_1, D_1, F_1}, - + {0, E_13, D_13, F_13}, {0, E_14, D_14, F_14}, @@ -71,70 +71,25 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { +led_config_t g_led_config = { { + { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14 }, + { 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28 }, + { 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42 } +}, { + { 223, 0 }, { 203, 0 }, { 183, 0 }, { 162, 0 }, { 142, 0 }, { 122, 0 }, { 101, 0 }, { 81, 0 }, { 61, 0 }, { 40, 0 }, { 20, 0 }, { 0, 0 }, + { 223, 10 }, { 0, 10 }, { 223, 21 }, { 203, 21 }, { 183, 21 }, { 162, 21 }, { 142, 21 }, { 122, 21 }, { 101, 21 }, { 81, 21 }, { 61, 21 }, { 40, 21 }, + { 20, 21 }, { 0, 21 }, { 223, 31 }, { 0, 31 }, { 223, 42 }, { 203, 42 }, { 183, 42 }, { 162, 42 }, { 142, 42 }, { 122, 42 }, { 101, 42 }, { 81, 42 }, + { 61, 42 }, { 40, 42 }, { 20, 42 }, { 0, 42 }, { 223, 53 }, { 0, 53 }, { 223, 63 }, { 203, 63 }, { 183, 63 }, { 162, 63 }, { 142, 63 }, { 122, 63 }, + { 101, 63 }, { 81, 63 }, { 61, 63 }, { 40, 63 }, { 20, 63 }, { 0, 63 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1 +} }; - {{0|(11<<4)}, {20.36*11, 0}, 1}, - {{0|(10<<4)}, {20.36*10, 0}, 1}, - {{0|(9<<4)}, {20.36*9, 0}, 1}, - {{0|(8<<4)}, {20.36*8, 0}, 1}, - {{0|(7<<4)}, {20.36*7, 0}, 1}, - {{0|(6<<4)}, { 20.36*6, 0}, 1}, - {{0|(5<<4)}, { 20.36*5, 0}, 1}, - {{0|(4<<4)}, { 20.36*4, 0}, 1}, - {{0|(3<<4)}, { 20.36*3, 0}, 1}, - {{0|(2<<4)}, { 20.36*2, 0}, 1}, - {{0|(1<<4)}, { 20.36*1, 0}, 1}, - {{0|(0<<4)}, { 20.36*0, 0}, 1}, - - {{0|(12<<4)}, {20.36*11, 21.33*0.5}, 1}, - {{0|(13<<4)}, {20.36*0,21.33*0.5}, 1}, - - {{1|(11<<4)}, {20.36*11, 21.33}, 1}, - {{1|(10<<4)}, {20.36*10, 21.33}, 4}, - {{1|(9<<4)}, {20.36*9, 21.33}, 4}, - {{1|(8<<4)}, {20.36*8, 21.33}, 4}, - {{1|(7<<4)}, {20.36*7, 21.33}, 4}, - {{1|(6<<4)}, { 20.36*6, 21.33}, 4}, - {{1|(5<<4)}, { 20.36*5, 21.33}, 4}, - {{1|(4<<4)}, { 20.36*4, 21.33}, 4}, - {{1|(3<<4)}, { 20.36*3, 21.33}, 4}, - {{1|(2<<4)}, { 20.36*2, 21.33}, 4}, - {{1|(1<<4)}, { 20.36*1, 21.33}, 4}, - {{1|(0<<4)}, { 20.36*0, 21.33}, 1}, - - {{1|(12<<4)}, {20.36*11, 21.33*1.5}, 1}, - {{1|(13<<4)}, {20.36*0,21.33*1.5}, 1}, - - {{2|(11<<4)}, {20.36*11, 21.33*2}, 1}, - {{2|(10<<4)}, {20.36*10, 21.33*2}, 4}, - {{2|(9<<4)}, {20.36*9, 21.33*2}, 4}, - {{2|(8<<4)}, {20.36*8, 21.33*2}, 4}, - {{2|(7<<4)}, {20.36*7, 21.33*2}, 4}, - {{2|(6<<4)}, { 20.36*6, 21.33*2}, 4}, - {{2|(5<<4)}, { 20.36*5, 21.33*2}, 4}, - {{2|(4<<4)}, { 20.36*4, 21.33*2}, 4}, - {{2|(3<<4)}, { 20.36*3, 21.33*2}, 4}, - {{2|(2<<4)}, { 20.36*2, 21.33*2}, 4}, - {{2|(1<<4)}, { 20.36*1, 21.33*2}, 4}, - {{2|(0<<4)}, { 20.36*0, 21.33*2}, 1}, - - {{2|(12<<4)}, {20.36*11, 21.33*2.5}, 1}, - {{2|(13<<4)}, {20.36*0,21.33*2.5}, 1}, - - {{3|(11<<4)}, {20.36*11, 21.33*3}, 1}, - {{3|(10<<4)}, {20.36*10, 21.33*3}, 1}, - {{3|(9<<4)}, {20.36*9, 21.33*3}, 1}, - {{3|(8<<4)}, {20.36*8, 21.33*3}, 1}, - {{3|(7<<4)}, {20.36*7, 21.33*3}, 1}, - {{3|(6<<4)}, { 20.36*6, 21.33*3}, 1}, - {{3|(5<<4)}, { 20.36*5, 21.33*3}, 1}, - {{3|(4<<4)}, { 20.36*4, 21.33*3}, 1}, - {{3|(3<<4)}, { 20.36*3, 21.33*3}, 1}, - {{3|(2<<4)}, { 20.36*2, 21.33*3}, 1}, - {{3|(1<<4)}, { 20.36*1, 21.33*3}, 1}, - {{3|(0<<4)}, { 20.36*0, 21.33*3}, 1} - -}; #else const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations @@ -205,69 +160,25 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { +led_config_t g_led_config = { { + { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14 }, + { 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28 }, + { 52, 51, 50, 49, 48, NO_LED, 47, 46, 45, 44, 43, 42 } +}, { + { 223, 0 }, { 203, 0 }, { 183, 0 }, { 162, 0 }, { 142, 0 }, { 122, 0 }, { 101, 0 }, { 81, 0 }, { 61, 0 }, { 40, 0 }, { 20, 0 }, { 0, 0 }, + { 223, 10 }, { 0, 10 }, { 223, 21 }, { 203, 21 }, { 183, 21 }, { 162, 21 }, { 142, 21 }, { 122, 21 }, { 101, 21 }, { 81, 21 }, { 61, 21 }, { 40, 21 }, + { 20, 21 }, { 0, 21 }, { 223, 31 }, { 0, 31 }, { 223, 42 }, { 203, 42 }, { 183, 42 }, { 162, 42 }, { 142, 42 }, { 122, 42 }, { 101, 42 }, { 81, 42 }, + { 61, 42 }, { 40, 42 }, { 20, 42 }, { 0, 42 }, { 223, 53 }, { 0, 53 }, { 223, 63 }, { 203, 63 }, { 183, 63 }, { 162, 63 }, { 142, 63 }, { 111, 63 }, + { 81, 63 }, { 61, 63 }, { 40, 63 }, { 20, 63 }, { 0, 63 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 +} }; - {{0|(11<<4)}, {20.36*11, 0}, 1}, - {{0|(10<<4)}, {20.36*10, 0}, 1}, - {{0|(9<<4)}, {20.36*9, 0}, 1}, - {{0|(8<<4)}, {20.36*8, 0}, 1}, - {{0|(7<<4)}, {20.36*7, 0}, 1}, - {{0|(6<<4)}, { 20.36*6, 0}, 1}, - {{0|(5<<4)}, { 20.36*5, 0}, 1}, - {{0|(4<<4)}, { 20.36*4, 0}, 1}, - {{0|(3<<4)}, { 20.36*3, 0}, 1}, - {{0|(2<<4)}, { 20.36*2, 0}, 1}, - {{0|(1<<4)}, { 20.36*1, 0}, 1}, - {{0|(0<<4)}, { 20.36*0, 0}, 1}, - - {{0|(12<<4)}, {20.36*11, 21.33*0.5}, 1}, - {{0|(13<<4)}, {20.36*0,21.33*0.5}, 1}, - - {{1|(11<<4)}, {20.36*11, 21.33}, 1}, - {{1|(10<<4)}, {20.36*10, 21.33}, 4}, - {{1|(9<<4)}, {20.36*9, 21.33}, 4}, - {{1|(8<<4)}, {20.36*8, 21.33}, 4}, - {{1|(7<<4)}, {20.36*7, 21.33}, 4}, - {{1|(6<<4)}, { 20.36*6, 21.33}, 4}, - {{1|(5<<4)}, { 20.36*5, 21.33}, 4}, - {{1|(4<<4)}, { 20.36*4, 21.33}, 4}, - {{1|(3<<4)}, { 20.36*3, 21.33}, 4}, - {{1|(2<<4)}, { 20.36*2, 21.33}, 4}, - {{1|(1<<4)}, { 20.36*1, 21.33}, 4}, - {{1|(0<<4)}, { 20.36*0, 21.33}, 1}, - - {{1|(12<<4)}, {20.36*11, 21.33*1.5}, 1}, - {{1|(13<<4)}, {20.36*0,21.33*1.5}, 1}, - - {{2|(11<<4)}, {20.36*11, 21.33*2}, 1}, - {{2|(10<<4)}, {20.36*10, 21.33*2}, 4}, - {{2|(9<<4)}, {20.36*9, 21.33*2}, 4}, - {{2|(8<<4)}, {20.36*8, 21.33*2}, 4}, - {{2|(7<<4)}, {20.36*7, 21.33*2}, 4}, - {{2|(6<<4)}, { 20.36*6, 21.33*2}, 4}, - {{2|(5<<4)}, { 20.36*5, 21.33*2}, 4}, - {{2|(4<<4)}, { 20.36*4, 21.33*2}, 4}, - {{2|(3<<4)}, { 20.36*3, 21.33*2}, 4}, - {{2|(2<<4)}, { 20.36*2, 21.33*2}, 4}, - {{2|(1<<4)}, { 20.36*1, 21.33*2}, 4}, - {{2|(0<<4)}, { 20.36*0, 21.33*2}, 1}, - - {{2|(12<<4)}, {20.36*11, 21.33*2.5}, 1}, - {{2|(13<<4)}, {20.36*0,21.33*2.5}, 1}, - - {{3|(11<<4)}, {20.36*11, 21.33*3}, 1}, - {{3|(10<<4)}, {20.36*10, 21.33*3}, 1}, - {{3|(9<<4)}, {20.36*9, 21.33*3}, 1}, - {{3|(8<<4)}, {20.36*8, 21.33*3}, 1}, - {{3|(7<<4)}, {20.36*7, 21.33*3}, 1}, - {{3|(6<<4)}, { 20.36*5.5, 21.33*3}, 1}, - {{3|(4<<4)}, { 20.36*4, 21.33*3}, 1}, - {{3|(3<<4)}, { 20.36*3, 21.33*3}, 1}, - {{3|(2<<4)}, { 20.36*2, 21.33*3}, 1}, - {{3|(1<<4)}, { 20.36*1, 21.33*3}, 1}, - {{3|(0<<4)}, { 20.36*0, 21.33*3}, 1} - -}; #endif diff --git a/keyboards/dztech/dz40rgb/keymaps/default/keymap.c b/keyboards/dztech/dz40rgb/keymaps/default/keymap.c index 59b917121..650c178a7 100644 --- a/keyboards/dztech/dz40rgb/keymaps/default/keymap.c +++ b/keyboards/dztech/dz40rgb/keymaps/default/keymap.c @@ -31,11 +31,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; + +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c b/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c index 5613e3500..80741b19c 100644 --- a/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c +++ b/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c @@ -53,12 +53,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/keyboards/dztech/dz60rgb/dz60rgb.c b/keyboards/dztech/dz60rgb/dz60rgb.c index 10b2ea7a8..28ac7ce9e 100644 --- a/keyboards/dztech/dz60rgb/dz60rgb.c +++ b/keyboards/dztech/dz60rgb/dz60rgb.c @@ -65,69 +65,26 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_16, J_16, L_16}, }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - {{0|(13<<4)}, {16*13.5, 0}, 1}, - {{0|(12<<4)}, {16*12, 0}, 1}, - {{0|(11<<4)}, {16*11, 0}, 1}, - {{0|(10<<4)}, {16*10, 0}, 1}, - {{0|(9<<4)}, {16*9, 0}, 1}, - {{0|(8<<4)}, {16*8, 0}, 1}, - {{0|(7<<4)}, {16*7, 0}, 1}, - {{0|(6<<4)}, {16*6, 0}, 1}, - {{0|(5<<4)}, {16*5, 0}, 1}, - {{0|(4<<4)}, {16*4, 0}, 1}, - {{0|(3<<4)}, {16*3, 0}, 1}, - {{0|(2<<4)}, {16*2, 0}, 1}, - {{0|(1<<4)}, {16*1, 0}, 1}, - {{0|(0<<4)}, {16*0, 0}, 1}, - {{2|(13<<4)}, {16*13.75, 24}, 1}, - {{1|(12<<4)}, {16*12.5, 16}, 4}, - {{1|(11<<4)}, {16*11.5, 16}, 4}, - {{1|(10<<4)}, {16*10.5, 16}, 4}, - {{1|(9<<4)}, { 16*9.5, 16}, 4}, - {{1|(8<<4)}, { 16*8.5, 16}, 4}, - {{1|(7<<4)}, { 16*7.5, 16}, 4}, - {{1|(6<<4)}, { 16*6.5, 16}, 4}, - {{1|(5<<4)}, { 16*5.5, 16}, 4}, - {{1|(4<<4)}, { 16*4.5, 16}, 4}, - {{1|(3<<4)}, { 16*3.5, 16}, 4}, - {{1|(2<<4)}, { 16*2.5, 16}, 4}, - {{1|(1<<4)}, { 16*1.5, 16}, 4}, - {{1|(0<<4)}, { 16*0.25, 16}, 1}, - {{1|(13<<4)}, {16*12.75, 32}, 1}, - {{2|(11<<4)}, {16*11.75, 32}, 4}, - {{2|(10<<4)}, {16*10.75, 32}, 4}, - {{2|(9<<4)}, {16*9.75, 32}, 4}, - {{2|(8<<4)}, {16*8.75, 32}, 4}, - {{2|(7<<4)}, {16*7.75, 32}, 4}, - {{2|(6<<4)}, { 16*6.75, 32}, 4}, - {{2|(5<<4)}, { 16*5.75, 32}, 4}, - {{2|(4<<4)}, { 16*4.75, 32}, 4}, - {{2|(3<<4)}, { 16*3.75, 32}, 4}, - {{2|(2<<4)}, { 16*2.75, 32}, 4}, - {{2|(1<<4)}, { 16*1.75, 32}, 4}, - {{2|(0<<4)}, { 16*0.375, 32}, 1}, - {{3|(11<<4)}, {16*13.125, 48}, 1}, - {{3|(10<<4)}, {16*11.25, 48}, 4}, - {{3|(9<<4)}, {16*10.25, 48}, 4}, - {{3|(8<<4)}, {16*9.25, 48}, 4}, - {{3|(7<<4)}, {16*8.25, 48}, 4}, - {{3|(6<<4)}, {16*7.25, 48}, 4}, - {{3|(5<<4)}, {16*6.25, 48}, 4}, - {{3|(4<<4)}, {16*5.25, 48}, 4}, - {{3|(3<<4)}, {16*4.25, 48}, 4}, - {{3|(2<<4)}, {16*3.25, 48}, 4}, - {{3|(1<<4)}, {16*1.25, 48}, 4}, - {{3|(0<<4)}, {16*0.625, 48}, 1}, - {{4|(13<<4)}, {16*13.875, 64}, 1}, - {{4|(11<<4)}, {16*12.625, 64}, 1}, - {{4|(10<<4)}, {16*11.375, 64}, 1}, - {{4|(9<<4)}, {16*10.125, 64}, 1}, - {{4|(5<<4)}, { 16*6.375, 64}, 4}, - {{4|(2<<4)}, { 16*2.625, 64}, 1}, - {{4|(1<<4)}, { 16*1.375, 64}, 1}, - {{4|(0<<4)}, { 16*0.125, 64}, 1}, -}; +led_config_t g_led_config = { { + { 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 28 }, + { 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, NO_LED, 14 }, + { 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, NO_LED, NO_LED }, + { 60, 59, 58, NO_LED, NO_LED, 57, NO_LED, NO_LED, NO_LED, 56, 55, 54, NO_LED, 53 } +}, { + { 216, 0 }, { 192, 0 }, { 176, 0 }, { 160, 0 }, { 144, 0 }, { 128, 0 }, { 112, 0 }, { 96, 0 }, { 80, 0 }, { 64, 0 }, { 48, 0 }, { 32, 0 }, { 16, 0 }, { 0, 0 }, + { 220, 24 }, { 200, 16 }, { 184, 16 }, { 168, 16 }, { 152, 16 }, { 136, 16 }, { 120, 16 }, { 104, 16 }, { 88, 16 }, { 72, 16 }, { 56, 16 }, { 40, 16 }, { 24, 16 }, { 4, 16 }, + { 204, 32 }, { 188, 32 }, { 172, 32 }, { 156, 32 }, { 140, 32 }, { 124, 32 }, { 108, 32 }, { 92, 32 }, { 76, 32 }, { 60, 32 }, { 44, 32 }, { 28, 32 }, { 6, 32 }, { 210, 48 }, + { 180, 48 }, { 164, 48 }, { 148, 48 }, { 132, 48 }, { 116, 48 }, { 100, 48 }, { 84, 48 }, { 68, 48 }, { 52, 48 }, { 20, 48 }, { 10, 48 }, { 222, 64 }, { 202, 64 }, { 182, 64 }, + { 162, 64 }, { 102, 64 }, { 42, 64 }, { 22, 64 }, { 2, 64 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, + 1, 4, 1, 1, 1 +} }; + #elif defined (dzrgb60_hhkb) const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, H_15, G_15, I_15}, @@ -194,70 +151,26 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_16, J_16, L_16}, }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - {{2|(12<<4)}, {16*14, 0}, 1}, - {{0|(13<<4)}, {16*13, 0}, 1}, - {{0|(12<<4)}, {16*12, 0}, 1}, - {{0|(11<<4)}, {16*11, 0}, 1}, - {{0|(10<<4)}, {16*10, 0}, 1}, - {{0|(9<<4)}, {16*9, 0}, 1}, - {{0|(8<<4)}, {16*8, 0}, 1}, - {{0|(7<<4)}, {16*7, 0}, 1}, - {{0|(6<<4)}, {16*6, 0}, 1}, - {{0|(5<<4)}, {16*5, 0}, 1}, - {{0|(4<<4)}, {16*4, 0}, 1}, - {{0|(3<<4)}, {16*3, 0}, 1}, - {{0|(2<<4)}, {16*2, 0}, 1}, - {{0|(1<<4)}, {16*1, 0}, 1}, - {{0|(0<<4)}, {16*0, 0}, 1}, - {{1|(13<<4)}, {16*13.75, 16}, 1}, - {{1|(12<<4)}, {16*12.5, 16}, 4}, - {{1|(11<<4)}, {16*11.5, 16}, 4}, - {{1|(10<<4)}, {16*10.5, 16}, 4}, - {{1|(9<<4)}, { 16*9.5, 16}, 4}, - {{1|(8<<4)}, { 16*8.5, 16}, 4}, - {{1|(7<<4)}, { 16*7.5, 16}, 4}, - {{1|(6<<4)}, { 16*6.5, 16}, 4}, - {{1|(5<<4)}, { 16*5.5, 16}, 4}, - {{1|(4<<4)}, { 16*4.5, 16}, 4}, - {{1|(3<<4)}, { 16*3.5, 16}, 4}, - {{1|(2<<4)}, { 16*2.5, 16}, 4}, - {{1|(1<<4)}, { 16*1.5, 16}, 4}, - {{1|(0<<4)}, { 16*0.25, 16}, 1}, - {{2|(13<<4)}, {16*12.75, 32}, 1}, - {{2|(11<<4)}, {16*11.75, 32}, 4}, - {{2|(10<<4)}, {16*10.75, 32}, 4}, - {{2|(9<<4)}, {16*9.75, 32}, 4}, - {{2|(8<<4)}, {16*8.75, 32}, 4}, - {{2|(7<<4)}, {16*7.75, 32}, 4}, - {{2|(6<<4)}, { 16*6.75, 32}, 4}, - {{2|(5<<4)}, { 16*5.75, 32}, 4}, - {{2|(4<<4)}, { 16*4.75, 32}, 4}, - {{2|(3<<4)}, { 16*3.75, 32}, 4}, - {{2|(2<<4)}, { 16*2.75, 32}, 4}, - {{2|(1<<4)}, { 16*1.75, 32}, 4}, - {{2|(0<<4)}, { 16*0.375, 32}, 1}, - {{3|(13<<4)}, {16*14, 48}, 1}, - {{3|(11<<4)}, {16*12.625, 48}, 4}, - {{3|(10<<4)}, {16*11.25, 48}, 4}, - {{3|(9<<4)}, {16*10.25, 48}, 4}, - {{3|(8<<4)}, {16*9.25, 48}, 4}, - {{3|(7<<4)}, {16*8.25, 48}, 4}, - {{3|(6<<4)}, {16*7.25, 48}, 4}, - {{3|(5<<4)}, {16*6.25, 48}, 4}, - {{3|(4<<4)}, {16*5.25, 48}, 4}, - {{3|(3<<4)}, {16*4.25, 48}, 4}, - {{3|(2<<4)}, {16*3.25, 48}, 4}, - {{3|(1<<4)}, {16*1.25, 48}, 4}, - {{3|(0<<4)}, {16*0.625, 48}, 1}, - {{4|(13<<4)}, {16*13.625, 64}, 1}, - {{4|(11<<4)}, {16*12.375, 64}, 1}, - {{4|(10<<4)}, {16*11.125, 64}, 1}, - {{4|(5<<4)}, { 16*7, 64}, 4}, - {{4|(2<<4)}, { 16*2.875, 64}, 1}, - {{4|(1<<4)}, { 16*1.625, 64}, 1}, - {{4|(0<<4)}, { 16*0.375, 64}, 1}, -}; +led_config_t g_led_config = { { + { 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }, + { 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15 }, + { 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 0, 29 }, + { 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, NO_LED, 42 }, + { 61, 60, 59, NO_LED, NO_LED, 58, NO_LED, NO_LED, NO_LED, NO_LED, 57, 56, NO_LED, 55 } +}, { + { 224, 0 }, { 208, 0 }, { 192, 0 }, { 176, 0 }, { 160, 0 }, { 144, 0 }, { 128, 0 }, { 112, 0 }, { 96, 0 }, { 80, 0 }, { 64, 0 }, { 48, 0 }, { 32, 0 }, { 16, 0 }, + { 0, 0 }, { 220, 16 }, { 200, 16 }, { 184, 16 }, { 168, 16 }, { 152, 16 }, { 136, 16 }, { 120, 16 }, { 104, 16 }, { 88, 16 }, { 72, 16 }, { 56, 16 }, { 40, 16 }, { 24, 16 }, + { 4, 16 }, { 204, 32 }, { 188, 32 }, { 172, 32 }, { 156, 32 }, { 140, 32 }, { 124, 32 }, { 108, 32 }, { 92, 32 }, { 76, 32 }, { 60, 32 }, { 44, 32 }, { 28, 32 }, { 6, 32 }, + { 224, 48 }, { 202, 48 }, { 180, 48 }, { 164, 48 }, { 148, 48 }, { 132, 48 }, { 116, 48 }, { 100, 48 }, { 84, 48 }, { 68, 48 }, { 52, 48 }, { 20, 48 }, { 10, 48 }, { 218, 64 }, + { 198, 64 }, { 178, 64 }, { 112, 64 }, { 46, 64 }, { 26, 64 }, { 6, 64 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 1, 4, 1, 1, 1 +} }; + #elif defined (dzrgb60_hhkb_iso) const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, H_15, G_15, I_15}, @@ -324,70 +237,26 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_16, J_16, L_16}, }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - {{2|(12<<4)}, {16*14, 0}, 1}, - {{0|(13<<4)}, {16*13, 0}, 1}, - {{0|(12<<4)}, {16*12, 0}, 1}, - {{0|(11<<4)}, {16*11, 0}, 1}, - {{0|(10<<4)}, {16*10, 0}, 1}, - {{0|(9<<4)}, {16*9, 0}, 1}, - {{0|(8<<4)}, {16*8, 0}, 1}, - {{0|(7<<4)}, {16*7, 0}, 1}, - {{0|(6<<4)}, {16*6, 0}, 1}, - {{0|(5<<4)}, {16*5, 0}, 1}, - {{0|(4<<4)}, {16*4, 0}, 1}, - {{0|(3<<4)}, {16*3, 0}, 1}, - {{0|(2<<4)}, {16*2, 0}, 1}, - {{0|(1<<4)}, {16*1, 0}, 1}, - {{0|(0<<4)}, {16*0, 0}, 1}, - {{2|(13<<4)}, {16*13.75, 24}, 1}, - {{1|(12<<4)}, {16*12.5, 16}, 4}, - {{1|(11<<4)}, {16*11.5, 16}, 4}, - {{1|(10<<4)}, {16*10.5, 16}, 4}, - {{1|(9<<4)}, { 16*9.5, 16}, 4}, - {{1|(8<<4)}, { 16*8.5, 16}, 4}, - {{1|(7<<4)}, { 16*7.5, 16}, 4}, - {{1|(6<<4)}, { 16*6.5, 16}, 4}, - {{1|(5<<4)}, { 16*5.5, 16}, 4}, - {{1|(4<<4)}, { 16*4.5, 16}, 4}, - {{1|(3<<4)}, { 16*3.5, 16}, 4}, - {{1|(2<<4)}, { 16*2.5, 16}, 4}, - {{1|(1<<4)}, { 16*1.5, 16}, 4}, - {{1|(0<<4)}, { 16*0.25, 16}, 1}, - {{1|(13<<4)}, {16*12.75, 32}, 1}, - {{2|(11<<4)}, {16*11.75, 32}, 4}, - {{2|(10<<4)}, {16*10.75, 32}, 4}, - {{2|(9<<4)}, {16*9.75, 32}, 4}, - {{2|(8<<4)}, {16*8.75, 32}, 4}, - {{2|(7<<4)}, {16*7.75, 32}, 4}, - {{2|(6<<4)}, { 16*6.75, 32}, 4}, - {{2|(5<<4)}, { 16*5.75, 32}, 4}, - {{2|(4<<4)}, { 16*4.75, 32}, 4}, - {{2|(3<<4)}, { 16*3.75, 32}, 4}, - {{2|(2<<4)}, { 16*2.75, 32}, 4}, - {{2|(1<<4)}, { 16*1.75, 32}, 4}, - {{2|(0<<4)}, { 16*0.375, 32}, 1}, - {{3|(13<<4)}, {16*14, 48}, 1}, - {{3|(11<<4)}, {16*12.625, 48}, 4}, - {{3|(10<<4)}, {16*11.25, 48}, 4}, - {{3|(9<<4)}, {16*10.25, 48}, 4}, - {{3|(8<<4)}, {16*9.25, 48}, 4}, - {{3|(7<<4)}, {16*8.25, 48}, 4}, - {{3|(6<<4)}, {16*7.25, 48}, 4}, - {{3|(5<<4)}, {16*6.25, 48}, 4}, - {{3|(4<<4)}, {16*5.25, 48}, 4}, - {{3|(3<<4)}, {16*4.25, 48}, 4}, - {{3|(2<<4)}, {16*3.25, 48}, 4}, - {{3|(1<<4)}, {16*1.25, 48}, 4}, - {{3|(0<<4)}, {16*0.625, 48}, 1}, - {{4|(13<<4)}, {16*13.625, 64}, 1}, - {{4|(11<<4)}, {16*12.375, 64}, 1}, - {{4|(10<<4)}, {16*11.125, 64}, 1}, - {{4|(5<<4)}, { 16*7, 64}, 4}, - {{4|(2<<4)}, { 16*2.875, 64}, 1}, - {{4|(1<<4)}, { 16*1.625, 64}, 1}, - {{4|(0<<4)}, { 16*0.375, 64}, 1}, -}; +led_config_t g_led_config = { { + { 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }, + { 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 29 }, + { 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 0, 15 }, + { 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, NO_LED, 42 }, + { 61, 60, 59, NO_LED, NO_LED, 58, NO_LED, NO_LED, NO_LED, NO_LED, 57, 56, NO_LED, 55 } +}, { + { 224, 0 }, { 208, 0 }, { 192, 0 }, { 176, 0 }, { 160, 0 }, { 144, 0 }, { 128, 0 }, { 112, 0 }, { 96, 0 }, { 80, 0 }, { 64, 0 }, { 48, 0 }, { 32, 0 }, { 16, 0 }, + { 0, 0 }, { 220, 24 }, { 200, 16 }, { 184, 16 }, { 168, 16 }, { 152, 16 }, { 136, 16 }, { 120, 16 }, { 104, 16 }, { 88, 16 }, { 72, 16 }, { 56, 16 }, { 40, 16 }, { 24, 16 }, + { 4, 16 }, { 204, 32 }, { 188, 32 }, { 172, 32 }, { 156, 32 }, { 140, 32 }, { 124, 32 }, { 108, 32 }, { 92, 32 }, { 76, 32 }, { 60, 32 }, { 44, 32 }, { 28, 32 }, { 6, 32 }, + { 224, 48 }, { 202, 48 }, { 180, 48 }, { 164, 48 }, { 148, 48 }, { 132, 48 }, { 116, 48 }, { 100, 48 }, { 84, 48 }, { 68, 48 }, { 52, 48 }, { 20, 48 }, { 10, 48 }, { 218, 64 }, + { 198, 64 }, { 178, 64 }, { 112, 64 }, { 46, 64 }, { 26, 64 }, { 6, 64 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 1, 4, 1, 1, 1 +} }; + #elif defined (dzrgb60_ansi) const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_14, J_14, L_14}, @@ -453,69 +322,26 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_16, J_16, L_16}, }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - {{0|(13<<4)}, {16*13.5, 0}, 1}, - {{0|(12<<4)}, {16*12, 0}, 1}, - {{0|(11<<4)}, {16*11, 0}, 1}, - {{0|(10<<4)}, {16*10, 0}, 1}, - {{0|(9<<4)}, {16*9, 0}, 1}, - {{0|(8<<4)}, {16*8, 0}, 1}, - {{0|(7<<4)}, {16*7, 0}, 1}, - {{0|(6<<4)}, {16*6, 0}, 1}, - {{0|(5<<4)}, {16*5, 0}, 1}, - {{0|(4<<4)}, {16*4, 0}, 1}, - {{0|(3<<4)}, {16*3, 0}, 1}, - {{0|(2<<4)}, {16*2, 0}, 1}, - {{0|(1<<4)}, {16*1, 0}, 1}, - {{0|(0<<4)}, {16*0, 0}, 1}, - {{1|(13<<4)}, {16*13.75, 16}, 1}, - {{1|(12<<4)}, {16*12.5, 16}, 4}, - {{1|(11<<4)}, {16*11.5, 16}, 4}, - {{1|(10<<4)}, {16*10.5, 16}, 4}, - {{1|(9<<4)}, { 16*9.5, 16}, 4}, - {{1|(8<<4)}, { 16*8.5, 16}, 4}, - {{1|(7<<4)}, { 16*7.5, 16}, 4}, - {{1|(6<<4)}, { 16*6.5, 16}, 4}, - {{1|(5<<4)}, { 16*5.5, 16}, 4}, - {{1|(4<<4)}, { 16*4.5, 16}, 4}, - {{1|(3<<4)}, { 16*3.5, 16}, 4}, - {{1|(2<<4)}, { 16*2.5, 16}, 4}, - {{1|(1<<4)}, { 16*1.5, 16}, 4}, - {{1|(0<<4)}, { 16*0.25, 16}, 1}, - {{2|(13<<4)}, {16*13.375, 24}, 1}, - {{2|(11<<4)}, {16*11.75, 32}, 4}, - {{2|(10<<4)}, {16*10.75, 32}, 4}, - {{2|(9<<4)}, {16*9.75, 32}, 4}, - {{2|(8<<4)}, {16*8.75, 32}, 4}, - {{2|(7<<4)}, {16*7.75, 32}, 4}, - {{2|(6<<4)}, { 16*6.75, 32}, 4}, - {{2|(5<<4)}, { 16*5.75, 32}, 4}, - {{2|(4<<4)}, { 16*4.75, 32}, 4}, - {{2|(3<<4)}, { 16*3.75, 32}, 4}, - {{2|(2<<4)}, { 16*2.75, 32}, 4}, - {{2|(1<<4)}, { 16*1.75, 32}, 4}, - {{2|(0<<4)}, { 16*0.375, 32}, 1}, - {{3|(11<<4)}, {16*13.125, 48}, 1}, - {{3|(10<<4)}, {16*11.25, 48}, 4}, - {{3|(9<<4)}, {16*10.25, 48}, 4}, - {{3|(8<<4)}, {16*9.25, 48}, 4}, - {{3|(7<<4)}, {16*8.25, 48}, 4}, - {{3|(6<<4)}, {16*7.25, 48}, 4}, - {{3|(5<<4)}, {16*6.25, 48}, 4}, - {{3|(4<<4)}, {16*5.25, 48}, 4}, - {{3|(3<<4)}, {16*4.25, 48}, 4}, - {{3|(2<<4)}, {16*3.25, 48}, 4}, - {{3|(1<<4)}, {16*1.25, 48}, 4}, - {{3|(0<<4)}, {16*0.625, 48}, 1}, - {{4|(13<<4)}, {16*13.875, 64}, 1}, - {{4|(11<<4)}, {16*12.625, 64}, 1}, - {{4|(10<<4)}, {16*11.375, 64}, 1}, - {{4|(9<<4)}, {16*10.125, 64}, 1}, - {{4|(5<<4)}, { 16*6.375, 64}, 4}, - {{4|(2<<4)}, { 16*2.625, 64}, 1}, - {{4|(1<<4)}, { 16*1.375, 64}, 1}, - {{4|(0<<4)}, { 16*0.125, 64}, 1}, -}; +led_config_t g_led_config = { { + { 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14 }, + { 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, NO_LED, 28 }, + { 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, NO_LED, NO_LED }, + { 60, 59, 58, NO_LED, NO_LED, 57, NO_LED, NO_LED, NO_LED, 56, 55, 54, NO_LED, 53 } +}, { + { 216, 0 }, { 192, 0 }, { 176, 0 }, { 160, 0 }, { 144, 0 }, { 128, 0 }, { 112, 0 }, { 96, 0 }, { 80, 0 }, { 64, 0 }, { 48, 0 }, { 32, 0 }, { 16, 0 }, { 0, 0 }, + { 220, 16 }, { 200, 16 }, { 184, 16 }, { 168, 16 }, { 152, 16 }, { 136, 16 }, { 120, 16 }, { 104, 16 }, { 88, 16 }, { 72, 16 }, { 56, 16 }, { 40, 16 }, { 24, 16 }, { 4, 16 }, + { 214, 24 }, { 188, 32 }, { 172, 32 }, { 156, 32 }, { 140, 32 }, { 124, 32 }, { 108, 32 }, { 92, 32 }, { 76, 32 }, { 60, 32 }, { 44, 32 }, { 28, 32 }, { 6, 32 }, { 210, 48 }, + { 180, 48 }, { 164, 48 }, { 148, 48 }, { 132, 48 }, { 116, 48 }, { 100, 48 }, { 84, 48 }, { 68, 48 }, { 52, 48 }, { 20, 48 }, { 10, 48 }, { 222, 64 }, { 202, 64 }, { 182, 64 }, + { 162, 64 }, { 102, 64 }, { 42, 64 }, { 22, 64 }, { 2, 64 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, + 1, 4, 1, 1, 1 +} }; + #else const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_14, J_14, L_14}, @@ -583,71 +409,26 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, K_16, J_16, L_16}, }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - {{0|(13<<4)}, {17.23*13, 0}, 1}, - {{0|(12<<4)}, {17.23*12, 0}, 1}, - {{0|(11<<4)}, {17.23*11, 0}, 1}, - {{0|(10<<4)}, {17.23*10, 0}, 1}, - {{0|(9<<4)}, {17.23*9, 0}, 1}, - {{0|(8<<4)}, {17.23*8, 0}, 1}, - {{0|(7<<4)}, {17.23*7, 0}, 1}, - {{0|(6<<4)}, { 17.23*6, 0}, 1}, - {{0|(5<<4)}, { 17.23*5, 0}, 1}, - {{0|(4<<4)}, { 17.23*4, 0}, 1}, - {{0|(3<<4)}, { 17.23*3, 0}, 1}, - {{0|(2<<4)}, { 17.23*2, 0}, 1}, - {{0|(1<<4)}, { 17.23*1, 0}, 1}, - {{0|(0<<4)}, { 17.23*0, 0}, 1}, - {{1|(13<<4)}, {17.23*13, 16}, 1}, - {{1|(12<<4)}, {17.23*12, 16}, 4}, - {{1|(11<<4)}, {17.23*11, 16}, 4}, - {{1|(10<<4)}, {17.23*10, 16}, 4}, - {{1|(9<<4)}, {17.23*9, 16}, 4}, - {{1|(8<<4)}, {17.23*8, 16}, 4}, - {{1|(7<<4)}, {17.23*7, 16}, 4}, - {{1|(6<<4)}, { 17.23*6, 16}, 4}, - {{1|(5<<4)}, { 17.23*5, 16}, 4}, - {{1|(4<<4)}, { 17.23*4, 16}, 4}, - {{1|(3<<4)}, { 17.23*3, 16}, 4}, - {{1|(2<<4)}, { 17.23*2, 16}, 4}, - {{1|(1<<4)}, { 17.23*1, 16}, 4}, - {{1|(0<<4)}, { 17.23*0, 16}, 1}, - {{2|(13<<4)}, {17.23*13, 32}, 1}, - {{2|(11<<4)}, {17.23*11, 32}, 4}, - {{2|(10<<4)}, {17.23*10, 32}, 4}, - {{2|(9<<4)}, {17.23*9, 32}, 4}, - {{2|(8<<4)}, {17.23*8, 32}, 4}, - {{2|(7<<4)}, {17.23*7, 32}, 4}, - {{2|(6<<4)}, { 17.23*6, 32}, 4}, - {{2|(5<<4)}, { 17.23*5, 32}, 4}, - {{2|(4<<4)}, { 17.23*4, 32}, 4}, - {{2|(3<<4)}, { 17.23*3, 32}, 4}, - {{2|(2<<4)}, { 17.23*2, 32}, 4}, - {{2|(1<<4)}, { 17.23*1, 32}, 4}, - {{2|(0<<4)}, { 17.23*0, 32}, 1}, - {{3|(13<<4)}, {17.23*13, 48}, 1}, - {{3|(11<<4)}, {17.23*11, 48}, 4}, - {{3|(10<<4)}, {17.23*10, 48}, 4}, - {{3|(9<<4)}, {17.23*9, 48}, 4}, - {{3|(8<<4)}, {17.23*8, 48}, 4}, - {{3|(7<<4)}, {17.23*7, 48}, 4}, - {{3|(6<<4)}, { 17.23*6, 48}, 4}, - {{3|(5<<4)}, { 17.23*5, 48}, 4}, - {{3|(4<<4)}, { 17.23*4, 48}, 4}, - {{3|(3<<4)}, { 17.23*3, 48}, 4}, - {{3|(2<<4)}, { 17.23*2, 48}, 4}, - {{3|(1<<4)}, { 17.23*1, 48}, 4}, - {{3|(0<<4)}, { 17.23*0, 48}, 1}, - {{4|(13<<4)}, {17.23*13, 64}, 1}, - {{4|(11<<4)}, {17.23*11, 64}, 1}, - {{4|(10<<4)}, {17.23*10, 64}, 1}, - {{4|(9<<4)}, {17.23*9, 64}, 1}, - {{4|(8<<4)}, {17.23*8, 64}, 1}, - {{4|(5<<4)}, { 17.23*5, 64}, 4}, - {{4|(2<<4)}, { 17.23*2, 64}, 1}, - {{4|(1<<4)}, { 17.23*1, 64}, 1}, - {{4|(0<<4)}, { 17.23*0, 64}, 1}, -}; +led_config_t g_led_config = { { + { 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14 }, + { 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, NO_LED, 28 }, + { 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, NO_LED, 41 }, + { 62, 61, 60, NO_LED, NO_LED, 59, NO_LED, NO_LED, 58, 57, 56, 55, NO_LED, 54 } +}, { + { 223, 0 }, { 206, 0 }, { 189, 0 }, { 172, 0 }, { 155, 0 }, { 137, 0 }, { 120, 0 }, { 103, 0 }, { 86, 0 }, { 68, 0 }, { 51, 0 }, { 34, 0 }, { 17, 0 }, { 0, 0 }, + { 223, 16 }, { 206, 16 }, { 189, 16 }, { 172, 16 }, { 155, 16 }, { 137, 16 }, { 120, 16 }, { 103, 16 }, { 86, 16 }, { 68, 16 }, { 51, 16 }, { 34, 16 }, { 17, 16 }, { 0, 16 }, + { 223, 32 }, { 189, 32 }, { 172, 32 }, { 155, 32 }, { 137, 32 }, { 120, 32 }, { 103, 32 }, { 86, 32 }, { 68, 32 }, { 51, 32 }, { 34, 32 }, { 17, 32 }, { 0, 32 }, { 223, 48 }, + { 189, 48 }, { 172, 48 }, { 155, 48 }, { 137, 48 }, { 120, 48 }, { 103, 48 }, { 86, 48 }, { 68, 48 }, { 51, 48 }, { 34, 48 }, { 17, 48 }, { 0, 48 }, { 223, 64 }, { 189, 64 }, + { 172, 64 }, { 155, 64 }, { 137, 64 }, { 86, 64 }, { 34, 64 }, { 17, 64 }, { 0, 64 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, + 1, 1, 1, 4, 1, 1, 1 +} }; + #endif void matrix_init_kb(void) { diff --git a/keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c b/keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c index 741fc55fb..584f035ef 100644 --- a/keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c @@ -38,11 +38,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c b/keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c index 1f3807c3b..5a7a56801 100644 --- a/keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c @@ -39,11 +39,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c b/keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c index 4575eb19d..34c1752ff 100644 --- a/keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c @@ -39,11 +39,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS), }; +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/keyboards/dztech/dz60rgb/keymaps/iso/keymap.c b/keyboards/dztech/dz60rgb/keymaps/iso/keymap.c index 5e3884803..3a90d2f33 100644 --- a/keyboards/dztech/dz60rgb/keymaps/iso/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/iso/keymap.c @@ -38,11 +38,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c b/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c index 3dfa78374..a6d1e226b 100644 --- a/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c @@ -50,40 +50,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -void rgb_matrix_layer_helper(uint8_t red, uint8_t green, uint8_t blue, bool default_layer) -{ - rgb_led led; - - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { - rgb_matrix_set_color( i, red, green, blue ); - } - } +extern led_config_t g_led_config; +void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { + rgb_matrix_set_color( i, red, green, blue ); + } + } } void rgb_matrix_indicators_user(void) { uint8_t this_led = host_keyboard_leds(); - + if (!g_suspend_state) { switch (biton32(layer_state)) { case _LAYER1: rgb_matrix_layer_helper(0xFF, 0x00, 0x00, false); break; - + case _LAYER2: rgb_matrix_layer_helper(0x00, 0xFF, 0x00, false); break; - + case _LAYER4: rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, false); break; } } - + if (this_led & (1 << USB_LED_CAPS_LOCK)) { rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF); } - + switch (biton32(layer_state)) { case _LAYER3: if (this_led & (1 << USB_LED_NUM_LOCK)) { @@ -91,7 +87,7 @@ void rgb_matrix_indicators_user(void) } else { rgb_matrix_set_color(13, 0x00, 0x00, 0x00); } - + rgb_matrix_set_color(0, 0x00, 0xFF, 0x00); rgb_matrix_set_color(1, 0x00, 0x00, 0x00); rgb_matrix_set_color(1, 0x00, 0xFF, 0x00); diff --git a/keyboards/dztech/dz65rgb/dz65rgb.c b/keyboards/dztech/dz65rgb/dz65rgb.c index 78b345843..e14943d97 100644 --- a/keyboards/dztech/dz65rgb/dz65rgb.c +++ b/keyboards/dztech/dz65rgb/dz65rgb.c @@ -73,76 +73,26 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, C9_16, C7_15, C6_15}, // LD16 {1, C8_16, C7_16, C6_16}, // LD17 }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - {{1|(7<<4)}, {16*7, 16}, 4}, - {{1|(6<<4)}, {16*6, 16}, 4}, - {{1|(5<<4)}, {16*5, 16}, 4}, - {{1|(4<<4)}, {16*4, 16}, 4}, - {{1|(3<<4)}, {16*3, 16}, 4}, - {{1|(2<<4)}, {16*2, 16}, 4}, - {{1|(1<<4)}, {16*1, 16}, 4}, - {{1|(0<<4)}, {16*0, 16}, 1}, - {{2|(0<<4)}, {16*0, 32}, 1}, - {{0|(8<<4)}, {16*8, 0}, 1}, - {{0|(7<<4)}, {16*7, 0}, 1}, - {{0|(6<<4)}, {16*6, 0}, 1}, - {{0|(5<<4)}, {16*5, 0}, 1}, - {{0|(4<<4)}, {16*4, 0}, 1}, - {{0|(3<<4)}, {16*3, 0}, 1}, - {{0|(2<<4)}, {16*2, 0}, 1}, - {{0|(1<<4)}, {16*1, 0}, 1}, - {{0|(0<<4)}, {16*0, 0}, 1}, - {{0|(9<<4)}, {16*9, 0}, 1}, - {{0|(10<<4)}, {16*10, 0}, 1}, - {{0|(11<<4)}, {16*11, 0}, 1}, - {{0|(12<<4)}, {16*12, 0}, 1}, - {{0|(13<<4)}, {16*13, 0}, 1}, - {{0|(14<<4)}, {16*14, 0}, 1}, - {{1|(14<<4)}, {16*14, 16}, 1}, - {{2|(14<<4)}, {16*14, 32}, 1}, - {{1|(8<<4)}, {16*8, 16}, 4}, - {{1|(9<<4)}, {16*9, 16}, 4}, - {{1|(10<<4)}, {16*10, 16}, 4}, - {{1|(11<<4)}, {16*11, 16}, 4}, - {{1|(12<<4)}, {16*12, 16}, 4}, - {{1|(13<<4)}, {16*13, 16}, 4}, - {{3|(14<<4)}, {16*14, 48}, 1}, - {{4|(14<<4)}, {16*14, 64}, 1}, - {{4|(13<<4)}, {16*13, 64}, 1}, - {{4|(5<<4)}, {16*5, 64}, 1}, - {{3|(5<<4)}, {16*5, 48}, 4}, - {{3|(4<<4)}, {16*4, 48}, 4}, - {{3|(3<<4)}, {16*3, 48}, 4}, - {{3|(2<<4)}, {16*2, 48}, 4}, - {{3|(1<<4)}, {16*1, 48}, 4}, - {{4|(2<<4)}, {16*2, 64}, 1}, - {{4|(1<<4)}, {16*1, 64}, 1}, - {{2|(6<<4)}, {16*6, 32}, 4}, - {{2|(5<<4)}, {16*5, 32}, 4}, - {{2|(4<<4)}, {16*4, 32}, 4}, - {{2|(3<<4)}, {16*3, 32}, 4}, - {{2|(2<<4)}, {16*2, 32}, 4}, - {{2|(1<<4)}, {16*1, 32}, 4}, - {{3|(0<<4)}, {16*0, 48}, 1}, - {{4|(0<<4)}, {16*0, 64}, 1}, - {{2|(7<<4)}, {16*7, 32}, 4}, - {{2|(8<<4)}, {16*8, 32}, 4}, - {{2|(9<<4)}, {16*9, 32}, 4}, - {{2|(10<<4)}, {16*10, 32}, 4}, - {{2|(11<<4)}, {16*11, 32}, 4}, - {{2|(13<<4)}, {16*13, 32}, 4}, - {{3|(10<<4)}, {16*10, 48}, 4}, - {{3|(11<<4)}, {16*11, 48}, 4}, - {{3|(13<<4)}, {16*13, 48}, 4}, - {{3|(6<<4)}, {16*6, 48}, 4}, - {{3|(7<<4)}, {16*7, 48}, 4}, - {{3|(8<<4)}, {16*8, 48}, 4}, - {{3|(9<<4)}, {16*9, 48}, 4}, - {{4|(8<<4)}, {16*8, 64}, 1}, - {{4|(9<<4)}, {16*9, 64}, 1}, - {{4|(10<<4)}, {16*10, 64}, 1}, - {{4|(11<<4)}, {16*11, 64}, 1}, -}; + +led_config_t g_led_config = { { + { 17, 16, 15, 14, 13, 12, 11, 10, 9, 18, 19, 20, 21, 22, 23 }, + { 7, 6, 5, 4, 3, 2, 1, 0, 26, 27, 28, 29, 30, 31, 24 }, + { 8, 48, 47, 46, 45, 44, 43, 51, 52, 53, 54, 55, NO_LED, 56, 25 }, + { 49, 40, 39, 38, 37, 36, 60, 61, 62, 63, 57, 58, NO_LED, 59, 32 }, + { 50, 42, 41, NO_LED, NO_LED, 35, NO_LED, NO_LED, 64, 65, 66, 67, NO_LED, 34, 33 } +}, { + { 112, 16 }, { 96, 16 }, { 80, 16 }, { 64, 16 }, { 48, 16 }, { 32, 16 }, { 16, 16 }, { 0, 16 }, { 0, 32 }, { 128, 0 }, { 112, 0 }, { 96, 0 }, { 80, 0 }, { 64, 0 }, { 48, 0 }, + { 32, 0 }, { 16, 0 }, { 0, 0 }, { 144, 0 }, { 160, 0 }, { 176, 0 }, { 192, 0 }, { 208, 0 }, { 224, 0 }, { 224, 16 }, { 224, 32 }, { 128, 16 }, { 144, 16 }, { 160, 16 }, { 176, 16 }, + { 192, 16 }, { 208, 16 }, { 224, 48 }, { 224, 64 }, { 208, 64 }, { 80, 64 }, { 80, 48 }, { 64, 48 }, { 48, 48 }, { 32, 48 }, { 16, 48 }, { 32, 64 }, { 16, 64 }, { 96, 32 }, { 80, 32 }, + { 64, 32 }, { 48, 32 }, { 32, 32 }, { 16, 32 }, { 0, 48 }, { 0, 64 }, { 112, 32 }, { 128, 32 }, { 144, 32 }, { 160, 32 }, { 176, 32 }, { 208, 32 }, { 160, 48 }, { 176, 48 }, { 208, 48 }, + { 96, 48 }, { 112, 48 }, { 128, 48 }, { 144, 48 }, { 128, 64 }, { 144, 64 }, { 160, 64 }, { 176, 64 } +}, { + 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, + 4, 4, 1, 1, 1, 1, 4, 4, 4, 4, 4, 1, 1, 4, 4, + 4, 4, 4, 4, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 1, 1, 1, 1 +} }; void suspend_power_down_kb(void) { diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c index 13ea84302..09443cf72 100644 --- a/keyboards/ergodox_ez/ergodox_ez.c +++ b/keyboards/ergodox_ez/ergodox_ez.c @@ -269,68 +269,39 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { +led_config_t g_led_config = { { + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { 28, 33, 38, 43, 47, NO_LED }, + { 27, 32, 37, 42, 46, NO_LED }, + { 26, 31, 36, 41, 45, NO_LED }, + { 25, 30, 35, 40, 44, NO_LED }, + { 24, 29, 34, 39, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { 0, 5, 10, 15, NO_LED, NO_LED }, + { 1, 6, 11, 16, 20, NO_LED }, + { 2, 7, 12, 17, 21, NO_LED }, + { 3, 8, 13, 18, 22, NO_LED }, + { 4, 9, 14, 19, 23, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED } +}, { + { 137, 0 }, { 154, 0 }, { 172, 0 }, { 189, 0 }, { 206, 0 }, { 137, 12 }, + { 154, 12 }, { 172, 12 }, { 189, 12 }, { 206, 12 }, { 137, 25 }, { 154, 25 }, + { 172, 25 }, { 189, 25 }, { 206, 25 }, { 137, 38 }, { 154, 38 }, { 172, 38 }, + { 189, 38 }, { 206, 38 }, { 154, 51 }, { 172, 51 }, { 189, 51 }, { 206, 51 }, + { 86, 0 }, { 68, 0 }, { 51, 0 }, { 34, 0 }, { 17, 0 }, { 86, 12 }, + { 68, 12 }, { 51, 12 }, { 34, 12 }, { 17, 12 }, { 86, 25 }, { 68, 25 }, + { 51, 25 }, { 34, 25 }, { 17, 25 }, { 86, 38 }, { 68, 38 }, { 51, 38 }, + { 34, 38 }, { 17, 38 }, { 68, 51 }, { 51, 51 }, { 34, 51 }, { 17, 51 } +}, { + 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, + 4, 4, 1, 1, 1, 1, + 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, + 4, 4, 1, 1, 1, 1 +} }; - /*{row | col << 4} - | {x=0..224, y=0..64} - | | flags - | | | */ - {{ 8|(0<<4)}, {17.2* 8, 12.8*0}, 4}, // LED 1 on right > Key 6 - {{ 9|(0<<4)}, {17.2* 9, 12.8*0}, 4}, // LED 2 > Key 7 - {{10|(0<<4)}, {17.2*10, 12.8*0}, 4}, // LED 3 > Key 8 - {{11|(0<<4)}, {17.2*11, 12.8*0}, 4}, // LED 4 > Key 9 - {{12|(0<<4)}, {17.2*12, 12.8*0}, 4}, // LED 5 > Key 0 - - {{ 8|(1<<4)}, {17.2* 8, 12.8*1}, 4}, // LED 6 - {{ 9|(1<<4)}, {17.2* 9, 12.8*1}, 4}, // LED 7 - {{10|(1<<4)}, {17.2*10, 12.8*1}, 4}, // LED 8 - {{11|(1<<4)}, {17.2*11, 12.8*1}, 4}, // LED 9 - {{12|(1<<4)}, {17.2*12, 12.8*1}, 4}, // LED 10 - - {{ 8|(2<<4)}, {17.2* 8, 12.8*2}, 4}, // LED 11 - {{ 9|(2<<4)}, {17.2* 9, 12.8*2}, 4}, // LED 12 - {{10|(2<<4)}, {17.2*10, 12.8*2}, 4}, // LED 13 - {{11|(2<<4)}, {17.2*11, 12.8*2}, 4}, // LED 14 - {{12|(2<<4)}, {17.2*12, 12.8*2}, 4}, // LED 15 - - {{ 8|(3<<4)}, {17.2* 8, 12.8*3}, 4}, // LED 16 - {{ 9|(3<<4)}, {17.2* 9, 12.8*3}, 4}, // LED 17 - {{10|(3<<4)}, {17.2*10, 12.8*3}, 4}, // LED 18 - {{11|(3<<4)}, {17.2*11, 12.8*3}, 4}, // LED 19 - {{12|(3<<4)}, {17.2*12, 12.8*3}, 4}, // LED 20 - - {{ 9|(4<<4)}, {17.2* 9, 12.8*4}, 1}, // LED 21 - {{10|(4<<4)}, {17.2*10, 12.8*4}, 1}, // LED 22 - {{11|(4<<4)}, {17.2*11, 12.8*4}, 1}, // LED 23 - {{12|(4<<4)}, {17.2*12, 12.8*4}, 1}, // LED 24 - - {{ 5|(0<<4)}, {17.2* 5, 12.8*0}, 4}, // LED 1 on left > Key 5 - {{ 4|(0<<4)}, {17.2* 4, 12.8*0}, 4}, // LED 2 > Key 4 - {{ 3|(0<<4)}, {17.2* 3, 12.8*0}, 4}, // LED 3 > Key 3 - {{ 2|(0<<4)}, {17.2* 2, 12.8*0}, 4}, // LED 4 > Key 2 - {{ 1|(0<<4)}, {17.2* 1, 12.8*0}, 4}, // LED 5 > Key 1 - - {{ 5|(1<<4)}, {17.2* 5, 12.8*1}, 4}, // LED 6 - {{ 4|(1<<4)}, {17.2* 4, 12.8*1}, 4}, // LED 7 - {{ 3|(1<<4)}, {17.2* 3, 12.8*1}, 4}, // LED 8 - {{ 2|(1<<4)}, {17.2* 2, 12.8*1}, 4}, // LED 9 - {{ 1|(1<<4)}, {17.2* 1, 12.8*1}, 4}, // LED 10 - - {{ 5|(2<<4)}, {17.2* 5, 12.8*2}, 4}, // LED 11 - {{ 4|(2<<4)}, {17.2* 4, 12.8*2}, 4}, // LED 12 - {{ 3|(2<<4)}, {17.2* 3, 12.8*2}, 4}, // LED 13 - {{ 2|(2<<4)}, {17.2* 2, 12.8*2}, 4}, // LED 14 - {{ 1|(2<<4)}, {17.2* 1, 12.8*2}, 4}, // LED 15 - - {{ 5|(3<<4)}, {17.2* 5, 12.8*3}, 4}, // LED 16 - {{ 4|(3<<4)}, {17.2* 4, 12.8*3}, 4}, // LED 17 - {{ 3|(3<<4)}, {17.2* 3, 12.8*3}, 4}, // LED 18 - {{ 2|(3<<4)}, {17.2* 2, 12.8*3}, 4}, // LED 19 - {{ 1|(3<<4)}, {17.2* 1, 12.8*3}, 4}, // LED 20 - - {{ 4|(4<<4)}, {17.2* 4, 12.8*4}, 1}, // LED 21 - {{ 3|(4<<4)}, {17.2* 3, 12.8*4}, 1}, // LED 22 - {{ 2|(4<<4)}, {17.2* 2, 12.8*4}, 1}, // LED 23 - {{ 1|(4<<4)}, {17.2* 1, 12.8*4}, 1}, // LED 24 > Key Hack -}; #endif diff --git a/keyboards/exclusive/e6_rgb/e6_rgb.c b/keyboards/exclusive/e6_rgb/e6_rgb.c index 42f879990..106e58497 100644 --- a/keyboards/exclusive/e6_rgb/e6_rgb.c +++ b/keyboards/exclusive/e6_rgb/e6_rgb.c @@ -114,91 +114,79 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, E_16, D_16, F_16}, {0, B_16, A_16, C_16}, }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { -/* {row | col << 4} - * | {x=0..224, y=0..64} - * | | flags - * | | | */ + +led_config_t g_led_config = { { + { 0, 1, 4, 5, 12, 13, 36, 20, 21, 24, 25, 16, 17, 28 }, + { 2, 6, 7, 14, 15, 37, 38, 22, 23, 26, 27, 18, 19, 30 }, + { 3, 8, 9, 32, 33, 39, 40, 44, 45, 48, 49, 52, 31, NO_LED }, + { 59, 10, 11, 34, 35, 41, 42, 46, 47, 50, 53, 54, 56, NO_LED }, + { 60, 61, 62, NO_LED, NO_LED, 43, 51, 55, 58, 57, NO_LED, NO_LED, NO_LED, NO_LED } +}, { //cs1 - {{0|(0<<4)}, { 0, 0}, 1}, - {{0|(1<<4)}, { 17, 0}, 4}, - {{1|(0<<4)}, { 0, 16}, 1}, - {{2|(0<<4)}, { 0, 32}, 1}, - + { 0, 0 }, { 17, 0 }, { 0, 16 }, { 0, 32 }, //cs2 - {{0|(2<<4)}, { 34, 0}, 4}, - {{0|(3<<4)}, { 51, 0}, 4}, - {{1|(1<<4)}, { 17, 16}, 4}, - {{1|(2<<4)}, { 34, 16}, 4}, + { 34, 0 }, { 51, 0 }, { 17, 16 }, { 34, 16 }, //cs3 - {{2|(1<<4)}, { 17, 32}, 4}, - {{2|(2<<4)}, { 34, 32}, 4}, - {{3|(1<<4)}, { 17, 48}, 4}, - {{3|(2<<4)}, { 34, 48}, 4}, + { 17, 32 }, { 34, 32 }, { 17, 48 }, { 34, 48 }, //cs4 - {{0|(4<<4)}, { 68, 0}, 4}, - {{0|(5<<4)}, { 85, 0}, 4}, - {{1|(3<<4)}, { 51, 16}, 4}, - {{1|(4<<4)}, { 68, 16}, 4}, + { 68, 0 }, { 85, 0 }, { 51, 16 }, { 68, 16 }, //cs5 - {{0|(11<<4)}, {187, 0}, 4}, - {{0|(12<<4)}, {204, 0}, 4}, - {{1|(11<<4)}, {187, 16}, 4}, - {{1|(12<<4)}, {204, 16}, 4}, + { 187, 0 }, { 204, 0 }, { 187, 16 }, { 204, 16 }, //cs6 - {{0|(7<<4)}, {119, 0}, 4}, - {{0|(8<<4)}, {136, 0}, 4}, - {{1|(7<<4)}, {119, 16}, 4}, - {{1|(8<<4)}, {136, 16}, 4}, + { 119, 0 }, { 136, 0 }, { 119, 16 }, { 136, 16 }, //cs7 - {{0|(9<<4)}, {153, 0}, 4}, - {{0|(10<<4)}, {170, 0}, 4}, - {{1|(9<<4)}, {153, 16}, 4}, - {{1|(10<<4)}, {170, 16}, 4}, + { 153, 0 }, { 170, 0 }, { 153, 16 }, { 170, 16 }, //cs8 - {{0|(13<<4)}, {221, 0}, 4}, - {{0|(14<<4)}, {221, 0}, 4}, - {{1|(13<<4)}, {221, 32}, 1}, - {{2|(12<<4)}, {221, 16}, 1}, + { 221, 0 }, { 221, 0 }, { 221, 32 }, { 221, 16 }, //cs9 - {{2|(3<<4)}, { 51, 32}, 4}, - {{2|(4<<4)}, { 68, 32}, 4}, - {{3|(3<<4)}, { 51, 48}, 4}, - {{3|(4<<4)}, { 68, 48}, 4}, + { 51, 32 }, { 68, 32 }, { 51, 48 }, { 68, 48 }, //cs10 - {{0|(6<<4)}, {102, 0}, 4}, - {{1|(5<<4)}, { 85, 16}, 4}, - {{1|(6<<4)}, {102, 16}, 4}, - {{2|(5<<4)}, { 85, 32}, 4}, + { 102, 0 }, { 85, 16 }, { 102, 16 }, { 85, 32 }, //cs11 - {{2|(6<<4)}, {102, 32}, 4}, - {{3|(5<<4)}, { 85, 48}, 4}, - {{3|(6<<4)}, {102, 48}, 4}, - {{4|(5<<4)}, {102, 64}, 4}, + { 102, 32 }, { 85, 48 }, { 102, 48 }, { 102, 64 }, //cs12 - {{2|(7<<4)}, {119, 32}, 4}, - {{2|(8<<4)}, {136, 32}, 4}, - {{3|(7<<4)}, {119, 48}, 4}, - {{3|(8<<4)}, {136, 48}, 4}, + { 119, 32 }, { 136, 32 }, { 119, 48 }, { 136, 48 }, //cs13 - {{2|(9<<4)}, {153, 32}, 4}, - {{2|(10<<4)}, {170, 32}, 4}, - {{3|(9<<4)}, {153, 48}, 4}, - {{4|(6<<4)}, {136, 48}, 1}, + { 153, 32 }, { 170, 32 }, { 153, 48 }, { 136, 48 }, //cs14 - {{2|(11<<4)}, {187, 32}, 4}, - {{3|(10<<4)}, {170, 48}, 4}, - {{3|(11<<4)}, {187, 48}, 1}, - {{4|(7<<4)}, {153, 48}, 1}, + { 187, 32 }, { 170, 48 }, { 187, 48 }, { 153, 48 }, //cs15 - {{3|(12<<4)}, {221, 48}, 1}, - - {{4|(9<<4)}, {221, 64}, 1}, - {{4|(8<<4)}, {204, 64}, 1}, + { 221, 48 }, { 221, 64 }, { 204, 64 }, //cs16 - {{3|(0<<4)}, { 0, 48}, 1}, - {{4|(0<<4)}, { 0, 64}, 1}, - {{4|(1<<4)}, { 17, 64}, 1}, - {{4|(2<<4)}, { 34, 64}, 1}, -}; + { 0, 48 }, { 0, 64 }, { 17, 64 }, { 34, 64 } +}, { +//cs1 + 1, 4, 1, 1, +//cs2 + 4, 4, 4, 4, +//cs3 + 4, 4, 4, 4, +//cs4 + 4, 4, 4, 4, +//cs5 + 4, 4, 4, 4, +//cs6 + 4, 4, 4, 4, +//cs7 + 4, 4, 4, 4, +//cs8 + 4, 4, 1, 1, +//cs9 + 4, 4, 4, 4, +//cs10 + 4, 4, 4, 4, +//cs11 + 4, 4, 4, 4, +//cs12 + 4, 4, 4, 4, +//cs13 + 4, 4, 4, 1, +//cs14 + 4, 4, 1, 1, +//cs15 + 1, 1, 1, +//cs16 + 1, 1, 1, 1 +} }; + #endif diff --git a/keyboards/hadron/ver3/ver3.c b/keyboards/hadron/ver3/ver3.c index 5827b42e2..1491caba4 100644 --- a/keyboards/hadron/ver3/ver3.c +++ b/keyboards/hadron/ver3/ver3.c @@ -19,24 +19,19 @@ #include "haptic.h" #ifdef RGB_MATRIX_ENABLE -#include "rgblight.h" +#include "rgb_matrix.h" -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - /*{row | col << 4} - | {x=0..224, y=0..64} - | | modifier - | | | */ - {{1|(13<<4)}, {195, 3}, 4}, - {{4|(13<<4)}, {195, 16}, 4}, - {{4|(10<<4)}, {150, 16}, 4}, - {{4|(7<<4)}, {105, 16}, 4}, - {{4|(4<<4)}, {60, 16}, 4}, - {{4|(1<<4)}, {15, 16}, 4}, - {{1|(1<<4)}, {15, 3}, 4}, - {{1|(4<<4)}, {60, 3}, 4}, - {{1|(7<<4)}, {105, 3}, 4}, - {{1|(10<<4)}, {150, 3}, 4} -}; +led_config_t g_led_config = { { + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, 6, NO_LED, NO_LED, 7, NO_LED, NO_LED, 8, NO_LED, NO_LED, 9, NO_LED, NO_LED, 0, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, 5, NO_LED, NO_LED, 4, NO_LED, NO_LED, 3, NO_LED, NO_LED, 2, NO_LED, NO_LED, 1, NO_LED } +}, { + { 195, 3 }, { 195, 16 }, { 150, 16 }, { 105, 16 }, { 60, 16 }, { 15, 16 }, { 15, 3 }, { 60, 3 }, { 105, 3 }, { 150, 3 } +}, { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 +} }; #endif @@ -53,12 +48,12 @@ uint16_t counterst = 0; #define ScreenOffInterval 60000 /* milliseconds */ static uint16_t last_flush; -volatile uint8_t led_numlock = false; -volatile uint8_t led_capslock = false; +volatile uint8_t led_numlock = false; +volatile uint8_t led_capslock = false; volatile uint8_t led_scrolllock = false; static uint8_t layer; -static bool queue_for_send = false; +static bool queue_for_send = false; static uint8_t encoder_value = 32; __attribute__ ((weak)) @@ -69,7 +64,7 @@ void draw_ui(void) { /* Layer indicator is 41 x 10 pixels */ #define LAYER_INDICATOR_X 5 -#define LAYER_INDICATOR_Y 0 +#define LAYER_INDICATOR_Y 0 draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0); draw_rect_filled_soft(LAYER_INDICATOR_X + 32, LAYER_INDICATOR_Y + 1, 9, 9, PIXEL_ON, NORM); @@ -83,7 +78,7 @@ void draw_ui(void) { for (uint8_t y = 0; y < MATRIX_COLS; y++) { draw_pixel(MATRIX_DISPLAY_X + y + 2, MATRIX_DISPLAY_Y + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM); } - } + } draw_rect_soft(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y, 19, 9, PIXEL_ON, NORM); /* hadron oled location on thumbnail */ draw_rect_filled_soft(MATRIX_DISPLAY_X + 14, MATRIX_DISPLAY_Y + 2, 3, 1, PIXEL_ON, NORM); @@ -162,7 +157,7 @@ void read_host_led_state(void) { if (led_capslock == false){ led_capslock = true;} } else { - if (led_capslock == true){ + if (led_capslock == true){ led_capslock = false;} } if (leds & (1 << USB_LED_SCROLL_LOCK)) { @@ -197,7 +192,7 @@ void matrix_init_kb(void) { queue_for_send = true; matrix_init_user(); } - + void matrix_scan_kb(void) { if (queue_for_send) { #ifdef QWIIC_MICRO_OLED_ENABLE diff --git a/keyboards/hs60/v1/v1.c b/keyboards/hs60/v1/v1.c index bd6dd19b2..5267c9457 100644 --- a/keyboards/hs60/v1/v1.c +++ b/keyboards/hs60/v1/v1.c @@ -165,83 +165,37 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, C9_16, C7_15, C6_15} //D16 }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { -// -// C7, C6, C5, C4, C3, C2, C1, A7, A6, A5, A4, A3, A2, A1, -// C8, C9, C10, C11, C12, C13, C14, A8, A9, A10, A11, A12, A13, A15, -// D4, D5, D6, D7, D8, C16, C15, B5, B6, B7, B8, A16, ---, A14, -// D3, ---, D1, D9, D10, D11, D12, B4, B3, B2, B1, B9, ---, B10, -// D16, D15, D14, ---, ---, ---, D13, ---, ---, ---, B14, B13, B12, B11 -/* {row | col << 4} - * | {x=0..224, y=0..64} - * | | flags - * | | | */ - {{0|(13<<4)}, {224, 0}, 1}, //A1-A16 - {{0|(12<<4)}, {204, 0}, 4}, - {{0|(11<<4)}, {187, 0}, 4}, - {{0|(10<<4)}, {170, 0}, 4}, - {{0|(9<<4)}, {153, 0}, 4}, - {{0|(8<<4)}, {136, 0}, 4}, - {{0|(7<<4)}, {119, 0}, 4}, - {{1|(7<<4)}, {119, 16}, 4}, - {{1|(8<<4)}, {136, 16}, 4}, - {{1|(9<<4)}, {153, 16}, 4}, - {{1|(10<<4)}, {170, 16}, 4}, - {{1|(11<<4)}, {187, 16}, 4}, - {{1|(12<<4)}, {204, 16}, 4}, - {{2|(13<<4)}, {224, 32}, 1}, - {{2|(12<<4)}, {224, 16}, 4}, - {{2|(11<<4)}, {197, 32}, 4}, - - {{3|(10<<4)}, {170, 48}, 4}, //B1-B14 - {{3|(9<<4)}, {153, 48}, 4}, - {{3|(8<<4)}, {136, 48}, 4}, - {{3|(7<<4)}, {119, 48}, 4}, - {{2|(7<<4)}, {119, 32}, 4}, - {{2|(8<<4)}, {136, 32}, 4}, - {{2|(9<<4)}, {153, 32}, 4}, - {{2|(10<<4)}, {170, 32}, 4}, - {{3|(11<<4)}, {187, 48}, 4}, - {{3|(13<<4)}, {214, 48}, 1}, - {{4|(13<<4)}, {224, 64}, 1}, - {{4|(12<<4)}, {204, 64}, 1}, - {{4|(11<<4)}, {187, 64}, 1}, - {{4|(10<<4)}, {170, 64}, 1}, - - {{0|(6<<4)}, {102, 0}, 4}, //C1-C16 - {{0|(5<<4)}, { 85, 0}, 4}, - {{0|(4<<4)}, { 68, 0}, 4}, - {{0|(3<<4)}, { 51, 0}, 4}, - {{0|(2<<4)}, { 34, 0}, 4}, - {{0|(1<<4)}, { 17, 0}, 4}, - {{0|(0<<4)}, { 0, 0}, 1}, - {{1|(0<<4)}, { 0, 16}, 1}, - {{1|(1<<4)}, { 17, 16}, 4}, - {{1|(2<<4)}, { 34, 16}, 4}, - {{1|(3<<4)}, { 51, 16}, 4}, - {{1|(4<<4)}, { 68, 16}, 4}, - {{1|(5<<4)}, { 85, 16}, 4}, - {{1|(6<<4)}, {102, 16}, 4}, - {{2|(6<<4)}, {102, 32}, 4}, - {{2|(5<<4)}, { 85, 32}, 4}, - - {{3|(2<<4)}, { 32, 48}, 4}, //D1-D16 - //D2 - {{3|(0<<4)}, { 10, 48}, 1}, - {{2|(0<<4)}, { 0, 32}, 1}, - {{2|(1<<4)}, { 17, 32}, 4}, - {{2|(2<<4)}, { 34, 32}, 4}, - {{2|(3<<4)}, { 51, 32}, 4}, - {{2|(4<<4)}, { 68, 32}, 4}, - {{3|(3<<4)}, { 51, 48}, 4}, - {{3|(4<<4)}, { 68, 48}, 4}, - {{3|(5<<4)}, { 85, 48}, 4}, - {{3|(6<<4)}, {102, 48}, 4}, - {{4|(3<<4)}, {102, 64}, 4}, - {{4|(2<<4)}, { 34, 68}, 1}, - {{4|(1<<4)}, { 17, 68}, 1}, - {{4|(0<<4)}, { 0, 68}, 1} -}; +led_config_t g_led_config = { { + { 36, 35, 34, 33, 32, 31, 30, 6, 5, 4, 3, 2, 1, 0 }, + { 37, 38, 39, 40, 41, 42, 43, 7, 8, 9, 10, 11, 12, NO_LED }, + { 48, 49, 50, 51, 52, 45, 44, 20, 21, 22, 23, 15, 14, 13 }, + { 47, NO_LED, 46, 53, 54, 55, 56, 19, 18, 17, 16, 24, NO_LED, 25 }, + { 60, 59, 58, 57, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 29, 28, 27, 26 } +}, { + //A1-A16 + { 224, 0 }, { 204, 0 }, { 187, 0 }, { 170, 0 }, { 153, 0 }, { 136, 0 }, { 119, 0 }, { 119, 16 }, { 136, 16 }, { 153, 16 }, { 170, 16 }, { 187, 16 }, { 204, 16 }, { 224, 32 }, + { 224, 16 }, { 197, 32 }, + //B1-B14 + { 170, 48 }, { 153, 48 }, { 136, 48 }, { 119, 48 }, { 119, 32 }, { 136, 32 }, { 153, 32 }, { 170, 32 }, { 187, 48 }, { 214, 48 }, { 224, 64 }, { 204, 64 }, { 187, 64 }, { 170, 64 }, + //C1-C16 + { 102, 0 }, { 85, 0 }, { 68, 0 }, { 51, 0 }, { 34, 0 }, { 17, 0 }, { 0, 0 }, { 0, 16 }, { 17, 16 }, { 34, 16 }, { 51, 16 }, { 68, 16 }, { 85, 16 }, { 102, 16 }, + { 102, 32 }, { 85, 32 }, + //D1-D16 + { 32, 48 }, { 10, 48 }, { 0, 32 }, { 17, 32 }, { 34, 32 }, { 51, 32 }, { 68, 32 }, { 51, 48 }, { 68, 48 }, { 85, 48 }, { 102, 48 }, { 102, 64 }, { 34, 68 }, { 17, 68 }, + { 0, 68 } +}, { + //A1-A16 + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 4, 4, + //B1-B14 + 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, + //C1-C16 + 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, 4, 4, 4, + 4, 4, + //D1-D16 + 4, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1 +} }; #else @@ -319,83 +273,37 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, C9_16, C7_15, C6_15} //D16 }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { -// -// C7, C6, C5, C4, C3, C2, C1, A7, A6, A5, A4, A3, A2, A1, -// C8, C9, C10, C11, C12, C13, C14, A8, A9, A10, A11, A12, A13, ---, -// D4, D5, D6, D7, D8, C16, C15, B5, B6, B7, B8, A16, A15, A14, -// D3, D2, D1, D9, D10, D11, D12, B4, B3, B2, B1, B9, ---, B10, -// D16, D15, D14, ---, ---, ---, D13, ---, ---, ---, B14, B13, B12, B11 -/* {row | col << 4} - * | {x=0..224, y=0..64} - * | | flags - * | | | */ - {{0|(13<<4)}, {224, 0}, 1}, //A1-A16 - {{0|(12<<4)}, {204, 0}, 4}, - {{0|(11<<4)}, {187, 0}, 4}, - {{0|(10<<4)}, {170, 0}, 4}, - {{0|(9<<4)}, {153, 0}, 4}, - {{0|(8<<4)}, {136, 0}, 4}, - {{0|(7<<4)}, {119, 0}, 4}, - {{1|(7<<4)}, {119, 16}, 4}, - {{1|(8<<4)}, {136, 16}, 4}, - {{1|(9<<4)}, {153, 16}, 4}, - {{1|(10<<4)}, {170, 16}, 4}, - {{1|(11<<4)}, {187, 16}, 4}, - {{1|(12<<4)}, {204, 16}, 4}, - {{2|(13<<4)}, {224, 8}, 1}, - {{2|(12<<4)}, {204, 32}, 4}, - {{2|(11<<4)}, {187, 32}, 4}, - - {{3|(10<<4)}, {170, 48}, 4}, //B1-B14 - {{3|(9<<4)}, {153, 48}, 4}, - {{3|(8<<4)}, {136, 48}, 4}, - {{3|(7<<4)}, {119, 48}, 4}, - {{2|(7<<4)}, {119, 32}, 4}, - {{2|(8<<4)}, {136, 32}, 4}, - {{2|(9<<4)}, {153, 32}, 4}, - {{2|(10<<4)}, {170, 32}, 4}, - {{3|(11<<4)}, {187, 48}, 4}, - {{3|(13<<4)}, {214, 48}, 1}, - {{4|(13<<4)}, {224, 64}, 1}, - {{4|(12<<4)}, {204, 64}, 1}, - {{4|(11<<4)}, {187, 64}, 1}, - {{4|(10<<4)}, {170, 64}, 1}, - - {{0|(6<<4)}, {102, 0}, 4}, //C1-C16 - {{0|(5<<4)}, { 85, 0}, 4}, - {{0|(4<<4)}, { 68, 0}, 4}, - {{0|(3<<4)}, { 51, 0}, 4}, - {{0|(2<<4)}, { 34, 0}, 4}, - {{0|(1<<4)}, { 17, 0}, 4}, - {{0|(0<<4)}, { 0, 0}, 1}, - {{1|(0<<4)}, { 0, 16}, 1}, - {{1|(1<<4)}, { 17, 16}, 4}, - {{1|(2<<4)}, { 34, 16}, 4}, - {{1|(3<<4)}, { 51, 16}, 4}, - {{1|(4<<4)}, { 68, 16}, 4}, - {{1|(5<<4)}, { 85, 16}, 4}, - {{1|(6<<4)}, {102, 16}, 4}, - {{2|(6<<4)}, {102, 32}, 4}, - {{2|(5<<4)}, { 85, 32}, 4}, - - {{3|(2<<4)}, { 32, 48}, 4}, //D1-D16 - {{3|(1<<4)}, { 17, 48}, 4}, - {{3|(0<<4)}, { 0, 48}, 1}, - {{2|(0<<4)}, { 0, 32}, 1}, - {{2|(1<<4)}, { 17, 32}, 4}, - {{2|(2<<4)}, { 34, 32}, 4}, - {{2|(3<<4)}, { 51, 32}, 4}, - {{2|(4<<4)}, { 68, 32}, 4}, - {{3|(3<<4)}, { 51, 48}, 4}, - {{3|(4<<4)}, { 68, 48}, 4}, - {{3|(5<<4)}, { 85, 48}, 4}, - {{3|(6<<4)}, {102, 48}, 4}, - {{4|(3<<4)}, {102, 64}, 4}, - {{4|(2<<4)}, { 34, 68}, 1}, - {{4|(1<<4)}, { 17, 68}, 1}, - {{4|(0<<4)}, { 0, 68}, 1} -}; +led_config_t g_led_config = { { + { 36, 35, 34, 33, 32, 31, 30, 6, 5, 4, 3, 2, 1, 0 }, + { 37, 38, 39, 40, 41, 42, 43, 7, 8, 9, 10, 11, 12, NO_LED }, + { 49, 50, 51, 52, 53, 45, 44, 20, 21, 22, 23, 15, 14, 13 }, + { 48, 47, 46, 54, 55, 56, 57, 19, 18, 17, 16, 24, NO_LED, 25 }, + { 61, 60, 59, 58, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 29, 28, 27, 26 } +}, { + //A1-A16 + { 224, 0 }, { 204, 0 }, { 187, 0 }, { 170, 0 }, { 153, 0 }, { 136, 0 }, { 119, 0 }, { 119, 16 }, { 136, 16 }, { 153, 16 }, { 170, 16 }, { 187, 16 }, { 204, 16 }, { 224, 8 }, + { 204, 32 }, { 187, 32 }, + //B1-B14 + { 170, 48 }, { 153, 48 }, { 136, 48 }, { 119, 48 }, { 119, 32 }, { 136, 32 }, { 153, 32 }, { 170, 32 }, { 187, 48 }, { 214, 48 }, { 224, 64 }, { 204, 64 }, { 187, 64 }, { 170, 64 }, + //C1-C16 + { 102, 0 }, { 85, 0 }, { 68, 0 }, { 51, 0 }, { 34, 0 }, { 17, 0 }, { 0, 0 }, { 0, 16 }, { 17, 16 }, { 34, 16 }, { 51, 16 }, { 68, 16 }, { 85, 16 }, { 102, 16 }, + { 102, 32 }, { 85, 32 }, + //D1-D16 + { 32, 48 }, { 17, 48 }, { 0, 48 }, { 0, 32 }, { 17, 32 }, { 34, 32 }, { 51, 32 }, { 68, 32 }, { 51, 48 }, { 68, 48 }, { 85, 48 }, { 102, 48 }, { 102, 64 }, { 34, 68 }, + { 17, 68 }, { 0, 68 } +}, { + //A1-A16 + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 4, 4, + //B1-B14 + 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, + //C1-C16 + 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, 4, 4, 4, + 4, 4, + //D1-D16 + 4, 4, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1 +} }; #endif @@ -492,4 +400,4 @@ void suspend_power_down_kb(void) void suspend_wakeup_init_kb(void) { rgb_matrix_set_suspend_state(false); -} \ No newline at end of file +} diff --git a/keyboards/massdrop/alt/config_led.c b/keyboards/massdrop/alt/config_led.c index 1a9a539a0..42d4d1474 100644 --- a/keyboards/massdrop/alt/config_led.c +++ b/keyboards/massdrop/alt/config_led.c @@ -20,123 +20,34 @@ // // There is a quick-and-dirty implementation of this under ledvis.html -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - /* 0 */ { { (0)|(0 << 4) }, { 8, 56 }, 4 }, // KC_ESC - /* 1 */ { { (0)|(1 << 4) }, { 22, 56 }, 4 }, // KC_1 - /* 2 */ { { (0)|(2 << 4) }, { 35, 56 }, 4 }, // KC_2 - /* 3 */ { { (0)|(3 << 4) }, { 49, 56 }, 4 }, // KC_3 - /* 4 */ { { (0)|(4 << 4) }, { 63, 56 }, 4 }, // KC_4 - /* 5 */ { { (0)|(5 << 4) }, { 77, 56 }, 4 }, // KC_5 - /* 6 */ { { (0)|(6 << 4) }, { 91, 56 }, 4 }, // KC_6 - /* 7 */ { { (0)|(7 << 4) }, { 105, 56 }, 4 }, // KC_7 - /* 8 */ { { (0)|(8 << 4) }, { 118, 56 }, 4 }, // KC_8 - /* 9 */ { { (0)|(9 << 4) }, { 132, 56 }, 4 }, // KC_9 - /* 10 */ { { (0)|(10 << 4) }, { 146, 56 }, 4 }, // KC_0 - /* 11 */ { { (0)|(11 << 4) }, { 160, 56 }, 4 }, // KC_MINS - /* 12 */ { { (0)|(12 << 4) }, { 174, 56 }, 4 }, // KC_EQL - /* 13 */ { { (0)|(13 << 4) }, { 195, 56 }, 4 }, // KC_BSPC - /* 14 */ { { (0)|(14 << 4) }, { 215, 56 }, 4 }, // KC_DEL - /* 15 */ { { (1)|(0 << 4) }, { 11, 44 }, 4 }, // KC_TAB - /* 16 */ { { (1)|(1 << 4) }, { 28, 44 }, 4 }, // KC_Q - /* 17 */ { { (1)|(2 << 4) }, { 42, 44 }, 4 }, // KC_W - /* 18 */ { { (1)|(3 << 4) }, { 56, 44 }, 4 }, // KC_E - /* 19 */ { { (1)|(4 << 4) }, { 70, 44 }, 4 }, // KC_R - /* 20 */ { { (1)|(5 << 4) }, { 84, 44 }, 4 }, // KC_T - /* 21 */ { { (1)|(6 << 4) }, { 98, 44 }, 4 }, // KC_Y - /* 22 */ { { (1)|(7 << 4) }, { 112, 44 }, 4 }, // KC_U - /* 23 */ { { (1)|(8 << 4) }, { 125, 44 }, 4 }, // KC_I - /* 24 */ { { (1)|(9 << 4) }, { 139, 44 }, 4 }, // KC_O - /* 25 */ { { (1)|(10 << 4) }, { 153, 44 }, 4 }, // KC_P - /* 26 */ { { (1)|(11 << 4) }, { 167, 44 }, 4 }, // KC_LBRC - /* 27 */ { { (1)|(12 << 4) }, { 181, 44 }, 4 }, // KC_RBRC - /* 28 */ { { (1)|(13 << 4) }, { 198, 44 }, 4 }, // KC_BSLS - /* 29 */ { { (1)|(14 << 4) }, { 215, 44 }, 4 }, // KC_HOME - /* 30 */ { { (2)|(0 << 4) }, { 13, 32 }, 1 }, // KC_CAPS - /* 31 */ { { (2)|(1 << 4) }, { 32, 32 }, 4 }, // KC_A - /* 32 */ { { (2)|(2 << 4) }, { 46, 32 }, 4 }, // KC_S - /* 33 */ { { (2)|(3 << 4) }, { 60, 32 }, 4 }, // KC_D - /* 34 */ { { (2)|(4 << 4) }, { 73, 32 }, 4 }, // KC_F - /* 35 */ { { (2)|(5 << 4) }, { 87, 32 }, 4 }, // KC_G - /* 36 */ { { (2)|(6 << 4) }, { 101, 32 }, 4 }, // KC_H - /* 37 */ { { (2)|(7 << 4) }, { 115, 32 }, 4 }, // KC_J - /* 38 */ { { (2)|(8 << 4) }, { 129, 32 }, 4 }, // KC_K - /* 39 */ { { (2)|(9 << 4) }, { 143, 32 }, 4 }, // KC_L - /* 40 */ { { (2)|(10 << 4) }, { 156, 32 }, 4 }, // KC_SCLN - /* 41 */ { { (2)|(11 << 4) }, { 170, 32 }, 4 }, // KC_QUOT - /* _________________________________________ */ // ____ - /* 42 */ { { (2)|(13 << 4) }, { 193, 32 }, 4 }, // KC_ENT - /* 43 */ { { (2)|(14 << 4) }, { 215, 32 }, 4 }, // KC_PGUP - /* 44 */ { { (3)|(0 << 4) }, { 16, 19 }, 4 }, // KC_LSFT - /* 45 */ { { (3)|(2 << 4) }, { 39, 19 }, 4 }, // KC_Z - /* 46 */ { { (3)|(3 << 4) }, { 53, 19 }, 4 }, // KC_X - /* 47 */ { { (3)|(4 << 4) }, { 67, 19 }, 4 }, // KC_C - /* 48 */ { { (3)|(5 << 4) }, { 80, 19 }, 4 }, // KC_V - /* 49 */ { { (3)|(6 << 4) }, { 94, 19 }, 4 }, // KC_B - /* 50 */ { { (3)|(7 << 4) }, { 108, 19 }, 4 }, // KC_N - /* 51 */ { { (3)|(8 << 4) }, { 122, 19 }, 4 }, // KC_M - /* 52 */ { { (3)|(9 << 4) }, { 136, 19 }, 4 }, // KC_COMM - /* 53 */ { { (3)|(10 << 4) }, { 150, 19 }, 4 }, // KC_DOT - /* 54 */ { { (3)|(11 << 4) }, { 163, 19 }, 4 }, // KC_SLSH - /* 55 */ { { (3)|(12 << 4) }, { 182, 19 }, 4 }, // KC_RSFT - /* _________________________________________ */ // ____ - /* 56 */ { { (3)|(13 << 4) }, { 201, 19 }, 4 }, // KC_UP - /* 57 */ { { (3)|(14 << 4) }, { 215, 19 }, 4 }, // KC_PGDN - /* 58 */ { { (4)|(0 << 4) }, { 9, 7 }, 4 }, // KC_LCTL - /* 59 */ { { (4)|(1 << 4) }, { 27, 7 }, 4 }, // KC_LGUI - /* 60 */ { { (4)|(2 << 4) }, { 44, 7 }, 4 }, // KC_LALT - /* _________________________________________ */ // ____ - /* _________________________________________ */ // ____ - /* _________________________________________ */ // ____ - /* 61 */ { { (4)|(6 << 4) }, { 96, 7 }, 4 }, // KC_SPC - /* _________________________________________ */ // ____ - /* _________________________________________ */ // ____ - /* _________________________________________ */ // ____ - /* 62 */ { { (4)|(10 << 4) }, { 148, 7 }, 4 }, // KC_RALT - /* 63 */ { { (4)|(11 << 4) }, { 165, 7 }, 4 }, // MO(1) - /* 64 */ { { (4)|(12 << 4) }, { 188, 7 }, 4 }, // KC_LEFT - /* 65 */ { { (4)|(13 << 4) }, { 201, 7 }, 4 }, // KC_DOWN - /* 66 */ { { (4)|(14 << 4) }, { 215, 7 }, 4 }, // KC_RGHT - +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, + { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, + { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, NO_LED, 42, 43 }, + { 44, NO_LED, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 }, + { 58, 59, 60, NO_LED, NO_LED, NO_LED, 61, NO_LED, NO_LED, NO_LED, 62, 63, 64, 65, 66 } +}, { + { 8, 56 }, { 22, 56 }, { 35, 56 }, { 49, 56 }, { 63, 56 }, { 77, 56 }, { 91, 56 }, { 105, 56 }, { 118, 56 }, { 132, 56 }, { 146, 56 }, { 160, 56 }, { 174, 56 }, { 195, 56 }, { 215, 56 }, + { 11, 44 }, { 28, 44 }, { 42, 44 }, { 56, 44 }, { 70, 44 }, { 84, 44 }, { 98, 44 }, { 112, 44 }, { 125, 44 }, { 139, 44 }, { 153, 44 }, { 167, 44 }, { 181, 44 }, { 198, 44 }, { 215, 44 }, + { 13, 32 }, { 32, 32 }, { 46, 32 }, { 60, 32 }, { 73, 32 }, { 87, 32 }, { 101, 32 }, { 115, 32 }, { 129, 32 }, { 143, 32 }, { 156, 32 }, { 170, 32 }, { 193, 32 }, { 215, 32 }, { 16, 19 }, + { 39, 19 }, { 53, 19 }, { 67, 19 }, { 80, 19 }, { 94, 19 }, { 108, 19 }, { 122, 19 }, { 136, 19 }, { 150, 19 }, { 163, 19 }, { 182, 19 }, { 201, 19 }, { 215, 19 }, { 9, 7 }, { 27, 7 }, + { 44, 7 }, { 96, 7 }, { 148, 7 }, { 165, 7 }, { 188, 7 }, { 201, 7 }, { 215, 7 }, // Underglow LEDs - { { 255 }, { 1, 1 }, 2 }, - { { 255 }, { 15, 0 }, 2 }, - { { 255 }, { 31, 0 }, 2 }, - { { 255 }, { 47, 0 }, 2 }, - { { 255 }, { 63, 0 }, 2 }, - { { 255 }, { 79, 0 }, 2 }, - { { 255 }, { 95, 0 }, 2 }, - { { 255 }, { 112, 0 }, 2 }, - { { 255 }, { 128, 0 }, 2 }, - { { 255 }, { 144, 0 }, 2 }, - { { 255 }, { 160, 0 }, 2 }, - { { 255 }, { 176, 0 }, 2 }, - { { 255 }, { 192, 0 }, 2 }, - { { 255 }, { 208, 0 }, 2 }, - { { 255 }, { 222, 1 }, 2 }, - { { 255 }, { 224, 13 }, 2 }, - { { 255 }, { 224, 25 }, 2 }, - { { 255 }, { 224, 38 }, 2 }, - { { 255 }, { 224, 50 }, 2 }, - { { 255 }, { 222, 62 }, 2 }, - { { 255 }, { 191, 64 }, 2 }, - { { 255 }, { 179, 64 }, 2 }, - { { 255 }, { 167, 64 }, 2 }, - { { 255 }, { 153, 64 }, 2 }, - { { 255 }, { 139, 64 }, 2 }, - { { 255 }, { 125, 64 }, 2 }, - { { 255 }, { 112, 64 }, 2 }, - { { 255 }, { 98, 64 }, 2 }, - { { 255 }, { 84, 64 }, 2 }, - { { 255 }, { 70, 64 }, 2 }, - { { 255 }, { 56, 64 }, 2 }, - { { 255 }, { 42, 64 }, 2 }, - { { 255 }, { 28, 64 }, 2 }, - { { 255 }, { 1, 62 }, 2 }, - { { 255 }, { 0, 50 }, 2 }, - { { 255 }, { 0, 38 }, 2 }, - { { 255 }, { 0, 25 }, 2 }, - { { 255 }, { 0, 13 }, 2 }, -}; + { 1, 1 }, { 15, 0 }, { 31, 0 }, { 47, 0 }, { 63, 0 }, { 79, 0 }, { 95, 0 }, { 112, 0 }, { 128, 0 }, { 144, 0 }, { 160, 0 }, { 176, 0 }, { 192, 0 }, { 208, 0 }, { 222, 1 }, + { 224, 13 }, { 224, 25 }, { 224, 38 }, { 224, 50 }, { 222, 62 }, { 191, 64 }, { 179, 64 }, { 167, 64 }, { 153, 64 }, { 139, 64 }, { 125, 64 }, { 112, 64 }, { 98, 64 }, { 84, 64 }, { 70, 64 }, + { 56, 64 }, { 42, 64 }, { 28, 64 }, { 1, 62 }, { 0, 50 }, { 0, 38 }, { 0, 25 }, { 0, 13 } +}, { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, + // Underglow LEDs + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2 +} }; + #ifdef USB_LED_INDICATOR_ENABLE void rgb_matrix_indicators_kb(void) diff --git a/keyboards/massdrop/ctrl/config_led.c b/keyboards/massdrop/ctrl/config_led.c index 20d9c649e..5f1c45207 100644 --- a/keyboards/massdrop/ctrl/config_led.c +++ b/keyboards/massdrop/ctrl/config_led.c @@ -5,134 +5,72 @@ #include "rgb_matrix.h" #include "config_led.h" -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 16, 17, 18, 19, 20, 21, 22, 23 }, + { 33, 34, 35, 36, 37, 38, 39, 40 }, + { 50, 51, 52, 53, 54, 55, 56, 57 }, + { 63, 64, 65, 66, 67, 68, 69, 70 }, + { 76, 77, 78, 79, 80, 81, 82, 83 }, + { 8, 9, 10, 11, 12, 13, 14, 15 }, + { 24, 25, 26, 27, 28, 29, 30, 31 }, + { 41, 42, 43, 44, 45, 46, 47, 48 }, + { 58, 59, 60, 61, 62, 75, 49, 32 }, + { 71, 72, 73, 74, 84, 85, 86, NO_LED } +}, { // KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS - { { 0|(0<<4) }, { 7, 5 }, 4 }, - { { 0|(1<<4) }, { 31, 5 }, 4 }, - { { 0|(2<<4) }, { 43, 5 }, 4 }, - { { 0|(3<<4) }, { 55, 5 }, 4 }, - { { 0|(4<<4) }, { 67, 5 }, 4 }, - { { 0|(5<<4) }, { 85, 5 }, 4 }, - { { 0|(6<<4) }, { 97, 5 }, 4 }, - { { 0|(7<<4) }, { 109, 5 }, 4 }, - { { 6|(0<<4) }, { 121, 5 }, 4 }, - { { 6|(1<<4) }, { 139, 5 }, 4 }, - { { 6|(2<<4) }, { 151, 5 }, 4 }, - { { 6|(3<<4) }, { 163, 5 }, 4 }, - { { 6|(4<<4) }, { 175, 5 }, 4 }, - { { 6|(5<<4) }, { 193, 5 }, 4 }, - { { 6|(6<<4) }, { 205, 5 }, 1 }, - { { 6|(7<<4) }, { 217, 5 }, 4 }, + { 7, 5 }, { 31, 5 }, { 43, 5 }, { 55, 5 }, { 67, 5 }, { 85, 5 }, { 97, 5 }, { 109, 5 }, + { 121, 5 }, { 139, 5 }, { 151, 5 }, { 163, 5 }, { 175, 5 }, { 193, 5 }, { 205, 5 }, { 217, 5 }, // KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP - { { 1|(0<<4) }, { 7, 20 }, 4 }, - { { 1|(1<<4) }, { 19, 20 }, 4 }, - { { 1|(2<<4) }, { 31, 20 }, 4 }, - { { 1|(3<<4) }, { 43, 20 }, 4 }, - { { 1|(4<<4) }, { 55, 20 }, 4 }, - { { 1|(5<<4) }, { 67, 20 }, 4 }, - { { 1|(6<<4) }, { 79, 20 }, 4 }, - { { 1|(7<<4) }, { 91, 20 }, 4 }, - { { 7|(0<<4) }, { 103, 20 }, 4 }, - { { 7|(1<<4) }, { 115, 20 }, 4 }, - { { 7|(2<<4) }, { 127, 20 }, 4 }, - { { 7|(3<<4) }, { 139, 20 }, 4 }, - { { 7|(4<<4) }, { 151, 20 }, 4 }, - { { 7|(5<<4) }, { 169, 20 }, 4 }, - { { 7|(6<<4) }, { 193, 20 }, 4 }, - { { 7|(7<<4) }, { 205, 20 }, 4 }, - { { 9|(7<<4) }, { 217, 20 }, 4 }, + { 7, 20 }, { 19, 20 }, { 31, 20 }, { 43, 20 }, { 55, 20 }, { 67, 20 }, { 79, 20 }, { 91, 20 }, + { 103, 20 }, { 115, 20 }, { 127, 20 }, { 139, 20 }, { 151, 20 }, { 169, 20 }, { 193, 20 }, { 205, 20 }, + { 217, 20 }, // KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN - { { 2|(0<<4) }, { 10, 30 }, 4 }, - { { 2|(1<<4) }, { 25, 30 }, 4 }, - { { 2|(2<<4) }, { 37, 30 }, 4 }, - { { 2|(3<<4) }, { 49, 30 }, 4 }, - { { 2|(4<<4) }, { 61, 30 }, 4 }, - { { 2|(5<<4) }, { 73, 30 }, 4 }, - { { 2|(6<<4) }, { 85, 30 }, 4 }, - { { 2|(7<<4) }, { 97, 30 }, 4 }, - { { 8|(0<<4) }, { 109, 30 }, 4 }, - { { 8|(1<<4) }, { 121, 30 }, 4 }, - { { 8|(2<<4) }, { 133, 30 }, 4 }, - { { 8|(3<<4) }, { 145, 30 }, 4 }, - { { 8|(4<<4) }, { 157, 30 }, 4 }, - { { 8|(5<<4) }, { 172, 30 }, 4 }, - { { 8|(6<<4) }, { 193, 30 }, 4 }, - { { 8|(7<<4) }, { 205, 30 }, 4 }, - { { 9|(6<<4) }, { 217, 30 }, 4 }, + { 10, 30 }, { 25, 30 }, { 37, 30 }, { 49, 30 }, { 61, 30 }, { 73, 30 }, { 85, 30 }, { 97, 30 }, + { 109, 30 }, { 121, 30 }, { 133, 30 }, { 145, 30 }, { 157, 30 }, { 172, 30 }, { 193, 30 }, { 205, 30 }, + { 217, 30 }, // KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT - { { 3|(0<<4) }, { 11, 39 }, 1 }, - { { 3|(1<<4) }, { 28, 39 }, 4 }, - { { 3|(2<<4) }, { 40, 39 }, 4 }, - { { 3|(3<<4) }, { 52, 39 }, 4 }, - { { 3|(4<<4) }, { 64, 39 }, 4 }, - { { 3|(5<<4) }, { 76, 39 }, 4 }, - { { 3|(6<<4) }, { 88, 39 }, 4 }, - { { 3|(7<<4) }, { 100, 39 }, 4 }, - { { 9|(0<<4) }, { 112, 39 }, 4 }, - { { 9|(1<<4) }, { 124, 39 }, 4 }, - { { 9|(2<<4) }, { 136, 39 }, 4 }, - { { 9|(3<<4) }, { 148, 39 }, 4 }, - { { 9|(4<<4) }, { 168, 39 }, 4 }, + { 11, 39 }, { 28, 39 }, { 40, 39 }, { 52, 39 }, { 64, 39 }, { 76, 39 }, { 88, 39 }, { 100, 39 }, + { 112, 39 }, { 124, 39 }, { 136, 39 }, { 148, 39 }, { 168, 39 }, // KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP - { { 4|(0<<4) }, { 14, 49 }, 4 }, - { { 4|(1<<4) }, { 34, 49 }, 4 }, - { { 4|(2<<4) }, { 46, 49 }, 4 }, - { { 4|(3<<4) }, { 58, 49 }, 4 }, - { { 4|(4<<4) }, { 70, 49 }, 4 }, - { { 4|(5<<4) }, { 82, 49 }, 4 }, - { { 4|(6<<4) }, { 94, 49 }, 4 }, - { { 4|(7<<4) }, { 106, 49 }, 4 }, - { { 10|(0<<4) }, { 118, 49 }, 4 }, - { { 10|(1<<4) }, { 130, 49 }, 4 }, - { { 10|(2<<4) }, { 142, 49 }, 4 }, - { { 10|(3<<4) }, { 165, 49 }, 4 }, - { { 9|(5<<4) }, { 205, 49 }, 4 }, + { 14, 49 }, { 34, 49 }, { 46, 49 }, { 58, 49 }, { 70, 49 }, { 82, 49 }, { 94, 49 }, { 106, 49 }, + { 118, 49 }, { 130, 49 }, { 142, 49 }, { 165, 49 }, { 205, 49 }, // KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT - { { 5|(0<<4) }, { 8, 59 }, 4 }, - { { 5|(1<<4) }, { 23, 59 }, 4 }, - { { 5|(2<<4) }, { 38, 59 }, 4 }, - { { 5|(3<<4) }, { 83, 59 }, 4 }, - { { 5|(4<<4) }, { 129, 59 }, 4 }, - { { 5|(5<<4) }, { 144, 59 }, 4 }, - { { 5|(6<<4) }, { 159, 59 }, 4 }, - { { 5|(7<<4) }, { 174, 59 }, 4 }, - { { 10|(4<<4) }, { 193, 59 }, 4 }, - { { 10|(5<<4) }, { 205, 59 }, 4 }, - { { 10|(6<<4) }, { 217, 59 }, 4 }, + { 8, 59 }, { 23, 59 }, { 38, 59 }, { 83, 59 }, { 129, 59 }, { 144, 59 }, { 159, 59 }, { 174, 59 }, + { 193, 59 }, { 205, 59 }, { 217, 59 }, // Underglow / Border - { { 0xFF }, { 222, 64 }, 2 }, - { { 0xFF }, { 204, 64 }, 2 }, - { { 0xFF }, { 186, 64 }, 2 }, - { { 0xFF }, { 167, 64 }, 2 }, - { { 0xFF }, { 149, 64 }, 2 }, - { { 0xFF }, { 130, 64 }, 2 }, - { { 0xFF }, { 112, 64 }, 2 }, - { { 0xFF }, { 94, 64 }, 2 }, - { { 0xFF }, { 75, 64 }, 2 }, - { { 0xFF }, { 57, 64 }, 2 }, - { { 0xFF }, { 38, 64 }, 2 }, - { { 0xFF }, { 20, 64 }, 2 }, - { { 0xFF }, { 0, 64 }, 2 }, - { { 0xFF }, { 0, 47 }, 2 }, - { { 0xFF }, { 0, 32 }, 2 }, - { { 0xFF }, { 0, 17 }, 2 }, - { { 0xFF }, { 0, 0 }, 2 }, - { { 0xFF }, { 20, 0 }, 2 }, - { { 0xFF }, { 38, 0 }, 2 }, - { { 0xFF }, { 57, 0 }, 2 }, - { { 0xFF }, { 75, 0 }, 2 }, - { { 0xFF }, { 94, 0 }, 2 }, - { { 0xFF }, { 112, 0 }, 2 }, - { { 0xFF }, { 130, 0 }, 2 }, - { { 0xFF }, { 149, 0 }, 2 }, - { { 0xFF }, { 167, 0 }, 2 }, - { { 0xFF }, { 186, 0 }, 2 }, - { { 0xFF }, { 204, 0 }, 2 }, - { { 0xFF }, { 222, 1 }, 2 }, - { { 0xFF }, { 224, 17 }, 2 }, - { { 0xFF }, { 224, 32 }, 2 }, - { { 0xFF }, { 224, 47 }, 2 }, -}; + { 222, 64 }, { 204, 64 }, { 186, 64 }, { 167, 64 }, { 149, 64 }, { 130, 64 }, { 112, 64 }, { 94, 64 }, + { 75, 64 }, { 57, 64 }, { 38, 64 }, { 20, 64 }, { 0, 64 }, { 0, 47 }, { 0, 32 }, { 0, 17 }, + { 0, 0 }, { 20, 0 }, { 38, 0 }, { 57, 0 }, { 75, 0 }, { 94, 0 }, { 112, 0 }, { 130, 0 }, + { 149, 0 }, { 167, 0 }, { 186, 0 }, { 204, 0 }, { 222, 1 }, { 224, 17 }, { 224, 32 }, { 224, 47 } +}, { + // KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 1, 4, + // KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, + // KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, + // KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT + 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, + // KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, + // KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, + // Underglow / Border + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2 +} }; + #ifdef USB_LED_INDICATOR_ENABLE void rgb_matrix_indicators_kb(void) diff --git a/keyboards/model01/leds.c b/keyboards/model01/leds.c index 0abc1f0da..b21c1a5c8 100644 --- a/keyboards/model01/leds.c +++ b/keyboards/model01/leds.c @@ -46,72 +46,35 @@ void set_led_to(int led, uint8_t r, uint8_t g, uint8_t b) { #ifdef RGB_MATRIX_ENABLE __attribute__ ((weak)) -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - {{0x73}, { 3, 35}, 4}, - {{0x72}, { 0, 26}, 4}, - {{0x71}, { 0, 17}, 4}, - {{0x70}, { 0, 6}, 4}, - {{0x60}, { 14, 5}, 4}, - {{0x61}, { 15, 16}, 4}, - {{0x62}, { 16, 25}, 4}, - {{0x63}, { 17, 34}, 4}, - {{0x53}, { 31, 29}, 4}, - {{0x52}, { 31, 19}, 4}, - {{0x51}, { 30, 11}, 4}, - {{0x50}, { 30, 1}, 4}, - {{0x40}, { 45, 0}, 4}, - {{0x41}, { 45, 8}, 4}, - {{0x42}, { 46, 17}, 4}, - {{0x43}, { 46, 27}, 4}, - {{0x33}, { 60, 27}, 4}, - {{0x32}, { 60, 18}, 4}, - {{0x31}, { 60, 9}, 4}, - {{0x30}, { 60, 0}, 4}, - {{0x20}, { 74, 2}, 4}, - {{0x21}, { 74, 11}, 4}, - {{0x22}, { 75, 20}, 4}, - {{0x23}, { 74, 28}, 4}, - {{0x12}, { 89, 30}, 4}, - {{0x11}, { 89, 19}, 4}, - {{0x10}, { 89, 7}, 4}, - {{0x00}, { 70, 38}, 1}, - {{0x01}, { 82, 41}, 1}, - {{0x02}, { 93, 45}, 1}, - {{0x03}, {104, 50}, 1}, - {{0x13}, { 74, 64}, 1}, - {{0x67}, {149, 64}, 1}, - {{0x77}, {119, 50}, 1}, - {{0x76}, {130, 45}, 1}, - {{0x75}, {141, 41}, 1}, - {{0x74}, {153, 38}, 1}, - {{0x64}, {134, 7}, 4}, - {{0x65}, {134, 19}, 4}, - {{0x66}, {134, 30}, 4}, - {{0x57}, {149, 28}, 4}, - {{0x56}, {148, 20}, 4}, - {{0x55}, {149, 11}, 4}, - {{0x54}, {149, 2}, 4}, - {{0x44}, {163, 0}, 4}, - {{0x45}, {163, 9}, 4}, - {{0x46}, {163, 18}, 4}, - {{0x47}, {163, 27}, 4}, - {{0x37}, {177, 27}, 4}, - {{0x36}, {177, 17}, 4}, - {{0x35}, {178, 8}, 4}, - {{0x34}, {178, 0}, 4}, - {{0x24}, {193, 1}, 4}, - {{0x25}, {193, 11}, 4}, - {{0x26}, {192, 19}, 4}, - {{0x27}, {192, 29}, 4}, - {{0x17}, {206, 34}, 4}, - {{0x16}, {207, 25}, 4}, - {{0x15}, {208, 16}, 4}, - {{0x14}, {209, 5}, 4}, - {{0x04}, {224, 6}, 4}, - {{0x05}, {223, 17}, 4}, - {{0x06}, {223, 26}, 4}, - {{0x07}, {220, 35}, 4}, -}; +led_config_t g_led_config = { { + { 27, 26, 20, 19, 12, 11, 4, 3 }, + { 28, 25, 21, 18, 13, 10, 5, 2 }, + { 29, 24, 22, 17, 14, 9, 6, 1 }, + { 30, 31, 23, 16, 15, 8, 7, 0 }, + { 60, 59, 52, 51, 44, 43, 37, 36 }, + { 61, 58, 53, 50, 45, 42, 38, 35 }, + { 62, 57, 54, 49, 46, 41, 39, 34 }, + { 63, 56, 55, 48, 47, 40, 32, 33 } +}, { + { 3, 35 }, { 0, 26 }, { 0, 17 }, { 0, 6 }, { 14, 5 }, { 15, 16 }, { 16, 25 }, { 17, 34 }, + { 31, 29 }, { 31, 19 }, { 30, 11 }, { 30, 1 }, { 45, 0 }, { 45, 8 }, { 46, 17 }, { 46, 27 }, + { 60, 27 }, { 60, 18 }, { 60, 9 }, { 60, 0 }, { 74, 2 }, { 74, 11 }, { 75, 20 }, { 74, 28 }, + { 89, 30 }, { 89, 19 }, { 89, 7 }, { 70, 38 }, { 82, 41 }, { 93, 45 }, { 104, 50 }, { 74, 64 }, + { 149, 64 }, { 119, 50 }, { 130, 45 }, { 141, 41 }, { 153, 38 }, { 134, 7 }, { 134, 19 }, { 134, 30 }, + { 149, 28 }, { 148, 20 }, { 149, 11 }, { 149, 2 }, { 163, 0 }, { 163, 9 }, { 163, 18 }, { 163, 27 }, + { 177, 27 }, { 177, 17 }, { 178, 8 }, { 178, 0 }, { 193, 1 }, { 193, 11 }, { 192, 19 }, { 192, 29 }, + { 206, 34 }, { 207, 25 }, { 208, 16 }, { 209, 5 }, { 224, 6 }, { 223, 17 }, { 223, 26 }, { 220, 35 } +}, { + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4 +} }; + static struct { uint8_t b; diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c index 94f507189..3ad694c4a 100644 --- a/keyboards/planck/ez/ez.c +++ b/keyboards/planck/ez/ez.c @@ -79,63 +79,27 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5 }, + { 12, 13, 14, 15, 16, 17 }, + { 24, 25, 26, 27, 28, 29 }, + { 36, 37, 38, 45, 46, NO_LED }, + { 6, 7, 8, 9, 10, 11 }, + { 18, 19, 20, 21, 22, 23 }, + { 30, 31, 32, 33, 34, 35 }, + { 42, 43, 44, 39, 40, 41 } +}, { + { 0, 0 }, { 20, 0 }, { 40, 0 }, { 61, 0 }, { 81, 0 }, { 101, 0 }, { 122, 0 }, { 142, 0 }, { 162, 0 }, { 183, 0 }, { 203, 0 }, { 223, 0 }, + { 0, 21 }, { 20, 21 }, { 40, 21 }, { 61, 21 }, { 81, 21 }, { 101, 21 }, { 122, 21 }, { 142, 21 }, { 162, 21 }, { 183, 21 }, { 203, 21 }, { 223, 21 }, + { 0, 42 }, { 20, 42 }, { 40, 42 }, { 61, 42 }, { 81, 42 }, { 101, 42 }, { 122, 42 }, { 142, 42 }, { 162, 42 }, { 183, 42 }, { 203, 42 }, { 223, 42 }, + { 0, 63 }, { 20, 63 }, { 40, 63 }, { 61, 63 }, { 81, 63 }, { 111, 63 }, { 142, 63 }, { 162, 63 }, { 183, 63 }, { 203, 63 }, { 223, 63 } +}, { + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1 +} }; - /*{row | col << 4} - | {x=0..224, y=0..64} - | | flags - | | | */ - {{0|(0<<4)}, {20.36*0, 21.33*0}, 1}, - {{0|(1<<4)}, {20.36*1, 21.33*0}, 4}, - {{0|(2<<4)}, {20.36*2, 21.33*0}, 4}, - {{0|(3<<4)}, {20.36*3, 21.33*0}, 4}, - {{0|(4<<4)}, {20.36*4, 21.33*0}, 4}, - {{0|(5<<4)}, {20.36*5, 21.33*0}, 4}, - {{4|(0<<4)}, {20.36*6, 21.33*0}, 4}, - {{4|(1<<4)}, {20.36*7, 21.33*0}, 4}, - {{4|(2<<4)}, {20.36*8, 21.33*0}, 4}, - {{4|(3<<4)}, {20.36*9, 21.33*0}, 4}, - {{4|(4<<4)}, {20.36*10,21.33*0}, 4}, - {{4|(5<<4)}, {20.36*11,21.33*0}, 1}, - - {{1|(0<<4)}, {20.36*0, 21.33*1}, 1}, - {{1|(1<<4)}, {20.36*1, 21.33*1}, 4}, - {{1|(2<<4)}, {20.36*2, 21.33*1}, 4}, - {{1|(3<<4)}, {20.36*3, 21.33*1}, 4}, - {{1|(4<<4)}, {20.36*4, 21.33*1}, 4}, - {{1|(5<<4)}, {20.36*5, 21.33*1}, 4}, - {{5|(0<<4)}, {20.36*6, 21.33*1}, 4}, - {{5|(1<<4)}, {20.36*7, 21.33*1}, 4}, - {{5|(2<<4)}, {20.36*8, 21.33*1}, 4}, - {{5|(3<<4)}, {20.36*9, 21.33*1}, 4}, - {{5|(4<<4)}, {20.36*10,21.33*1}, 4}, - {{5|(5<<4)}, {20.36*11,21.33*1}, 1}, - - {{2|(0<<4)}, {20.36*0, 21.33*2}, 1}, - {{2|(1<<4)}, {20.36*1, 21.33*2}, 4}, - {{2|(2<<4)}, {20.36*2, 21.33*2}, 4}, - {{2|(3<<4)}, {20.36*3, 21.33*2}, 4}, - {{2|(4<<4)}, {20.36*4, 21.33*2}, 4}, - {{2|(5<<4)}, {20.36*5, 21.33*2}, 4}, - {{6|(0<<4)}, {20.36*6, 21.33*2}, 4}, - {{6|(1<<4)}, {20.36*7, 21.33*2}, 4}, - {{6|(2<<4)}, {20.36*8, 21.33*2}, 4}, - {{6|(3<<4)}, {20.36*9, 21.33*2}, 4}, - {{6|(4<<4)}, {20.36*10,21.33*2}, 4}, - {{6|(5<<4)}, {20.36*11,21.33*2}, 1}, - - {{3|(0<<4)}, {20.36*0, 21.33*3}, 1}, - {{3|(1<<4)}, {20.36*1, 21.33*3}, 1}, - {{3|(2<<4)}, {20.36*2, 21.33*3}, 1}, - {{7|(3<<4)}, {20.36*3, 21.33*3}, 1}, - {{7|(4<<4)}, {20.36*4, 21.33*3}, 1}, - {{7|(5<<4)}, {20.36*5.5,21.33*3}, 4}, - {{7|(0<<4)}, {20.36*7, 21.33*3}, 1}, - {{7|(1<<4)}, {20.36*8, 21.33*3}, 1}, - {{7|(2<<4)}, {20.36*9, 21.33*3}, 1}, - {{3|(3<<4)}, {20.36*10,21.33*3}, 1}, - {{3|(4<<4)}, {20.36*11,21.33*3}, 1} -}; void matrix_init_kb(void) { matrix_init_user(); diff --git a/keyboards/planck/keymaps/tom/keymap.c b/keyboards/planck/keymaps/tom/keymap.c index 5b7177c6c..0ffff4e69 100644 --- a/keyboards/planck/keymaps/tom/keymap.c +++ b/keyboards/planck/keymaps/tom/keymap.c @@ -224,14 +224,16 @@ bool music_mask_user(uint16_t keycode) { } } +#ifdef RGB_MATRIX_ENABLE +extern led_config_t g_led_config; +#endif + void rgb_matrix_indicators_user(void) { #ifdef RGB_MATRIX_ENABLE - rgb_led led; switch (biton32(layer_state)) { case _RAISE: for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color(i, 0x6B, 0x00, 0x80); } else { rgb_matrix_set_color(i, 0x00, 0xFF, 0x00); @@ -241,8 +243,7 @@ void rgb_matrix_indicators_user(void) { case _LOWER: for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color(i, 0xFF, 0xA5, 0x00); } else { rgb_matrix_set_color(i, 0x00, 0x67, 0xC7); diff --git a/keyboards/planck/light/light.c b/keyboards/planck/light/light.c index 178d28274..896ec4458 100644 --- a/keyboards/planck/light/light.c +++ b/keyboards/planck/light/light.c @@ -77,65 +77,24 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, C9_14, C8_14, C7_14} }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - - /*{row | col << 4} - | {x=0..224, y=0..64} - | | flags - | | | */ - {{0|(0<<4)}, {20.36*0, 21.33*0}, 1}, - {{0|(1<<4)}, {20.36*1, 21.33*0}, 4}, - {{0|(2<<4)}, {20.36*2, 21.33*0}, 4}, - {{0|(3<<4)}, {20.36*3, 21.33*0}, 4}, - {{0|(4<<4)}, {20.36*4, 21.33*0}, 4}, - {{0|(5<<4)}, {20.36*5, 21.33*0}, 4}, - {{0|(6<<4)}, {20.36*6, 21.33*0}, 4}, - {{0|(7<<4)}, {20.36*7, 21.33*0}, 4}, - {{0|(8<<4)}, {20.36*8, 21.33*0}, 4}, - {{0|(9<<4)}, {20.36*9, 21.33*0}, 4}, - {{0|(10<<4)}, {20.36*10,21.33*0}, 4}, - {{0|(11<<4)}, {20.36*11,21.33*0}, 1}, - - {{1|(0<<4)}, {20.36*0, 21.33*1}, 1}, - {{1|(1<<4)}, {20.36*1, 21.33*1}, 4}, - {{1|(2<<4)}, {20.36*2, 21.33*1}, 4}, - {{1|(3<<4)}, {20.36*3, 21.33*1}, 4}, - {{1|(4<<4)}, {20.36*4, 21.33*1}, 4}, - {{1|(5<<4)}, {20.36*5, 21.33*1}, 4}, - {{1|(6<<4)}, {20.36*6, 21.33*1}, 4}, - {{1|(7<<4)}, {20.36*7, 21.33*1}, 4}, - {{1|(8<<4)}, {20.36*8, 21.33*1}, 4}, - {{1|(9<<4)}, {20.36*9, 21.33*1}, 4}, - {{1|(10<<4)}, {20.36*10,21.33*1}, 4}, - {{1|(11<<4)}, {20.36*11,21.33*1}, 1}, - - {{2|(0<<4)}, {20.36*0, 21.33*2}, 1}, - {{2|(1<<4)}, {20.36*1, 21.33*2}, 4}, - {{2|(2<<4)}, {20.36*2, 21.33*2}, 4}, - {{2|(3<<4)}, {20.36*3, 21.33*2}, 4}, - {{2|(4<<4)}, {20.36*4, 21.33*2}, 4}, - {{2|(5<<4)}, {20.36*5, 21.33*2}, 4}, - {{2|(6<<4)}, {20.36*6, 21.33*2}, 4}, - {{2|(7<<4)}, {20.36*7, 21.33*2}, 4}, - {{2|(8<<4)}, {20.36*8, 21.33*2}, 4}, - {{2|(9<<4)}, {20.36*9, 21.33*2}, 4}, - {{2|(10<<4)}, {20.36*10,21.33*2}, 4}, - {{2|(11<<4)}, {20.36*11,21.33*2}, 1}, - - {{3|(0<<4)}, {20.36*0, 21.33*3}, 1}, - {{3|(1<<4)}, {20.36*1, 21.33*3}, 1}, - {{3|(2<<4)}, {20.36*2, 21.33*3}, 1}, - {{3|(3<<4)}, {20.36*3, 21.33*3}, 1}, - {{3|(4<<4)}, {20.36*4, 21.33*3}, 1}, - {{3|(5<<4)}, {20.36*5, 21.33*3}, 4}, - {{3|(5<<4)}, {20.36*5.5,21.33*3}, 4}, - {{3|(6<<4)}, {20.36*6, 21.33*3}, 4}, - {{3|(7<<4)}, {20.36*7, 21.33*3}, 1}, - {{3|(8<<4)}, {20.36*8, 21.33*3}, 1}, - {{3|(9<<4)}, {20.36*9, 21.33*3}, 1}, - {{3|(10<<4)}, {20.36*10,21.33*3}, 1}, - {{3|(11<<4)}, {20.36*11,21.33*3}, 1} -}; +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, + { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, + { 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 }, + { 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48 } +}, { + { 0, 0 }, { 20, 0 }, { 40, 0 }, { 61, 0 }, { 81, 0 }, { 101, 0 }, { 122, 0 }, { 142, 0 }, { 162, 0 }, { 183, 0 }, { 203, 0 }, { 223, 0 }, + { 0, 21 }, { 20, 21 }, { 40, 21 }, { 61, 21 }, { 81, 21 }, { 101, 21 }, { 122, 21 }, { 142, 21 }, { 162, 21 }, { 183, 21 }, { 203, 21 }, { 223, 21 }, + { 0, 42 }, { 20, 42 }, { 40, 42 }, { 61, 42 }, { 81, 42 }, { 101, 42 }, { 122, 42 }, { 142, 42 }, { 162, 42 }, { 183, 42 }, { 203, 42 }, { 223, 42 }, + { 0, 63 }, { 20, 63 }, { 40, 63 }, { 61, 63 }, { 81, 63 }, { 101, 63 }, { 111, 63 }, { 122, 63 }, { 142, 63 }, { 162, 63 }, { 183, 63 }, { 203, 63 }, + { 223, 63 } +}, { + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, + 1 +} }; void matrix_init_kb(void) { @@ -151,6 +110,16 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) return process_record_user(keycode, record); } +uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { + // Spacebar has 2 leds 41 & 42, so add 42 to the array here, and 41 will be added + // by the default lookup code that runs after this + if (row == 3 && column == 5) { + led_i[0] = 42; + return 1; + } + return 0; +} + void matrix_scan_kb(void) { matrix_scan_user(); diff --git a/keyboards/sol/rev1/rev1.c b/keyboards/sol/rev1/rev1.c index 23896860e..68e64af79 100644 --- a/keyboards/sol/rev1/rev1.c +++ b/keyboards/sol/rev1/rev1.c @@ -1,83 +1,46 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5, 6 }, + { 7, 8, 9, 10, 11, 12, 13 }, + { 14, 15, 16, 17, 18, 19, 20 }, + { 21, 22, 23, 24, 25, 26, 27 }, + { 28, 29, 30, 31, 32, 33, 34 }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 33, 34 }, + { 35, 36, 37, 38, 39, 40, 41 }, + { 42, 43, 44, 45, 46, 47, 48 }, + { 49, 50, 51, 52, 53, 54, 55 }, + { 56, 57, 58, 59, 60, 61, 62 }, + { 63, 64, 65, 66, 67, 68, 68 }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 68, 68 } +}, { // Left Hand Mapped Left to Right - { { 0 | (0 << 4) }, { 0, 0 }, 1}, - { { 0 | (1 << 4) }, { 22, 0 }, 4}, - { { 0 | (2 << 4) }, { 37, 0 }, 4}, - { { 0 | (3 << 4) }, { 37, 0 }, 4}, - { { 0 | (4 << 4) }, { 67, 0 }, 4}, - { { 0 | (5 << 4) }, { 82, 0 }, 4}, - { { 0 | (6 << 4) }, { 104, 0 }, 1}, - { { 1 | (0 << 4) }, { 0, 16 }, 1}, - { { 1 | (1 << 4) }, { 22, 16 }, 4}, - { { 1 | (2 << 4) }, { 37, 16 }, 4}, - { { 1 | (3 << 4) }, { 37, 16 }, 4}, - { { 1 | (4 << 4) }, { 67, 16 }, 4}, - { { 1 | (5 << 4) }, { 82, 16 }, 4}, - { { 1 | (6 << 4) }, { 104, 16 }, 1}, - { { 2 | (0 << 4) }, { 0, 32 }, 1}, - { { 2 | (1 << 4) }, { 22, 32 }, 4}, - { { 2 | (2 << 4) }, { 37, 32 }, 4}, - { { 2 | (3 << 4) }, { 37, 32 }, 4}, - { { 2 | (4 << 4) }, { 67, 32 }, 4}, - { { 2 | (5 << 4) }, { 82, 32 }, 4}, - { { 2 | (6 << 4) }, { 104, 32 }, 1}, - { { 3 | (0 << 4) }, { 0, 48 }, 1}, - { { 3 | (1 << 4) }, { 22, 48 }, 4}, - { { 3 | (2 << 4) }, { 37, 48 }, 4}, - { { 3 | (3 << 4) }, { 37, 48 }, 4}, - { { 3 | (4 << 4) }, { 67, 48 }, 4}, - { { 3 | (5 << 4) }, { 82, 48 }, 4}, - { { 3 | (6 << 4) }, { 104, 48 }, 1}, - { { 4 | (0 << 4) }, { 0, 64 }, 1}, - { { 4 | (1 << 4) }, { 22, 64 }, 1}, - { { 4 | (2 << 4) }, { 37, 64 }, 1}, - { { 4 | (3 << 4) }, { 37, 64 }, 1}, - { { 4 | (4 << 4) }, { 67, 64 }, 1}, - // These two control the 4 LEDs in the thumb cluster - // Top keys are { 4 | (5 << 4) & { 4 | (6 << 4) - { { 5 | (5 << 4) }, { 89, 45 }, 1}, - { { 5 | (6 << 4) }, { 97, 55 }, 1}, + { 0, 0 }, { 22, 0 }, { 37, 0 }, { 37, 0 }, { 67, 0 }, { 82, 0 }, { 104, 0 }, + { 0, 16 }, { 22, 16 }, { 37, 16 }, { 37, 16 }, { 67, 16 }, { 82, 16 }, { 104, 16 }, + { 0, 32 }, { 22, 32 }, { 37, 32 }, { 37, 32 }, { 67, 32 }, { 82, 32 }, { 104, 32 }, + { 0, 48 }, { 22, 48 }, { 37, 48 }, { 37, 48 }, { 67, 48 }, { 82, 48 }, { 104, 48 }, + { 0, 64 }, { 22, 64 }, { 37, 64 }, { 37, 64 }, { 67, 64 }, { 89, 45 }, { 97, 55 }, // Left Hand Mapped Right to Left - { { 6 | (0 << 4) }, { 224, 0 }, 1}, - { { 6 | (1 << 4) }, { 202, 0 }, 4}, - { { 6 | (2 << 4) }, { 187, 0 }, 4}, - { { 6 | (3 << 4) }, { 172, 0 }, 4}, - { { 6 | (4 << 4) }, { 157, 0 }, 4}, - { { 6 | (5 << 4) }, { 142, 0 }, 4}, - { { 6 | (6 << 4) }, { 120, 0 }, 1}, - { { 7 | (0 << 4) }, { 224, 16 }, 1}, - { { 7 | (1 << 4) }, { 202, 16 }, 4}, - { { 7 | (2 << 4) }, { 187, 16 }, 4}, - { { 7 | (3 << 4) }, { 172, 16 }, 4}, - { { 7 | (4 << 4) }, { 157, 16 }, 4}, - { { 7 | (5 << 4) }, { 142, 16 }, 4}, - { { 7 | (6 << 4) }, { 120, 16 }, 1}, - { { 8 | (0 << 4) }, { 224, 32 }, 1}, - { { 8 | (1 << 4) }, { 202, 32 }, 4}, - { { 8 | (2 << 4) }, { 187, 32 }, 4}, - { { 8 | (3 << 4) }, { 172, 32 }, 4}, - { { 8 | (4 << 4) }, { 157, 32 }, 4}, - { { 8 | (5 << 4) }, { 142, 32 }, 4}, - { { 8 | (6 << 4) }, { 120, 32 }, 1}, - { { 9 | (0 << 4) }, { 224, 48 }, 1}, - { { 9 | (1 << 4) }, { 202, 48 }, 4}, - { { 9 | (2 << 4) }, { 187, 48 }, 4}, - { { 9 | (3 << 4) }, { 172, 48 }, 4}, - { { 9 | (4 << 4) }, { 157, 48 }, 4}, - { { 9 | (5 << 4) }, { 142, 48 }, 4}, - { { 9 | (6 << 4) }, { 120, 48 }, 1}, - { { 10 | (0 << 4) }, { 224, 64 }, 1}, - { { 10 | (1 << 4) }, { 202, 64 }, 1}, - { { 10 | (2 << 4) }, { 187, 64 }, 1}, - { { 10 | (3 << 4) }, { 172, 64 }, 1}, - { { 10 | (4 << 4) }, { 157, 64 }, 1}, - // These two control the 4 LEDs in the thumb cluster - // Top keys are { 10 | (5 << 4) & { 10 | (6 << 4) - { { 11 | (5 << 4) }, { 135, 45 }, 1}, - { { 11 | (6 << 4) }, { 127, 55 }, 1} - }; + { 224, 0 }, { 202, 0 }, { 187, 0 }, { 172, 0 }, { 157, 0 }, { 142, 0 }, { 120, 0 }, + { 224, 16 }, { 202, 16 }, { 187, 16 }, { 172, 16 }, { 157, 16 }, { 142, 16 }, { 120, 16 }, + { 224, 32 }, { 202, 32 }, { 187, 32 }, { 172, 32 }, { 157, 32 }, { 142, 32 }, { 120, 32 }, + { 224, 48 }, { 202, 48 }, { 187, 48 }, { 172, 48 }, { 157, 48 }, { 142, 48 }, { 120, 48 }, + { 224, 64 }, { 202, 64 }, { 187, 64 }, { 172, 64 }, { 157, 64 }, { 135, 45 }, { 127, 55 } +}, { + // Left Hand Mapped Left to Right + 1, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1, + // Left Hand Mapped Right to Left + 1, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1 +} }; + #endif diff --git a/keyboards/sol/sol.c b/keyboards/sol/sol.c index a65d4c15f..5945cc60a 100644 --- a/keyboards/sol/sol.c +++ b/keyboards/sol/sol.c @@ -1,20 +1 @@ #include "sol.h" - -#if defined(RGB_MATRIX_ENABLE) -uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { - if (row == 4 && column == 5) { - led_i[0] = 33; - return 1; - } else if (row == 4 && column == 6) { - led_i[0] = 34; - return 1; - } else if (row == 10 && column == 5) { - led_i[0] = 68; - return 1; - } else if (row == 10 && column == 6) { - led_i[0] = 69; - return 1; - } - return 0; -} -#endif diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index eeb21501b..3cfce966b 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -403,11 +403,10 @@ void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } -void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) { - rgb_led led; +extern led_config_t g_led_config; +void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 5eef2e023..e8dc185a1 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -184,11 +184,10 @@ void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 5528a0834..edbcee9cd 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -105,6 +105,7 @@ bool g_suspend_state = false; +extern led_config_t g_led_config; rgb_config_t rgb_matrix_config; rgb_counters_t g_rgb_counters; @@ -150,14 +151,11 @@ uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t } uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) { - // TODO: This is kinda expensive, fix this soonish uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL && led_count < LED_HITS_TO_REMEMBER; i++) { - matrix_co_t matrix_co = g_rgb_leds[i].matrix_co; - if (row == matrix_co.row && column == matrix_co.col) { - led_i[led_count] = i; - led_count++; - } + uint8_t led_index = g_led_config.matrix_co[row][column]; + if (led_index != NO_LED) { + led_i[led_count] = led_index; + led_count++; } return led_count; } @@ -201,8 +199,8 @@ bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { for(uint8_t i = 0; i < led_count; i++) { uint8_t index = last_hit_buffer.count; - last_hit_buffer.x[index] = g_rgb_leds[led[i]].point.x; - last_hit_buffer.y[index] = g_rgb_leds[led[i]].point.y; + last_hit_buffer.x[index] = g_led_config.point[led[i]].x; + last_hit_buffer.y[index] = g_led_config.point[led[i]].y; last_hit_buffer.index[index] = led[i]; last_hit_buffer.tick[index] = 0; last_hit_buffer.count++; diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index 33665ffff..365a92bbf 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h @@ -54,9 +54,7 @@ uint8_t max = DRIVER_LED_TOTAL; #endif -#define RGB_MATRIX_TEST_LED_FLAGS() if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) continue - -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +#define RGB_MATRIX_TEST_LED_FLAGS() if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue typedef struct { diff --git a/quantum/rgb_matrix_animations/alpha_mods_anim.h b/quantum/rgb_matrix_animations/alpha_mods_anim.h index 4bd01c4fc..d7f6f4655 100644 --- a/quantum/rgb_matrix_animations/alpha_mods_anim.h +++ b/quantum/rgb_matrix_animations/alpha_mods_anim.h @@ -1,7 +1,7 @@ #pragma once #ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; // alphas = color1, mods = color2 @@ -15,7 +15,7 @@ bool rgb_matrix_alphas_mods(effect_params_t* params) { for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - if (HAS_FLAGS(g_rgb_leds[i].flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b); } else { rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b); diff --git a/quantum/rgb_matrix_animations/cycle_all_anim.h b/quantum/rgb_matrix_animations/cycle_all_anim.h index 513dff128..e93798f90 100644 --- a/quantum/rgb_matrix_animations/cycle_all_anim.h +++ b/quantum/rgb_matrix_animations/cycle_all_anim.h @@ -2,7 +2,7 @@ #ifndef DISABLE_RGB_MATRIX_CYCLE_ALL extern rgb_counters_t g_rgb_counters; -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_cycle_all(effect_params_t* params) { diff --git a/quantum/rgb_matrix_animations/cycle_left_right_anim.h b/quantum/rgb_matrix_animations/cycle_left_right_anim.h index 428adea22..4b09d5826 100644 --- a/quantum/rgb_matrix_animations/cycle_left_right_anim.h +++ b/quantum/rgb_matrix_animations/cycle_left_right_anim.h @@ -2,7 +2,7 @@ #ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT extern rgb_counters_t g_rgb_counters; -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_cycle_left_right(effect_params_t* params) { @@ -12,8 +12,7 @@ bool rgb_matrix_cycle_left_right(effect_params_t* params) { uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - point_t point = g_rgb_leds[i].point; - hsv.h = point.x - time; + hsv.h = g_led_config.point[i].x - time; RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/quantum/rgb_matrix_animations/cycle_up_down_anim.h b/quantum/rgb_matrix_animations/cycle_up_down_anim.h index ea63095d2..403214bb7 100644 --- a/quantum/rgb_matrix_animations/cycle_up_down_anim.h +++ b/quantum/rgb_matrix_animations/cycle_up_down_anim.h @@ -2,7 +2,7 @@ #ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN extern rgb_counters_t g_rgb_counters; -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_cycle_up_down(effect_params_t* params) { @@ -12,8 +12,7 @@ bool rgb_matrix_cycle_up_down(effect_params_t* params) { uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - point_t point = g_rgb_leds[i].point; - hsv.h = point.y - time; + hsv.h = g_led_config.point[i].y - time; RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/quantum/rgb_matrix_animations/dual_beacon_anim.h b/quantum/rgb_matrix_animations/dual_beacon_anim.h index 00f6e5088..dcb594029 100644 --- a/quantum/rgb_matrix_animations/dual_beacon_anim.h +++ b/quantum/rgb_matrix_animations/dual_beacon_anim.h @@ -2,7 +2,7 @@ #ifndef DISABLE_RGB_MATRIX_DUAL_BEACON extern rgb_counters_t g_rgb_counters; -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_dual_beacon(effect_params_t* params) { @@ -14,8 +14,7 @@ bool rgb_matrix_dual_beacon(effect_params_t* params) { int8_t sin_value = sin8(time) - 128; for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - point_t point = g_rgb_leds[i].point; - hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue; + hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (g_led_config.point[i].x - 112) * sin_value) / 128 + rgb_matrix_config.hue; RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/quantum/rgb_matrix_animations/gradient_up_down_anim.h b/quantum/rgb_matrix_animations/gradient_up_down_anim.h index 05117540a..7a6ed1421 100644 --- a/quantum/rgb_matrix_animations/gradient_up_down_anim.h +++ b/quantum/rgb_matrix_animations/gradient_up_down_anim.h @@ -1,7 +1,7 @@ #pragma once #ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_gradient_up_down(effect_params_t* params) { @@ -11,10 +11,9 @@ bool rgb_matrix_gradient_up_down(effect_params_t* params) { uint8_t scale = scale8(64, rgb_matrix_config.speed); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - point_t point = g_rgb_leds[i].point; // The y range will be 0..64, map this to 0..4 // Relies on hue being 8-bit and wrapping - hsv.h = rgb_matrix_config.hue + scale * (point.y >> 4); + hsv.h = rgb_matrix_config.hue + scale * (g_led_config.point[i].y >> 4); RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h index dffa53264..5ea971435 100644 --- a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h +++ b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h @@ -2,11 +2,11 @@ #ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS extern rgb_counters_t g_rgb_counters; -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; static void jellybean_raindrops_set_color(int i, effect_params_t* params) { - if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) return; + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val }; RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); diff --git a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h index 89f6965c3..d46288073 100644 --- a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h @@ -2,7 +2,7 @@ #ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON extern rgb_counters_t g_rgb_counters; -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_rainbow_beacon(effect_params_t* params) { @@ -14,8 +14,7 @@ bool rgb_matrix_rainbow_beacon(effect_params_t* params) { int16_t sin_value = 2 * (sin8(time) - 128); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - point_t point = g_rgb_leds[i].point; - hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue; + hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (g_led_config.point[i].x - 112) * sin_value) / 128 + rgb_matrix_config.hue; RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h index 0d57aef57..3b7d9689f 100644 --- a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h @@ -2,7 +2,7 @@ #ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON extern rgb_counters_t g_rgb_counters; -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) { @@ -12,8 +12,7 @@ bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) { uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - point_t point = g_rgb_leds[i].point; - hsv.h = abs8(point.y - 32) + (point.x - time) + rgb_matrix_config.hue; + hsv.h = abs8(g_led_config.point[i].y - 32) + (g_led_config.point[i].x - time) + rgb_matrix_config.hue; RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h index 03652758c..e92f35176 100644 --- a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h @@ -2,7 +2,7 @@ #ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS extern rgb_counters_t g_rgb_counters; -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) { @@ -14,8 +14,7 @@ bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) { int16_t sin_value = 3 * (sin8(time) - 128); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - point_t point = g_rgb_leds[i].point; - hsv.h = ((point.y - 32) * cos_value + (56 - abs8(point.x - 112)) * sin_value) / 128 + rgb_matrix_config.hue; + hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (56 - abs8(g_led_config.point[i].x - 112)) * sin_value) / 128 + rgb_matrix_config.hue; RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/quantum/rgb_matrix_animations/raindrops_anim.h b/quantum/rgb_matrix_animations/raindrops_anim.h index 0e3a87864..4ce1d65e5 100644 --- a/quantum/rgb_matrix_animations/raindrops_anim.h +++ b/quantum/rgb_matrix_animations/raindrops_anim.h @@ -3,10 +3,11 @@ #include "rgb_matrix_types.h" extern rgb_counters_t g_rgb_counters; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; static void raindrops_set_color(int i, effect_params_t* params) { - if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) return; + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val }; // Take the shortest path between hues diff --git a/quantum/rgb_matrix_animations/solid_color_anim.h b/quantum/rgb_matrix_animations/solid_color_anim.h index 033c1f933..ba2cea15e 100644 --- a/quantum/rgb_matrix_animations/solid_color_anim.h +++ b/quantum/rgb_matrix_animations/solid_color_anim.h @@ -1,5 +1,6 @@ #pragma once +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; bool rgb_matrix_solid_color(effect_params_t* params) { diff --git a/quantum/rgb_matrix_animations/solid_reactive_anim.h b/quantum/rgb_matrix_animations/solid_reactive_anim.h index 82483653a..c3dba8a5a 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix_animations/solid_reactive_anim.h @@ -2,6 +2,7 @@ #if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; extern last_hit_t g_last_hit_tracker; diff --git a/quantum/rgb_matrix_animations/solid_reactive_cross.h b/quantum/rgb_matrix_animations/solid_reactive_cross.h index 1dec1886d..8858f71e6 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_cross.h +++ b/quantum/rgb_matrix_animations/solid_reactive_cross.h @@ -2,7 +2,7 @@ #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; extern last_hit_t g_last_hit_tracker; @@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_par uint8_t count = g_last_hit_tracker.count; for (uint8_t i = led_min; i < led_max; i++) { hsv.v = 0; - point_t point = g_rgb_leds[i].point; for (uint8_t j = start; j < count; j++) { RGB_MATRIX_TEST_LED_FLAGS(); - int16_t dx = point.x - g_last_hit_tracker.x[j]; - int16_t dy = point.y - g_last_hit_tracker.y[j]; + int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; + int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; uint8_t dist = sqrt16(dx * dx + dy * dy); int16_t dist2 = 16; uint8_t dist3; diff --git a/quantum/rgb_matrix_animations/solid_reactive_nexus.h b/quantum/rgb_matrix_animations/solid_reactive_nexus.h index 8952a1e2b..c0e3c2450 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_nexus.h +++ b/quantum/rgb_matrix_animations/solid_reactive_nexus.h @@ -2,7 +2,7 @@ #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; extern last_hit_t g_last_hit_tracker; @@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_par uint8_t count = g_last_hit_tracker.count; for (uint8_t i = led_min; i < led_max; i++) { hsv.v = 0; - point_t point = g_rgb_leds[i].point; for (uint8_t j = start; j < count; j++) { RGB_MATRIX_TEST_LED_FLAGS(); - int16_t dx = point.x - g_last_hit_tracker.x[j]; - int16_t dy = point.y - g_last_hit_tracker.y[j]; + int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; + int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; uint8_t dist = sqrt16(dx * dx + dy * dy); int16_t dist2 = 8; uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; diff --git a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h index 9fc4d527a..abc7e36a8 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h @@ -2,6 +2,7 @@ #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; extern last_hit_t g_last_hit_tracker; diff --git a/quantum/rgb_matrix_animations/solid_reactive_wide.h b/quantum/rgb_matrix_animations/solid_reactive_wide.h index d86cb1284..3d1d38e80 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_wide.h +++ b/quantum/rgb_matrix_animations/solid_reactive_wide.h @@ -2,7 +2,7 @@ #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; extern last_hit_t g_last_hit_tracker; @@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_para uint8_t count = g_last_hit_tracker.count; for (uint8_t i = led_min; i < led_max; i++) { hsv.v = 0; - point_t point = g_rgb_leds[i].point; for (uint8_t j = start; j < count; j++) { RGB_MATRIX_TEST_LED_FLAGS(); - int16_t dx = point.x - g_last_hit_tracker.x[j]; - int16_t dy = point.y - g_last_hit_tracker.y[j]; + int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; + int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; uint8_t dist = sqrt16(dx * dx + dy * dy); uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist * 5; if (effect > 255) diff --git a/quantum/rgb_matrix_animations/solid_splash_anim.h b/quantum/rgb_matrix_animations/solid_splash_anim.h index 14312f33d..4e5565d0d 100644 --- a/quantum/rgb_matrix_animations/solid_splash_anim.h +++ b/quantum/rgb_matrix_animations/solid_splash_anim.h @@ -2,7 +2,7 @@ #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH) -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; extern last_hit_t g_last_hit_tracker; @@ -14,10 +14,9 @@ static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* p for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); hsv.v = 0; - point_t point = g_rgb_leds[i].point; for (uint8_t j = start; j < count; j++) { - int16_t dx = point.x - g_last_hit_tracker.x[j]; - int16_t dy = point.y - g_last_hit_tracker.y[j]; + int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; + int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; uint8_t dist = sqrt16(dx * dx + dy * dy); uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; if (effect > 255) diff --git a/quantum/rgb_matrix_animations/splash_anim.h b/quantum/rgb_matrix_animations/splash_anim.h index 3c96d451e..fbe776111 100644 --- a/quantum/rgb_matrix_animations/splash_anim.h +++ b/quantum/rgb_matrix_animations/splash_anim.h @@ -2,7 +2,7 @@ #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) -extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; +extern led_config_t g_led_config; extern rgb_config_t rgb_matrix_config; extern last_hit_t g_last_hit_tracker; @@ -15,10 +15,9 @@ static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params) RGB_MATRIX_TEST_LED_FLAGS(); hsv.h = rgb_matrix_config.hue; hsv.v = 0; - point_t point = g_rgb_leds[i].point; for (uint8_t j = start; j < count; j++) { - int16_t dx = point.x - g_last_hit_tracker.x[j]; - int16_t dy = point.y - g_last_hit_tracker.y[j]; + int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; + int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; uint8_t dist = sqrt16(dx * dx + dy * dy); uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; if (effect > 255) diff --git a/quantum/rgb_matrix_types.h b/quantum/rgb_matrix_types.h index 7a3bc6714..f890edd94 100644 --- a/quantum/rgb_matrix_types.h +++ b/quantum/rgb_matrix_types.h @@ -59,14 +59,6 @@ typedef struct PACKED { uint8_t y; } point_t; -typedef union { - uint8_t raw; - struct { - uint8_t row:4; // 16 max - uint8_t col:4; // 16 max - }; -} matrix_co_t; - #define HAS_FLAGS(bits, flags) ((bits & flags) == flags) #define HAS_ANY_FLAGS(bits, flags) ((bits & flags) != 0x00) @@ -76,11 +68,13 @@ typedef union { #define LED_FLAG_UNDERGLOW 0x02 #define LED_FLAG_KEYLIGHT 0x04 +#define NO_LED 255 + typedef struct PACKED { - matrix_co_t matrix_co; - point_t point; - uint8_t flags; -} rgb_led; + uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS]; + point_t point[DRIVER_LED_TOTAL]; + uint8_t flags[DRIVER_LED_TOTAL]; +} led_config_t; typedef union { uint32_t raw; diff --git a/tmk_core/protocol/arm_atsam/led_matrix.c b/tmk_core/protocol/arm_atsam/led_matrix.c index a2eab1b56..ea067a743 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.c +++ b/tmk_core/protocol/arm_atsam/led_matrix.c @@ -431,6 +431,7 @@ static void led_run_pattern(led_setup_t *f, float* ro, float* go, float* bo, flo } } +extern led_config_t g_led_config; static void led_matrix_massdrop_config_override(int i) { float ro = 0; @@ -438,14 +439,14 @@ static void led_matrix_massdrop_config_override(int i) float bo = 0; float po = (led_animation_orientation) - ? (float)g_rgb_leds[i].point.y / 64.f * 100 - : (float)g_rgb_leds[i].point.x / 224.f * 100; + ? (float)g_led_config.point[i].y / 64.f * 100 + : (float)g_led_config.point[i].x / 224.f * 100; uint8_t highest_active_layer = biton32(layer_state); - if (led_lighting_mode == LED_MODE_KEYS_ONLY && HAS_FLAGS(g_rgb_leds[i].flags, LED_FLAG_UNDERGLOW)) { + if (led_lighting_mode == LED_MODE_KEYS_ONLY && HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) { //Do not act on this LED - } else if (led_lighting_mode == LED_MODE_NON_KEYS_ONLY && !HAS_FLAGS(g_rgb_leds[i].flags, LED_FLAG_UNDERGLOW)) { + } else if (led_lighting_mode == LED_MODE_NON_KEYS_ONLY && !HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) { //Do not act on this LED } else if (led_lighting_mode == LED_MODE_INDICATORS_ONLY) { //Do not act on this LED (Only show indicators)