diff --git a/keyboards/kprepublic/bm60hsrgb/rev2/config.h b/keyboards/kprepublic/bm60hsrgb/rev2/config.h index 98858cd1643..c3fca3563e3 100644 --- a/keyboards/kprepublic/bm60hsrgb/rev2/config.h +++ b/keyboards/kprepublic/bm60hsrgb/rev2/config.h @@ -1,29 +1,7 @@ -/* 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 . - */ +// Copyright 2021 bdtc123 +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND #define IS31FL3733_LED_COUNT 63 - -// 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 diff --git a/keyboards/kprepublic/bm60hsrgb/rev2/keyboard.json b/keyboards/kprepublic/bm60hsrgb/rev2/keyboard.json index 3783ebb8b21..88d4c5d9ce7 100644 --- a/keyboards/kprepublic/bm60hsrgb/rev2/keyboard.json +++ b/keyboards/kprepublic/bm60hsrgb/rev2/keyboard.json @@ -51,30 +51,80 @@ "solid_multisplash": true }, "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": 4}, + {"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, 13], "x": 198, "y": 32, "flags": 1}, + {"matrix": [3, 0], "x": 18, "y": 48, "flags": 1}, + {"matrix": [3, 1], "x": 30, "y": 48, "flags": 4}, + {"matrix": [3, 2], "x": 45, "y": 48, "flags": 4}, + {"matrix": [3, 3], "x": 60, "y": 48, "flags": 4}, + {"matrix": [3, 4], "x": 75, "y": 48, "flags": 4}, + {"matrix": [3, 5], "x": 90, "y": 48, "flags": 4}, + {"matrix": [3, 6], "x": 105, "y": 48, "flags": 4}, + {"matrix": [3, 7], "x": 120, "y": 48, "flags": 4}, + {"matrix": [3, 8], "x": 135, "y": 48, "flags": 4}, + {"matrix": [3, 9], "x": 150, "y": 48, "flags": 4}, + {"matrix": [3, 11], "x": 165, "y": 48, "flags": 1}, + {"matrix": [3, 12], "x": 191, "y": 48, "flags": 1}, + {"matrix": [3, 13], "x": 210, "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": 120, "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"] @@ -110,7 +160,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}, @@ -125,7 +174,6 @@ {"matrix": [1, 11], "x": 11.5, "y": 1}, {"matrix": [1, 12], "x": 12.5, "y": 1}, {"matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5}, - {"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}, @@ -139,7 +187,6 @@ {"matrix": [2, 10], "x": 10.75, "y": 2}, {"matrix": [2, 11], "x": 11.75, "y": 2}, {"matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25}, - {"matrix": [3, 0], "x": 0, "y": 3, "w": 2.25}, {"matrix": [3, 1], "x": 2.25, "y": 3}, {"matrix": [3, 2], "x": 3.25, "y": 3}, @@ -153,7 +200,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}, diff --git a/keyboards/kprepublic/bm60hsrgb/rev2/keymaps/default/keymap.c b/keyboards/kprepublic/bm60hsrgb/rev2/keymaps/default/keymap.c deleted file mode 100644 index 7b6d1ae6932..00000000000 --- a/keyboards/kprepublic/bm60hsrgb/rev2/keymaps/default/keymap.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2021 bdtc123 - * Copyright 2022 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 . - */ -#include QMK_KEYBOARD_H - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_60_ansi_arrow( - KC_ESC, 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_BSLS, - 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_ENT, - KC_LSFT, 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_ansi_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, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______ - ) - -}; diff --git a/keyboards/kprepublic/bm60hsrgb/rev2/keymaps/default/keymap.json b/keyboards/kprepublic/bm60hsrgb/rev2/keymaps/default/keymap.json new file mode 100644 index 00000000000..caf08550a0b --- /dev/null +++ b/keyboards/kprepublic/bm60hsrgb/rev2/keymaps/default/keymap.json @@ -0,0 +1,21 @@ +{ + "keyboard": "kprepublic/bm60hsrgb/rev2", + "keymap": "default", + "layout": "LAYOUT_60_ansi_arrow", + "layers": [ + [ + "KC_ESC", "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_BSLS", + "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_ENT", + "KC_LSFT", "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", "_______", "_______", "_______", "_______", "_______", "_______", + "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______" + ] + ] +} diff --git a/keyboards/kprepublic/bm60hsrgb/rev2/rev2.c b/keyboards/kprepublic/bm60hsrgb/rev2/rev2.c index e7ff5a9ddc9..b0e68a8cd63 100644 --- a/keyboards/kprepublic/bm60hsrgb/rev2/rev2.c +++ b/keyboards/kprepublic/bm60hsrgb/rev2/rev2.c @@ -1,27 +1,19 @@ -/* Copyright 2021 bdtc123 - * Copyright 2021 sigprof - * - * 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 . - */ +// Copyright 2021 bdtc123 +// Copyright 2021 sigprof +// 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 }, @@ -91,44 +83,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = { { 0, SW2_CS16, SW1_CS16, SW3_CS16 }, { 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, NO_LED, 40 }, - { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, NO_LED, 51, 52, 53 }, - { 54, 55, 56, NO_LED, NO_LED, 57, NO_LED, NO_LED, NO_LED, 58, 59, 60, 61, 62 } - }, { - // 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, A, 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, - { 18, 48 }, { 30, 48 }, { 45, 48 }, { 60, 48 }, { 75, 48 }, { 90, 48 }, { 105, 48 }, { 120, 48 }, { 135, 48 }, { 150, 48 }, { 165, 48 }, { 191, 48 }, { 210, 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, [, ], - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - // Capslock, A, S, D, F, G, H, A, K, L, ;, ', Enter - 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - // LShift, Z, X, C, V, B, N, M, ,, ., /, Shift, Up, ? - 1, 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()) { @@ -140,9 +95,6 @@ bool rgb_matrix_indicators_kb(void) { return true; } - -// clang-format on - // ========================================================================== // Custom RGB Matrix driver that combines IS31FL3733 and WS2812 // ========================================================================== @@ -160,26 +112,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 + ws2812_set_color_all(red, green, blue); } // clang-format off