Kaynağa Gözat

Fixup `kprepublic/bm60hsrgb_iso/rev2` (#25648)

Fixup kprepublic/bm60hsrgb_iso/rev2

- Remove RGBLight configuration and throw error if RGBLight & RGB Matrix
  are enabled together - the WS2812 driver cannot be used for RGBLight
  as it is being used by this keyboard's custom RGB Matrix driver
- Migrate RGB Matrix configuration to DD
- Migrate default keymap to JSON
- Use short SPDX license headers
Jack Sangdahl 10 ay önce
ebeveyn
işleme
7dca4e8bda

+ 5 - 27
keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h

@@ -1,31 +1,9 @@
-/* Copyright 2021 bdtc123
- * Copyright 2021 sigprof
- * Copyright 2021 peepeetee
- *
- * 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
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
+// Copyright 2021 bdtc123
+// Copyright 2021 sigprof
+// Copyright 2021 peepeetee
+// SPDX-License-Identifier: GPL-2.0-or-later
 #pragma once
 
 #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
 #define IS31FL3733_LED_COUNT 64
-
-// Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them;
-// don't use those LEDs in RGB Matrix in that case.
-#ifdef RGBLIGHT_ENABLE
-#    define WS2812_LED_COUNT 0
-#else
-#    define WS2812_LED_COUNT 6
-#endif
-
-#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_COUNT)
+#define WS2812_LED_COUNT 6

+ 72 - 25
keyboards/kprepublic/bm60hsrgb_iso/rev2/keyboard.json

@@ -59,30 +59,81 @@
             "animation": "cycle_all"
         },
         "driver": "custom",
+        "layout": [
+            {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4},
+            {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4},
+            {"matrix": [0, 2], "x": 30, "y": 0, "flags": 4},
+            {"matrix": [0, 3], "x": 45, "y": 0, "flags": 4},
+            {"matrix": [0, 4], "x": 60, "y": 0, "flags": 4},
+            {"matrix": [0, 5], "x": 75, "y": 0, "flags": 4},
+            {"matrix": [0, 6], "x": 90, "y": 0, "flags": 4},
+            {"matrix": [0, 7], "x": 105, "y": 0, "flags": 4},
+            {"matrix": [0, 8], "x": 120, "y": 0, "flags": 4},
+            {"matrix": [0, 9], "x": 135, "y": 0, "flags": 4},
+            {"matrix": [0, 10], "x": 150, "y": 0, "flags": 4},
+            {"matrix": [0, 11], "x": 165, "y": 0, "flags": 4},
+            {"matrix": [0, 12], "x": 180, "y": 0, "flags": 4},
+            {"matrix": [0, 13], "x": 202, "y": 0, "flags": 1},
+            {"matrix": [1, 0], "x": 7, "y": 16, "flags": 1},
+            {"matrix": [1, 1], "x": 22, "y": 16, "flags": 4},
+            {"matrix": [1, 2], "x": 37, "y": 16, "flags": 4},
+            {"matrix": [1, 3], "x": 52, "y": 16, "flags": 4},
+            {"matrix": [1, 4], "x": 67, "y": 16, "flags": 4},
+            {"matrix": [1, 5], "x": 82, "y": 16, "flags": 4},
+            {"matrix": [1, 6], "x": 97, "y": 16, "flags": 4},
+            {"matrix": [1, 7], "x": 112, "y": 16, "flags": 4},
+            {"matrix": [1, 8], "x": 127, "y": 16, "flags": 4},
+            {"matrix": [1, 9], "x": 142, "y": 16, "flags": 4},
+            {"matrix": [1, 10], "x": 157, "y": 16, "flags": 4},
+            {"matrix": [1, 11], "x": 172, "y": 16, "flags": 4},
+            {"matrix": [1, 12], "x": 187, "y": 16, "flags": 4},
+            {"matrix": [1, 13], "x": 206, "y": 16, "flags": 1},
+            {"matrix": [2, 0], "x": 11, "y": 32, "flags": 9},
+            {"matrix": [2, 1], "x": 26, "y": 32, "flags": 4},
+            {"matrix": [2, 2], "x": 41, "y": 32, "flags": 4},
+            {"matrix": [2, 3], "x": 56, "y": 32, "flags": 4},
+            {"matrix": [2, 4], "x": 71, "y": 32, "flags": 4},
+            {"matrix": [2, 5], "x": 86, "y": 32, "flags": 4},
+            {"matrix": [2, 6], "x": 101, "y": 32, "flags": 4},
+            {"matrix": [2, 7], "x": 116, "y": 32, "flags": 4},
+            {"matrix": [2, 8], "x": 131, "y": 32, "flags": 4},
+            {"matrix": [2, 9], "x": 146, "y": 32, "flags": 4},
+            {"matrix": [2, 10], "x": 161, "y": 32, "flags": 4},
+            {"matrix": [2, 11], "x": 176, "y": 32, "flags": 4},
+            {"matrix": [2, 12], "x": 198, "y": 32, "flags": 4},
+            {"matrix": [3, 0], "x": 3, "y": 48, "flags": 1},
+            {"matrix": [3, 2], "x": 22, "y": 48, "flags": 4},
+            {"matrix": [3, 3], "x": 33, "y": 48, "flags": 4},
+            {"matrix": [3, 4], "x": 48, "y": 48, "flags": 4},
+            {"matrix": [3, 5], "x": 63, "y": 48, "flags": 4},
+            {"matrix": [3, 6], "x": 78, "y": 48, "flags": 4},
+            {"matrix": [3, 7], "x": 93, "y": 48, "flags": 4},
+            {"matrix": [3, 8], "x": 108, "y": 48, "flags": 4},
+            {"matrix": [3, 9], "x": 123, "y": 48, "flags": 4},
+            {"x": 138, "y": 48, "flags": 4},
+            {"matrix": [3, 10], "x": 153, "y": 48, "flags": 4},
+            {"matrix": [3, 11], "x": 168, "y": 48, "flags": 1},
+            {"matrix": [3, 12], "x": 194, "y": 48, "flags": 1},
+            {"matrix": [3, 13], "x": 213, "y": 48, "flags": 4},
+            {"matrix": [4, 0], "x": 3, "y": 64, "flags": 1},
+            {"matrix": [4, 1], "x": 22, "y": 64, "flags": 1},
+            {"matrix": [4, 2], "x": 33, "y": 64, "flags": 1},
+            {"matrix": [4, 5], "x": 101, "y": 64, "flags": 4},
+            {"matrix": [4, 9], "x": 135, "y": 64, "flags": 1},
+            {"matrix": [4, 10], "x": 153, "y": 64, "flags": 1},
+            {"matrix": [4, 11], "x": 195, "y": 64, "flags": 1},
+            {"matrix": [4, 12], "x": 210, "y": 64, "flags": 1},
+            {"matrix": [4, 13], "x": 224, "y": 64, "flags": 1},
+            {"x": 28, "y": 40, "flags": 2},
+            {"x": 62, "y": 40, "flags": 2},
+            {"x": 96, "y": 40, "flags": 2},
+            {"x": 130, "y": 40, "flags": 2},
+            {"x": 164, "y": 40, "flags": 2},
+            {"x": 198, "y": 40, "flags": 2}
+        ],
         "max_brightness": 180,
         "sleep": true
     },
-    "rgblight": {
-        "saturation_steps": 8,
-        "brightness_steps": 8,
-        "led_count": 6,
-        "max_brightness": 150,
-        "animations": {
-            "breathing": true,
-            "rainbow_mood": true,
-            "rainbow_swirl": true,
-            "snake": true,
-            "knight": true,
-            "christmas": true,
-            "static_gradient": true,
-            "rgb_test": true,
-            "alternating": true,
-            "twinkle": true
-        },
-        "default": {
-            "animation": "rainbow_mood"
-        }
-    },
     "matrix_pins": {
         "cols": ["B2", "B3", "B7", "B0", "B1", "F7", "D4", "D6", "D7", "B4", "B5", "B6", "C6", "C7"],
         "rows": ["E6", "D2", "D3", "D5", "F6"]
@@ -118,7 +169,6 @@
                 {"matrix": [0, 11], "x": 11, "y": 0},
                 {"matrix": [0, 12], "x": 12, "y": 0},
                 {"matrix": [0, 13], "x": 13, "y": 0, "w": 2},
-
                 {"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
                 {"matrix": [1, 1], "x": 1.5, "y": 1},
                 {"matrix": [1, 2], "x": 2.5, "y": 1},
@@ -132,7 +182,6 @@
                 {"matrix": [1, 10], "x": 10.5, "y": 1},
                 {"matrix": [1, 11], "x": 11.5, "y": 1},
                 {"matrix": [1, 12], "x": 12.5, "y": 1},
-
                 {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75},
                 {"matrix": [2, 1], "x": 1.75, "y": 2},
                 {"matrix": [2, 2], "x": 2.75, "y": 2},
@@ -147,7 +196,6 @@
                 {"matrix": [2, 11], "x": 11.75, "y": 2},
                 {"matrix": [2, 12], "x": 12.75, "y": 2},
                 {"matrix": [1, 13], "x": 13.75, "y": 1, "w": 1.25, "h": 2},
-
                 {"matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
                 {"matrix": [4, 3], "x": 1.25, "y": 3},
                 {"matrix": [3, 1], "x": 2.25, "y": 3},
@@ -162,7 +210,6 @@
                 {"matrix": [3, 11], "x": 11.25, "y": 3, "w": 1.75},
                 {"matrix": [3, 12], "x": 13, "y": 3},
                 {"matrix": [3, 13], "x": 14, "y": 3},
-
                 {"matrix": [4, 0], "x": 0, "y": 4, "w": 1.25},
                 {"matrix": [4, 1], "x": 1.25, "y": 4, "w": 1.25},
                 {"matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.25},

+ 0 - 34
keyboards/kprepublic/bm60hsrgb_iso/rev2/keymaps/default/keymap.c

@@ -1,34 +0,0 @@
-/* Copyright 2020 markva
- * Copyright 2021 bdtc123
- *
- * 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
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-#include QMK_KEYBOARD_H
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-    [0] = LAYOUT_60_iso_arrow(
-        QK_GESC, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC,
-        KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC,
-        KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT,
-        KC_LSFT, KC_NUBS, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_RSFT, KC_UP,   KC_SLSH,
-        KC_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                    KC_RALT, MO(1),   KC_LEFT, KC_DOWN, KC_RGHT
-    ),
-    [1] = LAYOUT_60_iso_arrow(
-        _______,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  QK_BOOT,
-        _______, RM_TOGG, RM_NEXT, RM_HUEU, RM_HUED, RM_SATU, RM_SATD, RM_VALU, RM_VALD, _______, _______, _______, _______,
-        _______, _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______, _______, _______, _______, _______, _______,
-        _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, KC_PGUP, _______,
-        _______, _______, _______,                            _______,                   _______, _______, KC_HOME, KC_PGDN, KC_END
-    )
-};

+ 21 - 0
keyboards/kprepublic/bm60hsrgb_iso/rev2/keymaps/default/keymap.json

@@ -0,0 +1,21 @@
+{
+    "keyboard": "kprepublic/bm60hsrgb_iso/rev2",
+    "keymap": "default",
+    "layout": "LAYOUT_60_iso_arrow",
+    "layers": [
+        [
+            "QK_GESC", "KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_6", "KC_7", "KC_8", "KC_9", "KC_0", "KC_MINS", "KC_EQL", "KC_BSPC",
+            "KC_TAB", "KC_Q", "KC_W", "KC_E", "KC_R", "KC_T", "KC_Y", "KC_U", "KC_I", "KC_O", "KC_P", "KC_LBRC", "KC_RBRC",
+            "KC_CAPS", "KC_A", "KC_S", "KC_D", "KC_F", "KC_G", "KC_H", "KC_J", "KC_K", "KC_L", "KC_SCLN", "KC_QUOT", "KC_NUHS", "KC_ENT",
+            "KC_LSFT", "KC_NUBS", "KC_Z", "KC_X", "KC_C", "KC_V", "KC_B", "KC_N", "KC_M", "KC_COMM", "KC_DOT", "KC_RSFT", "KC_UP", "KC_SLSH",
+            "KC_LCTL", "KC_LGUI", "KC_LALT", "KC_SPC", "KC_RALT", "MO(1)", "KC_LEFT", "KC_DOWN", "KC_RGHT"
+        ],
+        [
+            "_______", "KC_F1", "KC_F2", "KC_F3", "KC_F4", "KC_F5", "KC_F6", "KC_F7", "KC_F8", "KC_F9", "KC_F10", "KC_F11", "KC_F12", "QK_BOOT",
+            "_______", "RM_TOGG", "RM_NEXT", "RM_HUEU", "RM_HUED", "RM_SATU", "RM_SATD", "RM_VALU", "RM_VALD", "_______", "_______", "_______", "_______",
+            "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______",
+            "_______", "_______", "_______", "_______", "_______", "_______", "NK_TOGG", "_______", "_______", "_______", "_______", "KC_PGUP", "_______",
+            "_______", "_______", "_______", "_______", "_______", "_______", "KC_HOME", "KC_PGDN", "KC_END"
+        ]
+    ]
+}

+ 10 - 62
keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c

@@ -1,29 +1,20 @@
-/* Copyright 2021 bdtc123
- * Copyright 2021 sigprof
- * Copyright 2021 peepeetee
- *
- * 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
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
+// Copyright 2021 bdtc123
+// Copyright 2021 sigprof
+// Copyright 2021 peepeetee
+// SPDX-License-Identifier: GPL-2.0-or-later
 #include "quantum.h"
 
+#if defined(RGB_MATRIX_ENABLE) && defined(RGBLIGHT_ENABLE)
+#    error "RGBLight must not be enabled due to this keyboard's custom RGB Matrix driver"
+#endif
+
 #ifdef RGB_MATRIX_ENABLE
 
 #    include "i2c_master.h"
 #    include "is31fl3733.h"
 #    include "ws2812.h"
 
-
+// clang-format off
 const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
     { 0, SW2_CS1, SW1_CS1, SW3_CS1 },
     { 0, SW2_CS2, SW1_CS2, SW3_CS2 },
@@ -94,42 +85,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
     { 0, SW2_CS15, SW1_CS15, SW3_CS15 },
     { 0, SW5_CS16, SW4_CS16, SW6_CS16 }
 };
-
-led_config_t g_led_config = { {
-  {   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,NO_LED},
-  {  41,  58,  42,    43,    44,    45,    46,    47,    48,  49,  51,  52,  53,  54 },
-  {  55,  56,  57,NO_LED,NO_LED,    58,NO_LED,NO_LED,NO_LED,  59,  60,  61,  62,  63 }
-}, {
-    // Esc, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, Backspace
-    {   0,   0 }, {  15,   0 }, {  30,   0 }, {  45,   0 }, {  60,   0 }, {  75,   0 }, {  90,   0 }, { 105,   0 }, { 120,   0 }, { 135,   0 }, { 150,   0 }, { 165,   0 }, { 180,   0 }, { 202,   0 },
-    // Tab, Q, W, E, R, T, Y, U, I, O, P, [, ],  ,
-    {   7,  16 }, {  22,  16 }, {  37,  16 }, {  52,  16 }, {  67,  16 }, {  82,  16 }, {  97,  16 }, { 112,  16 }, { 127,  16 }, { 142,  16 }, { 157,  16 }, { 172,  16 }, { 187,  16 }, { 206,  16 },
-    // Capslock, A, S, D, F, G, H, J, K, L, ;, ', Enter
-    {  11,  32 }, {  26,  32 }, {  41,  32 }, {  56,  32 }, {  71,  32 }, {  86,  32 }, { 101,  32 }, { 116,  32 }, { 131,  32 }, { 146,  32 }, { 161,  32 }, { 176,  32 }, { 198,  32 },
-    // LShift, <, Z, X, C, V, B, N, M, ,, ., /, Shift, Up,
-    {   3,  48 }, {  22,  48 }, {  33,  48 }, {  48,  48 }, {  63,  48 }, {  78,  48 }, {  93,  48 }, { 108,  48 }, { 123,  48 }, { 138,  48 }, { 153,  48 }, { 168,  48 }, { 194,  48 }, { 213,  48 },
-    // Ctrl, GUI, Alt, Space, RAlt, FN, Left, Down, Right
-    {   3,  64 }, {  22,  64 }, {  33,  64 }, { 101,  64 }, { 135,  64 }, { 153,  64 }, { 195,  64 }, { 210,  64 }, { 225,  64 }
-#    if WS2812_LED_COUNT > 0
-        ,{ 28, 40}, { 62, 40}, { 96, 40}, {130, 40}, {164, 40}, {198, 40}
-#    endif
-}, {
-    // Esc, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, Backspace
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
-    // Tab, Q, W, E, R, T, Y, U, I, O, P, [, ], Enter
-    1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
-    // Capslock, A, S, D, F, G, H, J, K, L, ;, ',#
-    9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    // LShift,backslash, Z, X, C, V, B, N, M, ,, ., Shift, Up, /
-    1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4,
-    // Ctrl, GUI, Alt, Space, RAlt, FN, Left, Down, Right
-    1, 1, 1, 4, 1, 1, 1, 1, 1
-#    if WS2812_LED_COUNT > 0
-        ,2, 2, 2, 2, 2, 2
-#    endif
-} };
+// clang-format on
 
 bool rgb_matrix_indicators_kb(void) {
     if (!rgb_matrix_indicators_user()) {
@@ -141,8 +97,6 @@ bool rgb_matrix_indicators_kb(void) {
     return true;
 }
 
-// clang-format on
-
 // ==========================================================================
 // Custom RGB Matrix driver that combines IS31FL3733 and WS2812
 // ==========================================================================
@@ -160,26 +114,20 @@ static void rgb_matrix_driver_init(void) {
 
 static void rgb_matrix_driver_flush(void) {
     is31fl3733_update_pwm_buffers(0);
-#    if WS2812_LED_COUNT > 0
     ws2812_flush();
-#    endif
 }
 
 static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
     if (index < IS31FL3733_LED_COUNT) {
         is31fl3733_set_color(index, red, green, blue);
-#    if WS2812_LED_COUNT > 0
     } else {
         ws2812_set_color(index - IS31FL3733_LED_COUNT, red, green, blue);
-#    endif
     }
 }
 
 static void rgb_matrix_driver_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
     is31fl3733_set_color_all(red, green, blue);
-#    if WS2812_LED_COUNT > 0
     ws2812_set_color_all(red, green, blue);
-#    endif
 }
 
 // clang-format off

+ 2 - 4
keyboards/kprepublic/bm60hsrgb_iso/rev2/rules.mk

@@ -1,7 +1,5 @@
-# The custom RGB Matrix driver combines IS31FL3733 and WS2812; things that are
-# normally done by common_features.mk for both of these drivers need to be done
-# here manually.
+WS2812_DRIVER_REQUIRED = yes
+
 COMMON_VPATH += $(DRIVER_PATH)/led/issi
 SRC += is31fl3733.c
 I2C_DRIVER_REQUIRED = yes
-WS2812_DRIVER_REQUIRED = yes