From c59a81b792ffbe0629183cf1e84f869e9a8d5471 Mon Sep 17 00:00:00 2001 From: Richard Goulter Date: Tue, 18 Aug 2020 13:39:17 +0700 Subject: [PATCH] [Keyboard] Update bm40hsrgb with RGB Matrix support (#10044) * bm40rgb: copy from kbfirmware.com * bm40rgb: align default keymap * bm40rgb: rename kb.c/h to bm40rgb.c/h * bm40rgb: adjust with changes from the noroadsleft converter * bm40rgb: adjust keyboard to support plant_mit and ortho_4x12 layouts * bm40rgb: Add keyboard readme.md * bm40rgb: add RGB Matrix support * bm40rgb: remove bm40hsrgb layout * Apply suggestions from PR - Fix alignment in keyboards/bm40rgb/bm40rgb.c - Remove redundant DESCRIPTION in keyboards/bm40rgb/config.h - Tidy keyboards/bm40rgb/readme.md - Tidy MANUFACTURER, PRODUCT in keyboards/bm40rgb/config.h - Tidy rules.mk keyboards/bm40rgb/rules.mk - Use PRODUCT_ID computed from SHASUM of keyboard name in keyboards/bm40rgb/config.h - Define LAYOUT_all in keyboards/bm40rgb/bm40rgb.h * Update keyboards/bm40rgb/info.json * Tidy comment * Apply suggestions from code review * Apply suggestions from code review * Revert "bm40rgb: remove bm40hsrgb layout" This reverts commit 1f69a03551321bf8cf736150f1f651127c90585a. * Move the rgbmatrix change over to bm40hsrgb * Wrap g_led_config declaration with --- keyboards/bm40hsrgb/bm40hsrgb.c | 28 +++++++++- keyboards/bm40hsrgb/config.h | 7 +-- keyboards/bm40hsrgb/info.json | 94 ++++++++++++++++----------------- keyboards/bm40hsrgb/readme.md | 7 +-- keyboards/bm40hsrgb/rules.mk | 3 +- 5 files changed, 82 insertions(+), 57 deletions(-) diff --git a/keyboards/bm40hsrgb/bm40hsrgb.c b/keyboards/bm40hsrgb/bm40hsrgb.c index aa7218b561..a44263a8b8 100755 --- a/keyboards/bm40hsrgb/bm40hsrgb.c +++ b/keyboards/bm40hsrgb/bm40hsrgb.c @@ -1,4 +1,4 @@ -/* Copyright 2020 tominabox1 +/* Copyright 2020 tominabox1, Richard Goulter * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,3 +14,29 @@ * along with this program. If not, see . */ #include "bm40hsrgb.h" + +#if defined(RGB_MATRIX_ENABLE) +led_config_t g_led_config = { + { + // Key Matrix to LED Index + { 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, 45, 46} + }, { + // LED Index to Physical Position + { 0, 0}, { 20, 0}, { 40, 0}, {61, 0}, {81, 0}, {101, 0}, {122, 0}, {142, 0}, {162, 0}, {183, 0}, {203, 0}, {224, 0}, + { 0, 21}, { 20, 21}, { 40, 21}, {61, 21}, {81, 21}, {101, 21}, {122, 21}, {142, 21}, {162, 21}, {183, 21}, {203, 21}, {224, 21}, + { 0, 42}, { 20, 42}, { 40, 42}, {61, 42}, {81, 42}, {101, 42}, {122, 42}, {142, 42}, {162, 42}, {183, 42}, {203, 42}, {224, 42}, + { 0, 64}, { 20, 64}, { 40, 64}, {61, 64}, {81, 64}, {111, 64}, {142, 64}, {162, 64}, {183, 64}, {203, 64}, {224, 64}, + {220, 32}, {176, 32}, {132, 32}, {88, 32}, {44, 32}, {0, 32} + }, { + // LED Index to Flag + 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, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2 + } +}; +#endif diff --git a/keyboards/bm40hsrgb/config.h b/keyboards/bm40hsrgb/config.h index c2acf30c7c..53ef086d54 100755 --- a/keyboards/bm40hsrgb/config.h +++ b/keyboards/bm40hsrgb/config.h @@ -46,10 +46,7 @@ #define LOCKING_RESYNC_ENABLE #define RGB_DI_PIN E2 +#define DRIVER_LED_TOTAL 53 #ifdef RGB_DI_PIN -#define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 54 -#define RGBLIGHT_HUE_STEP 8 -#define RGBLIGHT_SAT_STEP 8 -#define RGBLIGHT_VAL_STEP 8 + #define RGB_MATRIX_KEYPRESSES // reacts to keypresses #endif diff --git a/keyboards/bm40hsrgb/info.json b/keyboards/bm40hsrgb/info.json index 85fb0d25a1..54b4a5890e 100644 --- a/keyboards/bm40hsrgb/info.json +++ b/keyboards/bm40hsrgb/info.json @@ -7,53 +7,53 @@ "layouts": { "LAYOUT_planck_mit": { "layout": [ - {"x":0, "y":0}, - {"x":1, "y":0}, - {"x":2, "y":0}, - {"x":3, "y":0}, - {"x":4, "y":0}, - {"x":5, "y":0}, - {"x":6, "y":0}, - {"x":7, "y":0}, - {"x":8, "y":0}, - {"x":9, "y":0}, - {"x":10, "y":0}, - {"x":11, "y":0}, - {"x":0, "y":1}, - {"x":1, "y":1}, - {"x":2, "y":1}, - {"x":3, "y":1}, - {"x":4, "y":1}, - {"x":5, "y":1}, - {"x":6, "y":1}, - {"x":7, "y":1}, - {"x":8, "y":1}, - {"x":9, "y":1}, - {"x":10, "y":1}, - {"x":11, "y":1}, - {"x":0, "y":2}, - {"x":1, "y":2}, - {"x":2, "y":2}, - {"x":3, "y":2}, - {"x":4, "y":2}, - {"x":5, "y":2}, - {"x":6, "y":2}, - {"x":7, "y":2}, - {"x":8, "y":2}, - {"x":9, "y":2}, - {"x":10, "y":2}, - {"x":11, "y":2}, - {"x":0, "y":3}, - {"x":1, "y":3}, - {"x":2, "y":3}, - {"x":3, "y":3}, - {"x":4, "y":3}, - {"x":5, "y":3, "w":2}, - {"x":7, "y":3}, - {"x":8, "y":3}, - {"x":9, "y":3}, - {"x":10, "y":3}, - {"x":11, "y":3} + {"label":"K00 (B3,B6)", "x":0, "y":0}, + {"label":"K01 (B3,C6)", "x":1, "y":0}, + {"label":"K02 (B3,B4)", "x":2, "y":0}, + {"label":"K03 (B3,D7)", "x":3, "y":0}, + {"label":"K04 (B3,D4)", "x":4, "y":0}, + {"label":"K05 (B3,D6)", "x":5, "y":0}, + {"label":"K06 (B3,C7)", "x":6, "y":0}, + {"label":"K07 (B3,F6)", "x":7, "y":0}, + {"label":"K08 (B3,F5)", "x":8, "y":0}, + {"label":"K09 (B3,F4)", "x":9, "y":0}, + {"label":"K0A (B3,F1)", "x":10, "y":0}, + {"label":"K0B (B3,F0)", "x":11, "y":0}, + {"label":"K10 (B2,B6)", "x":0, "y":1}, + {"label":"K11 (B2,C6)", "x":1, "y":1}, + {"label":"K12 (B2,B4)", "x":2, "y":1}, + {"label":"K13 (B2,D7)", "x":3, "y":1}, + {"label":"K14 (B2,D4)", "x":4, "y":1}, + {"label":"K15 (B2,D6)", "x":5, "y":1}, + {"label":"K16 (B2,C7)", "x":6, "y":1}, + {"label":"K17 (B2,F6)", "x":7, "y":1}, + {"label":"K18 (B2,F5)", "x":8, "y":1}, + {"label":"K19 (B2,F4)", "x":9, "y":1}, + {"label":"K1A (B2,F1)", "x":10, "y":1}, + {"label":"K1B (B2,F0)", "x":11, "y":1}, + {"label":"K20 (E6,B6)", "x":0, "y":2}, + {"label":"K21 (E6,C6)", "x":1, "y":2}, + {"label":"K22 (E6,B4)", "x":2, "y":2}, + {"label":"K23 (E6,D7)", "x":3, "y":2}, + {"label":"K24 (E6,D4)", "x":4, "y":2}, + {"label":"K25 (E6,D6)", "x":5, "y":2}, + {"label":"K26 (E6,C7)", "x":6, "y":2}, + {"label":"K27 (E6,F6)", "x":7, "y":2}, + {"label":"K28 (E6,F5)", "x":8, "y":2}, + {"label":"K29 (E6,F4)", "x":9, "y":2}, + {"label":"K2A (E6,F1)", "x":10, "y":2}, + {"label":"K2B (E6,F0)", "x":11, "y":2}, + {"label":"K30 (B5,B6)", "x":0, "y":3}, + {"label":"K31 (B5,C6)", "x":1, "y":3}, + {"label":"K32 (B5,B4)", "x":2, "y":3}, + {"label":"K33 (B5,D7)", "x":3, "y":3}, + {"label":"K34 (B5,D4)", "x":4, "y":3}, + {"label":"K35 (B5,D6)", "x":5, "y":3, "w":2}, + {"label":"K37 (B5,F6)", "x":7, "y":3}, + {"label":"K38 (B5,F5)", "x":8, "y":3}, + {"label":"K39 (B5,F4)", "x":9, "y":3}, + {"label":"K3A (B5,F1)", "x":10, "y":3}, + {"label":"K3B (B5,F0)", "x":11, "y":3} ] } } diff --git a/keyboards/bm40hsrgb/readme.md b/keyboards/bm40hsrgb/readme.md index 766c8e4e8a..a2448f9571 100644 --- a/keyboards/bm40hsrgb/readme.md +++ b/keyboards/bm40hsrgb/readme.md @@ -1,11 +1,12 @@ # bm40hsrgb -A 40% mechanical keyboard. +![BM40 RGB](https://rgoulter.com/images/keyboards/bm40rgb/bm40rgb_large.jpg) + +An ortholinear 40% hotswap keyboard with per-key RGB in-switch LEDs and RGB Backlighting, from KP Republic. This firmware was originally taken from a kbfirmware.json and manually converted. You may find the original `.json` files [here](https://drive.google.com/drive/folders/1tlTHQIFcluK2mjZ4UbbKCsdRLgSRSPw6). - -* Keyboard Maintainer: [tominabox1](https://github.com/tominabox1) +* Keyboard Maintainer: [rgoulter](https://github.com/rgoulter) * Hardware Supported: bm40hsrgb PCB * Hardware Availability: [KPRepublic](https://www.aliexpress.com/item/4001147779116.html) diff --git a/keyboards/bm40hsrgb/rules.mk b/keyboards/bm40hsrgb/rules.mk index e4203bc4df..e83c0edb7e 100755 --- a/keyboards/bm40hsrgb/rules.mk +++ b/keyboards/bm40hsrgb/rules.mk @@ -17,8 +17,9 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work NKRO_ENABLE = no # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = no # Audio output +RGB_MATRIX_ENABLE = WS2812 LAYOUTS = planck_mit +LAYOUTS_HAS_RGB = yes