From af89752bffbaf5dcea30ea16be66b4d682701bc4 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Tue, 7 May 2019 18:22:46 -0500 Subject: rgb_led struct conversion (aka: Per led (key) type rgb matrix effects - part 2) (#5783) * Initial conversion of the rgb_led struct * Converting last keyboard & updating effects to take advantage of the new structure * New struct should not be const * Updated docs * Changing define ___ for no led to NO_LED * Missed converting some keymap usages of the old struct layout --- keyboards/crkbd/rev1/rev1.c | 125 ++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 69 deletions(-) (limited to 'keyboards/crkbd/rev1') diff --git a/keyboards/crkbd/rev1/rev1.c b/keyboards/crkbd/rev1/rev1.c index 2345028d2c..38ab927881 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 -- cgit v1.2.1