From 255e138ee18e65e63000b64f019096ed4dbe3b5f Mon Sep 17 00:00:00 2001 From: Leo Deng Date: Fri, 20 Jan 2023 12:24:06 +0800 Subject: [PATCH] djam add rgb matrix (#19621) --- keyboards/deng/djam/config.h | 11 ++++++++ keyboards/deng/djam/djam.c | 27 ++++++++++++++++++++ keyboards/deng/djam/keymaps/default/keymap.c | 19 +++++++++++++- keyboards/deng/djam/keymaps/via/keymap.c | 19 +++++++++++--- keyboards/deng/djam/rules.mk | 2 ++ 5 files changed, 73 insertions(+), 5 deletions(-) diff --git a/keyboards/deng/djam/config.h b/keyboards/deng/djam/config.h index 001b2ff19f..edb558930d 100644 --- a/keyboards/deng/djam/config.h +++ b/keyboards/deng/djam/config.h @@ -26,3 +26,14 @@ #define BACKLIGHT_PIN B7 #define BACKLIGHT_LEVELS 5 + +#ifdef RGB_MATRIX_ENABLE +#define RGB_DI_PIN D5 +#define RGB_MATRIX_LED_COUNT 31 +#define RGB_MATRIX_KEYPRESSES +#define ENABLE_RGB_MATRIX_BREATHING +#define ENABLE_RGB_MATRIX_CYCLE_ALL +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +#endif diff --git a/keyboards/deng/djam/djam.c b/keyboards/deng/djam/djam.c index 97bfda5ac5..c7b986cf9e 100644 --- a/keyboards/deng/djam/djam.c +++ b/keyboards/deng/djam/djam.c @@ -14,3 +14,30 @@ * along with this program. If not, see . */ #include "djam.h" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { + { + /* Key Matrix to LED Index */ + { 17, 16, 15, NO_LED, NO_LED, 7, 6, 5 }, + { 21, 17, 16, 15, 7, 6, 5, 1 }, + { 19, 18, 13, 11, 9, 4, 3, NO_LED } + }, + { + /* LED Index to Physical Position */ + // Switch LEDs + {224,14}, {224,24}, {224,33}, {212,57}, {192,57}, {192,38}, {172,38}, {152,38}, + {152,57}, {142,57}, {132,57}, {112,57}, {92,57}, {82,57}, {72,57}, + {72,38}, {52,38}, {32,38}, {32,57}, {12,57}, {0,33}, {0,24}, {0,14}, + // Underglow LEDs + {0,0}, {92,0}, {132,0}, {224,0}, {222,64}, {172,64}, {72,64}, {2,64}, + }, + { + /* LED Index to Flag */ + 2, 4, 2, 4, 4, 4, 4, 4, + 2, 4, 2, 4, 2, 4, 2, + 4, 4, 4, 4, 4, 2, 4, 2, + 2, 2, 2, 2, 2, 2, 2, 2 + } +}; +#endif diff --git a/keyboards/deng/djam/keymaps/default/keymap.c b/keyboards/deng/djam/keymaps/default/keymap.c index 724a915e66..11508963b1 100644 --- a/keyboards/deng/djam/keymaps/default/keymap.c +++ b/keyboards/deng/djam/keymaps/default/keymap.c @@ -15,9 +15,26 @@ */ #include QMK_KEYBOARD_H +#define L1_SPC LT(1, KC_SPC) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┐ ┌───┬───┬───┐ + * ┌───┤ S │ D │ F │ │ J │ K │ L ├───┐ + * │ A ├───┼───┼───┤ DJAM ├───┼───┼───┤ ; │ + * └───┤ Z │ X │ C │ │ N │ M │ , ├───┘ + * ┌───┼───┼───┴─┬─┴─┬───────┬─┴─┬─┴───┼───┼───┐ + * │ ← │ → │ │LSh│ SPACE │RSh│ │ ↑ │ ↓ │ + * └───┴───┘ └───┴───────┴───┘ └───┴───┘ + */ [0] = LAYOUT( KC_S, KC_D, KC_F, KC_J, KC_K, KC_L, KC_A, KC_Z, KC_X, KC_C, KC_N, KC_M, KC_COMM, KC_SCLN, - KC_LEFT, KC_RGHT, BL_TOGG, KC_SPC, BL_STEP, KC_UP, KC_DOWN) + KC_LEFT, KC_RGHT, KC_LSFT, L1_SPC, KC_RSFT, KC_UP, KC_DOWN), + + [1] = LAYOUT( + RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, _______, RGB_RMOD, + _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, _______, RGB_MOD, RGB_TOG, + _______, _______, BL_TOGG, _______, BL_STEP, _______, _______) + }; diff --git a/keyboards/deng/djam/keymaps/via/keymap.c b/keyboards/deng/djam/keymaps/via/keymap.c index 87ff22eb29..8dbdd85a3e 100644 --- a/keyboards/deng/djam/keymaps/via/keymap.c +++ b/keyboards/deng/djam/keymaps/via/keymap.c @@ -15,16 +15,27 @@ */ #include QMK_KEYBOARD_H +#define L1_SPC LT(1, KC_SPC) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┐ ┌───┬───┬───┐ + * ┌───┤ S │ D │ F │ │ J │ K │ L ├───┐ + * │ A ├───┼───┼───┤ DJAM ├───┼───┼───┤ ; │ + * └───┤ Z │ X │ C │ │ N │ M │ , ├───┘ + * ┌───┼───┼───┴─┬─┴─┬───────┬─┴─┬─┴───┼───┼───┐ + * │ ← │ → │ │LSh│ SPACE │RSh│ │ ↑ │ ↓ │ + * └───┴───┘ └───┴───────┴───┘ └───┴───┘ + */ [0] = LAYOUT( KC_S, KC_D, KC_F, KC_J, KC_K, KC_L, KC_A, KC_Z, KC_X, KC_C, KC_N, KC_M, KC_COMM, KC_SCLN, - KC_LEFT, KC_RGHT, BL_TOGG, KC_SPC, BL_STEP, KC_UP, KC_DOWN), + KC_LEFT, KC_RGHT, KC_LSFT, L1_SPC, KC_RSFT, KC_UP, KC_DOWN), [1] = LAYOUT( - _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______), + RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, _______, RGB_RMOD, + _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, _______, RGB_MOD, RGB_TOG, + _______, _______, BL_TOGG, _______, BL_STEP, _______, _______), [2] = LAYOUT( _______, _______, _______, _______, _______, _______, diff --git a/keyboards/deng/djam/rules.mk b/keyboards/deng/djam/rules.mk index 4fa3df3f58..9685c1ce76 100644 --- a/keyboards/deng/djam/rules.mk +++ b/keyboards/deng/djam/rules.mk @@ -17,3 +17,5 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality BACKLIGHT_DRIVER = pwm RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812