From be34fdea4b2903ae12de57b36a68b7c7b0648b74 Mon Sep 17 00:00:00 2001 From: Albert Y <76888457+filterpaper@users.noreply.github.com> Date: Tue, 27 Jul 2021 10:42:34 +0800 Subject: [PATCH] [Keyboard] Add RGB matrix support for Kyria (#12789) Co-authored-by: Drashna Jaelre Co-authored-by: filterpaper --- keyboards/splitkb/kyria/rev1/config.h | 9 +++++++++ keyboards/splitkb/kyria/rev1/rev1.c | 25 +++++++++++++++++++++++++ keyboards/splitkb/kyria/rev1/rules.mk | 4 ++++ 3 files changed, 38 insertions(+) diff --git a/keyboards/splitkb/kyria/rev1/config.h b/keyboards/splitkb/kyria/rev1/config.h index 1b7dc98496..2c96e74a76 100644 --- a/keyboards/splitkb/kyria/rev1/config.h +++ b/keyboards/splitkb/kyria/rev1/config.h @@ -72,3 +72,12 @@ along with this program. If not, see . #ifdef OLED_DRIVER_ENABLE # define OLED_DISPLAY_128X64 #endif + +/* RGB matrix support */ +#ifdef RGB_MATRIX_ENABLE +# define SPLIT_TRANSPORT_MIRROR +# define DRIVER_LED_TOTAL RGBLED_NUM // Number of LEDs +# define RGB_MATRIX_SPLIT { 10, 10 } +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 170 +# define RGB_DISABLE_WHEN_USB_SUSPENDED +#endif diff --git a/keyboards/splitkb/kyria/rev1/rev1.c b/keyboards/splitkb/kyria/rev1/rev1.c index fef272e38f..8da217810d 100644 --- a/keyboards/splitkb/kyria/rev1/rev1.c +++ b/keyboards/splitkb/kyria/rev1/rev1.c @@ -30,6 +30,31 @@ __attribute__ ((weak)) const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATR // clang-format on #endif +#ifdef RGB_MATRIX_ENABLE +/* Map physical under glow LEDs for RGB matrix support */ +led_config_t g_led_config = { { + // Key Matrix to LED Index + { NO_LED, NO_LED, NO_LED, 4, NO_LED, NO_LED, 5, 9 }, + { NO_LED, NO_LED, 3, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, 0, NO_LED, NO_LED, NO_LED, 7, 6, 8 }, + { NO_LED, NO_LED, 1, 2, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, 14, NO_LED, NO_LED, 15, 19 }, + { NO_LED, NO_LED, 13, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, 10, NO_LED, NO_LED, NO_LED, 17, 16, 18 }, + { NO_LED, NO_LED, 11, 12, NO_LED, NO_LED, NO_LED, NO_LED }, +}, { + // LED Index to Physical Position + {91,40}, {77,56}, {63,56}, {77,24}, {63,8}, {21,8}, {21,40}, {35,40}, {7,40}, {7,8}, + {133,40}, {147,56}, {161,56}, {147,24}, {161,8}, {203,8}, {203,40}, {189,40}, {217,40}, {217,8} +}, { + // LED Index to Flag + LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, + LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, + LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, + LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL +} }; +#endif + #ifdef OLED_DRIVER_ENABLE __attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; } diff --git a/keyboards/splitkb/kyria/rev1/rules.mk b/keyboards/splitkb/kyria/rev1/rules.mk index 8b1c9616cb..6b92177829 100644 --- a/keyboards/splitkb/kyria/rev1/rules.mk +++ b/keyboards/splitkb/kyria/rev1/rules.mk @@ -1,3 +1,7 @@ OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays ENCODER_ENABLE = yes # ENables the use of one or more encoders RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = no # Enable keyboard RGB matrix (do not use together with RGBLIGHT_ENABLE) +RGB_MATRIX_DRIVER = WS2812 # RGB matrix driver support + +RGB_MATRIX_SUPPORTED = yes