diff options
author | Len Trigg <lenbok@gmail.com> | 2019-04-20 18:33:07 +1200 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-04-19 23:33:07 -0700 |
commit | 8170be5b10e92a4f4a8c23ad0c9dd558c4fc90c7 (patch) | |
tree | c681be7ad7196b409dfb3baf1362c695000a4177 | |
parent | 4856552f8bf3d50a95396fc76e26669ed6f3d8b4 (diff) | |
download | qmk_firmware-8170be5b10e92a4f4a8c23ad0c9dd558c4fc90c7.tar.gz qmk_firmware-8170be5b10e92a4f4a8c23ad0c9dd558c4fc90c7.zip |
[Keyboard] crkbd: compile time hand-dependent rgb_matrix LED declarations (#5657)
Set RGB_MATRIX_SPLIT_RIGHT=yes when flashing the right hand side of the
keyboard.
-rw-r--r-- | keyboards/crkbd/rev1/rev1.c | 196 | ||||
-rw-r--r-- | keyboards/crkbd/rev1/rules.mk | 6 |
2 files changed, 75 insertions, 127 deletions
diff --git a/keyboards/crkbd/rev1/rev1.c b/keyboards/crkbd/rev1/rev1.c index a0bc4b4c21..0104adf151 100644 --- a/keyboards/crkbd/rev1/rev1.c +++ b/keyboards/crkbd/rev1/rev1.c @@ -55,133 +55,75 @@ void led_set_kb(uint8_t usb_led) { * | {x=0..224, y=0..64} physical layout * | | | modifier * | | | */ - const rgb_led g_rgb_leds_left[27] = { - //LEFT - { { 0xFF }, { 85, 16 }, 0 }, // 1 - { { 0xFF }, { 50, 13 }, 0 }, // 2 - { { 0xFF }, { 16, 20 }, 0 }, // 3 - { { 0xFF }, { 16, 38 }, 0 }, // 4 - { { 0xFF }, { 50, 48 }, 0 }, // 5 - { { 0xFF }, { 85, 52 }, 0 }, // 6 - - { { 3 | ( 5 << 4 ) }, { 95, 63 }, 1 }, // 7 - { { 2 | ( 5 << 4 ) }, { 85, 39 }, 0 }, // 8 - { { 1 | ( 5 << 4 ) }, { 85, 21 }, 0 }, // 9 - { { 0 | ( 5 << 4 ) }, { 85, 4 }, 0 }, //10 - { { 0 | ( 4 << 4 ) }, { 68, 02 }, 0 }, //11 - { { 1 | ( 4 << 4 ) }, { 68, 19 }, 0 }, //12 - { { 2 | ( 4 << 4 ) }, { 68, 37 }, 0 }, //13 - { { 3 | ( 4 << 4 ) }, { 80, 58 }, 1 }, //14 - { { 3 | ( 3 << 4 ) }, { 60, 55 }, 1 }, //15 - { { 2 | ( 3 << 4 ) }, { 50, 35 }, 0 }, //16 - { { 1 | ( 3 << 4 ) }, { 50, 13 }, 0 }, //17 - { { 0 | ( 3 << 4 ) }, { 50, 0 }, 0 }, //18 - { { 0 | ( 2 << 4 ) }, { 33, 3 }, 0 }, //19 - { { 1 | ( 2 << 4 ) }, { 33, 20 }, 0 }, //20 - { { 2 | ( 2 << 4 ) }, { 33, 37 }, 0 }, //21 - { { 2 | ( 1 << 4 ) }, { 16, 42 }, 0 }, //22 - { { 1 | ( 1 << 4 ) }, { 16, 24 }, 0 }, //23 - { { 0 | ( 1 << 4 ) }, { 16, 7 }, 0 }, //24 - { { 0 | ( 0 << 4 ) }, { 0, 7 }, 1 }, //25 - { { 1 | ( 0 << 4 ) }, { 0, 24 }, 1 }, //26 - { { 2 | ( 0 << 4 ) }, { 0, 41 }, 1 }, //27 - }; - const rgb_led g_rgb_leds_right[27] = { - //RIGHT - { { 0xFF }, { 139, 16 }, 0 }, // 1 - { { 0xFF }, { 174, 13 }, 0 }, // 2 - { { 0xFF }, { 208, 20 }, 0 }, // 3 - { { 0xFF }, { 208, 38 }, 0 }, // 4 - { { 0xFF }, { 174, 48 }, 0 }, // 5 - { { 0xFF }, { 139, 52 }, 0 }, // 6 - - { { 7 | ( 5 << 4 ) }, { 129, 63 }, 1 }, // 7 - { { 6 | ( 5 << 4 ) }, { 139, 39 }, 0 }, // 8 - { { 5 | ( 5 << 4 ) }, { 139, 21 }, 0 }, // 9 - { { 4 | ( 5 << 4 ) }, { 139, 4 }, 0 }, //10 - { { 4 | ( 4 << 4 ) }, { 156, 02 }, 0 }, //11 - { { 5 | ( 4 << 4 ) }, { 156, 19 }, 0 }, //12 - { { 6 | ( 4 << 4 ) }, { 156, 37 }, 0 }, //13 - { { 7 | ( 4 << 4 ) }, { 144, 58 }, 1 }, //14 - { { 7 | ( 3 << 4 ) }, { 164, 55 }, 1 }, //15 - { { 6 | ( 3 << 4 ) }, { 174, 35 }, 0 }, //16 - { { 5 | ( 3 << 4 ) }, { 174, 13 }, 0 }, //17 - { { 4 | ( 3 << 4 ) }, { 174, 0 }, 0 }, //18 - { { 4 | ( 2 << 4 ) }, { 191, 3 }, 0 }, //19 - { { 5 | ( 2 << 4 ) }, { 191, 20 }, 0 }, //20 - { { 6 | ( 2 << 4 ) }, { 191, 37 }, 0 }, //21 - { { 6 | ( 1 << 4 ) }, { 208, 42 }, 0 }, //22 - { { 5 | ( 1 << 4 ) }, { 208, 24 }, 0 }, //23 - { { 4 | ( 1 << 4 ) }, { 208, 7 }, 0 }, //24 - { { 4 | ( 0 << 4 ) }, { 224, 7 }, 1 }, //25 - { { 5 | ( 0 << 4 ) }, { 224, 24 }, 1 }, //26 - { { 6 | ( 0 << 4 ) }, { 224, 41 }, 1 }, //27 - - }; - - const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - - //LEFT - { { 0xFF }, { 85, 16 }, 0 }, // 1 - { { 0xFF }, { 50, 13 }, 0 }, // 2 - { { 0xFF }, { 16, 20 }, 0 }, // 3 - { { 0xFF }, { 16, 38 }, 0 }, // 4 - { { 0xFF }, { 50, 48 }, 0 }, // 5 - { { 0xFF }, { 85, 52 }, 0 }, // 6 - - { { 3 | ( 5 << 4 ) }, { 95, 63 }, 1 }, // 7 - { { 2 | ( 5 << 4 ) }, { 85, 39 }, 0 }, // 8 - { { 1 | ( 5 << 4 ) }, { 85, 21 }, 0 }, // 9 - { { 0 | ( 5 << 4 ) }, { 85, 4 }, 0 }, //10 - { { 0 | ( 4 << 4 ) }, { 68, 02 }, 0 }, //11 - { { 1 | ( 4 << 4 ) }, { 68, 19 }, 0 }, //12 - { { 2 | ( 4 << 4 ) }, { 68, 37 }, 0 }, //13 - { { 3 | ( 4 << 4 ) }, { 80, 58 }, 1 }, //14 - { { 3 | ( 3 << 4 ) }, { 60, 55 }, 1 }, //15 - { { 2 | ( 3 << 4 ) }, { 50, 35 }, 0 }, //16 - { { 1 | ( 3 << 4 ) }, { 50, 13 }, 0 }, //17 - { { 0 | ( 3 << 4 ) }, { 50, 0 }, 0 }, //18 - { { 0 | ( 2 << 4 ) }, { 33, 3 }, 0 }, //19 - { { 1 | ( 2 << 4 ) }, { 33, 20 }, 0 }, //20 - { { 2 | ( 2 << 4 ) }, { 33, 37 }, 0 }, //21 - { { 2 | ( 1 << 4 ) }, { 16, 42 }, 0 }, //22 - { { 1 | ( 1 << 4 ) }, { 16, 24 }, 0 }, //23 - { { 0 | ( 1 << 4 ) }, { 16, 7 }, 0 }, //24 - { { 0 | ( 0 << 4 ) }, { 0, 7 }, 1 }, //25 - { { 1 | ( 0 << 4 ) }, { 0, 24 }, 1 }, //26 - { { 2 | ( 0 << 4 ) }, { 0, 41 }, 1 }, //27 - - //RIGHT - { { 0xFF }, { 139, 16 }, 0 }, // 1 - { { 0xFF }, { 174, 13 }, 0 }, // 2 - { { 0xFF }, { 208, 20 }, 0 }, // 3 - { { 0xFF }, { 208, 38 }, 0 }, // 4 - { { 0xFF }, { 174, 48 }, 0 }, // 5 - { { 0xFF }, { 139, 52 }, 0 }, // 6 - - { { 7 | ( 5 << 4 ) }, { 129, 63 }, 1 }, // 7 - { { 6 | ( 5 << 4 ) }, { 139, 39 }, 0 }, // 8 - { { 5 | ( 5 << 4 ) }, { 139, 21 }, 0 }, // 9 - { { 4 | ( 5 << 4 ) }, { 139, 4 }, 0 }, //10 - { { 4 | ( 4 << 4 ) }, { 156, 02 }, 0 }, //11 - { { 5 | ( 4 << 4 ) }, { 156, 19 }, 0 }, //12 - { { 6 | ( 4 << 4 ) }, { 156, 37 }, 0 }, //13 - { { 7 | ( 4 << 4 ) }, { 144, 58 }, 1 }, //14 - { { 7 | ( 3 << 4 ) }, { 164, 55 }, 1 }, //15 - { { 6 | ( 3 << 4 ) }, { 174, 35 }, 0 }, //16 - { { 5 | ( 3 << 4 ) }, { 174, 13 }, 0 }, //17 - { { 4 | ( 3 << 4 ) }, { 174, 0 }, 0 }, //18 - { { 4 | ( 2 << 4 ) }, { 191, 3 }, 0 }, //19 - { { 5 | ( 2 << 4 ) }, { 191, 20 }, 0 }, //20 - { { 6 | ( 2 << 4 ) }, { 191, 37 }, 0 }, //21 - { { 6 | ( 1 << 4 ) }, { 208, 42 }, 0 }, //22 - { { 5 | ( 1 << 4 ) }, { 208, 24 }, 0 }, //23 - { { 4 | ( 1 << 4 ) }, { 208, 7 }, 0 }, //24 - { { 4 | ( 0 << 4 ) }, { 224, 7 }, 1 }, //25 - { { 5 | ( 0 << 4 ) }, { 224, 24 }, 1 }, //26 - { { 6 | ( 0 << 4 ) }, { 224, 41 }, 1 }, //27 - - }; +#define RGB_MATRIX_LEFT_LEDS \ + { { 0xFF }, { 85, 16 }, 0 }, /* 1 */ \ + { { 0xFF }, { 50, 13 }, 0 }, /* 2 */ \ + { { 0xFF }, { 16, 20 }, 0 }, /* 3 */ \ + { { 0xFF }, { 16, 38 }, 0 }, /* 4 */ \ + { { 0xFF }, { 50, 48 }, 0 }, /* 5 */ \ + { { 0xFF }, { 85, 52 }, 0 }, /* 6 */ \ + { { 3 | ( 5 << 4 ) }, { 95, 63 }, 1 }, /* 7 */ \ + { { 2 | ( 5 << 4 ) }, { 85, 39 }, 0 }, /* 8 */ \ + { { 1 | ( 5 << 4 ) }, { 85, 21 }, 0 }, /* 9 */ \ + { { 0 | ( 5 << 4 ) }, { 85, 4 }, 0 }, /* 10 */ \ + { { 0 | ( 4 << 4 ) }, { 68, 02 }, 0 }, /* 11 */ \ + { { 1 | ( 4 << 4 ) }, { 68, 19 }, 0 }, /* 12 */ \ + { { 2 | ( 4 << 4 ) }, { 68, 37 }, 0 }, /* 13 */ \ + { { 3 | ( 4 << 4 ) }, { 80, 58 }, 1 }, /* 14 */ \ + { { 3 | ( 3 << 4 ) }, { 60, 55 }, 1 }, /* 15 */ \ + { { 2 | ( 3 << 4 ) }, { 50, 35 }, 0 }, /* 16 */ \ + { { 1 | ( 3 << 4 ) }, { 50, 13 }, 0 }, /* 17 */ \ + { { 0 | ( 3 << 4 ) }, { 50, 0 }, 0 }, /* 18 */ \ + { { 0 | ( 2 << 4 ) }, { 33, 3 }, 0 }, /* 19 */ \ + { { 1 | ( 2 << 4 ) }, { 33, 20 }, 0 }, /* 20 */ \ + { { 2 | ( 2 << 4 ) }, { 33, 37 }, 0 }, /* 21 */ \ + { { 2 | ( 1 << 4 ) }, { 16, 42 }, 0 }, /* 22 */ \ + { { 1 | ( 1 << 4 ) }, { 16, 24 }, 0 }, /* 23 */ \ + { { 0 | ( 1 << 4 ) }, { 16, 7 }, 0 }, /* 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 }, 0 }, /* 1 */ \ + { { 0xFF }, { 174, 13 }, 0 }, /* 2 */ \ + { { 0xFF }, { 208, 20 }, 0 }, /* 3 */ \ + { { 0xFF }, { 208, 38 }, 0 }, /* 4 */ \ + { { 0xFF }, { 174, 48 }, 0 }, /* 5 */ \ + { { 0xFF }, { 139, 52 }, 0 }, /* 6 */ \ + { { 7 | ( 5 << 4 ) }, { 129, 63 }, 1 }, /* 7 */ \ + { { 6 | ( 5 << 4 ) }, { 139, 39 }, 0 }, /* 8 */ \ + { { 5 | ( 5 << 4 ) }, { 139, 21 }, 0 }, /* 9 */ \ + { { 4 | ( 5 << 4 ) }, { 139, 4 }, 0 }, /* 10 */ \ + { { 4 | ( 4 << 4 ) }, { 156, 02 }, 0 }, /* 11 */ \ + { { 5 | ( 4 << 4 ) }, { 156, 19 }, 0 }, /* 12 */ \ + { { 6 | ( 4 << 4 ) }, { 156, 37 }, 0 }, /* 13 */ \ + { { 7 | ( 4 << 4 ) }, { 144, 58 }, 1 }, /* 14 */ \ + { { 7 | ( 3 << 4 ) }, { 164, 55 }, 1 }, /* 15 */ \ + { { 6 | ( 3 << 4 ) }, { 174, 35 }, 0 }, /* 16 */ \ + { { 5 | ( 3 << 4 ) }, { 174, 13 }, 0 }, /* 17 */ \ + { { 4 | ( 3 << 4 ) }, { 174, 0 }, 0 }, /* 18 */ \ + { { 4 | ( 2 << 4 ) }, { 191, 3 }, 0 }, /* 19 */ \ + { { 5 | ( 2 << 4 ) }, { 191, 20 }, 0 }, /* 20 */ \ + { { 6 | ( 2 << 4 ) }, { 191, 37 }, 0 }, /* 21 */ \ + { { 6 | ( 1 << 4 ) }, { 208, 42 }, 0 }, /* 22 */ \ + { { 5 | ( 1 << 4 ) }, { 208, 24 }, 0 }, /* 23 */ \ + { { 4 | ( 1 << 4 ) }, { 208, 7 }, 0 }, /* 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 +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + RGB_MATRIX_RIGHT_LEDS + RGB_MATRIX_LEFT_LEDS + }; +#else +const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + RGB_MATRIX_LEFT_LEDS + RGB_MATRIX_RIGHT_LEDS + }; +#endif #endif void matrix_init_kb(void) { diff --git a/keyboards/crkbd/rev1/rules.mk b/keyboards/crkbd/rev1/rules.mk index 6028b5a5b9..f12849f989 100644 --- a/keyboards/crkbd/rev1/rules.mk +++ b/keyboards/crkbd/rev1/rules.mk @@ -1,3 +1,9 @@ +RGB_MATRIX_SPLIT_RIGHT = no # if no, order LEDs for left hand, if yes, order LEDs for right hand + +ifeq ($(strip $(RGB_MATRIX_SPLIT_RIGHT)), yes) + OPT_DEFS += -DRGB_MATRIX_SPLIT_RIGHT +endif + SRC += rev1/matrix.c SRC += rev1/split_util.c SRC += rev1/split_scomm.c |