From 786cfdb9e27d09deaafe9793f549ef8b400313ea Mon Sep 17 00:00:00 2001 From: lokher Date: Wed, 28 Jan 2026 18:18:25 +0800 Subject: [PATCH] Add per-key/mixed RGB to Keychron Q2 ANSI/ISO variants --- keyboards/keychron/q2/ansi/ansi.c | 27 +- keyboards/keychron/q2/ansi/config.h | 4 +- keyboards/keychron/q2/ansi/keyboard.json | 155 ++++--- .../q2/ansi/keymaps/keychron/keymap.c | 68 +++ .../q2/ansi/keymaps/keychron/rules.mk | 1 + keyboards/keychron/q2/ansi/rules.mk | 1 + .../keychron/q2/ansi_encoder/ansi_encoder.c | 27 +- keyboards/keychron/q2/ansi_encoder/config.h | 7 +- .../keychron/q2/ansi_encoder/keyboard.json | 155 ++++--- .../q2/ansi_encoder/keymaps/keychron/keymap.c | 78 ++++ .../q2/ansi_encoder/keymaps/keychron/rules.mk | 2 + keyboards/keychron/q2/ansi_encoder/readme.md | 6 +- keyboards/keychron/q2/ansi_encoder/rules.mk | 1 + keyboards/keychron/q2/config.h | 28 +- keyboards/keychron/q2/halconf.h | 6 +- keyboards/keychron/q2/info.json | 44 +- keyboards/keychron/q2/iso/config.h | 4 +- keyboards/keychron/q2/iso/iso.c | 27 +- keyboards/keychron/q2/iso/keyboard.json | 32 +- .../keychron/q2/iso/keymaps/keychron/keymap.c | 68 +++ .../keychron/q2/iso/keymaps/keychron/rules.mk | 1 + keyboards/keychron/q2/iso/rules.mk | 1 + keyboards/keychron/q2/iso_encoder/config.h | 7 +- .../keychron/q2/iso_encoder/iso_encoder.c | 26 +- .../keychron/q2/iso_encoder/keyboard.json | 32 +- .../q2/iso_encoder/keymaps/keychron/keymap.c | 78 ++++ .../q2/iso_encoder/keymaps/keychron/rules.mk | 2 + keyboards/keychron/q2/iso_encoder/rules.mk | 1 + .../keychron/q2/jis/keymaps/keychron/keymap.c | 68 +++ .../keychron/q2/jis/keymaps/keychron/rules.mk | 1 + .../keychron/q2/jis_encoder/keyboard.json | 161 ++++--- .../q2/jis_encoder/keymaps/keychron/keymap.c | 79 ++++ .../q2/jis_encoder/keymaps/keychron/rules.mk | 2 + .../q2/{chconf.h => keycodes_custom.h} | 25 +- keyboards/keychron/q2/mcuconf.h | 2 +- keyboards/keychron/q2/q2.c | 53 +-- keyboards/keychron/q2/readme.md | 26 +- keyboards/keychron/q2/rules.mk | 1 + keyboards/keychron/q2/via_json/q2_ansi.json | 396 ++++++++++++++++++ .../keychron/q2/via_json/q2_ansi_encoder.json | 396 ++++++++++++++++++ keyboards/keychron/q2/via_json/q2_iso.json | 396 ++++++++++++++++++ .../keychron/q2/via_json/q2_iso_encoder.json | 396 ++++++++++++++++++ 42 files changed, 2509 insertions(+), 382 deletions(-) create mode 100644 keyboards/keychron/q2/ansi/keymaps/keychron/keymap.c create mode 100644 keyboards/keychron/q2/ansi/keymaps/keychron/rules.mk create mode 100644 keyboards/keychron/q2/ansi/rules.mk create mode 100644 keyboards/keychron/q2/ansi_encoder/keymaps/keychron/keymap.c create mode 100644 keyboards/keychron/q2/ansi_encoder/keymaps/keychron/rules.mk create mode 100644 keyboards/keychron/q2/ansi_encoder/rules.mk create mode 100644 keyboards/keychron/q2/iso/keymaps/keychron/keymap.c create mode 100644 keyboards/keychron/q2/iso/keymaps/keychron/rules.mk create mode 100644 keyboards/keychron/q2/iso/rules.mk create mode 100644 keyboards/keychron/q2/iso_encoder/keymaps/keychron/keymap.c create mode 100644 keyboards/keychron/q2/iso_encoder/keymaps/keychron/rules.mk create mode 100644 keyboards/keychron/q2/iso_encoder/rules.mk create mode 100644 keyboards/keychron/q2/jis/keymaps/keychron/keymap.c create mode 100644 keyboards/keychron/q2/jis/keymaps/keychron/rules.mk create mode 100644 keyboards/keychron/q2/jis_encoder/keymaps/keychron/keymap.c create mode 100644 keyboards/keychron/q2/jis_encoder/keymaps/keychron/rules.mk rename keyboards/keychron/q2/{chconf.h => keycodes_custom.h} (59%) create mode 100644 keyboards/keychron/q2/rules.mk create mode 100644 keyboards/keychron/q2/via_json/q2_ansi.json create mode 100644 keyboards/keychron/q2/via_json/q2_ansi_encoder.json create mode 100644 keyboards/keychron/q2/via_json/q2_iso.json create mode 100644 keyboards/keychron/q2/via_json/q2_iso_encoder.json diff --git a/keyboards/keychron/q2/ansi/ansi.c b/keyboards/keychron/q2/ansi/ansi.c index 3d135e8722..60d545789c 100644 --- a/keyboards/keychron/q2/ansi/ansi.c +++ b/keyboards/keychron/q2/ansi/ansi.c @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -17,6 +17,8 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE + +// clang-format off const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { /* Refer to SNLED27351 manual for these locations * driver @@ -97,4 +99,25 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { {1, CB6_CA16, CB4_CA16, CB5_CA16}, }; -#endif // RGB_MATRIX_ENABLE +// Default Color of Per Key RGB +#define DC_RED {HSV_RED} +#define DC_BLU {HSV_BLUE} +#define DC_YLW {HSV_YELLOW} + +HSV default_per_key_led[RGB_MATRIX_LED_COUNT] = { + DC_RED, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_RED, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, DC_YLW, + DC_YLW, DC_YLW, DC_YLW, DC_BLU, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW +}; + +// Default mixed RGB region +uint8_t default_region[RGB_MATRIX_LED_COUNT] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; +#endif diff --git a/keyboards/keychron/q2/ansi/config.h b/keyboards/keychron/q2/ansi/config.h index 1850088b1f..fb626d530a 100644 --- a/keyboards/keychron/q2/ansi/config.h +++ b/keyboards/keychron/q2/ansi/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -17,4 +17,4 @@ #pragma once /* Enable caps-lock LED */ -#define CAPS_LOCK_LED_INDEX 30 \ No newline at end of file +#define CAPS_LOCK_INDEX 30 diff --git a/keyboards/keychron/q2/ansi/keyboard.json b/keyboards/keychron/q2/ansi/keyboard.json index d419d31eef..8a2a758fe8 100644 --- a/keyboards/keychron/q2/ansi/keyboard.json +++ b/keyboards/keychron/q2/ansi/keyboard.json @@ -1,85 +1,9 @@ { "usb": { "pid": "0x0110", - "device_version": "1.0.0" + "device_version": "1.1.0" }, - "rgb_matrix": { - "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, - {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4}, - {"matrix": [0, 2], "x": 29, "y": 0, "flags": 4}, - {"matrix": [0, 3], "x": 44, "y": 0, "flags": 4}, - {"matrix": [0, 4], "x": 59, "y": 0, "flags": 4}, - {"matrix": [0, 5], "x": 73, "y": 0, "flags": 4}, - {"matrix": [0, 6], "x": 88, "y": 0, "flags": 4}, - {"matrix": [0, 7], "x": 103, "y": 0, "flags": 4}, - {"matrix": [0, 8], "x": 118, "y": 0, "flags": 4}, - {"matrix": [0, 9], "x": 132, "y": 0, "flags": 4}, - {"matrix": [0, 10], "x": 147, "y": 0, "flags": 4}, - {"matrix": [0, 11], "x": 162, "y": 0, "flags": 4}, - {"matrix": [0, 12], "x": 176, "y": 0, "flags": 4}, - {"matrix": [0, 13], "x": 198, "y": 0, "flags": 1}, - {"matrix": [0, 14], "x": 224, "y": 0, "flags": 1}, - - {"matrix": [1, 0], "x": 4, "y": 15, "flags": 1}, - {"matrix": [1, 1], "x": 22, "y": 15, "flags": 4}, - {"matrix": [1, 2], "x": 37, "y": 15, "flags": 4}, - {"matrix": [1, 3], "x": 51, "y": 15, "flags": 4}, - {"matrix": [1, 4], "x": 66, "y": 15, "flags": 4}, - {"matrix": [1, 5], "x": 81, "y": 15, "flags": 4}, - {"matrix": [1, 6], "x": 95, "y": 15, "flags": 4}, - {"matrix": [1, 7], "x": 110, "y": 15, "flags": 4}, - {"matrix": [1, 8], "x": 125, "y": 15, "flags": 4}, - {"matrix": [1, 9], "x": 140, "y": 15, "flags": 4}, - {"matrix": [1, 10], "x": 154, "y": 15, "flags": 4}, - {"matrix": [1, 11], "x": 169, "y": 15, "flags": 4}, - {"matrix": [1, 12], "x": 184, "y": 15, "flags": 4}, - {"matrix": [1, 13], "x": 202, "y": 15, "flags": 1}, - {"matrix": [1, 14], "x": 224, "y": 15, "flags": 1}, - - {"matrix": [2, 0], "x": 6, "y": 30, "flags": 1}, - {"matrix": [2, 1], "x": 26, "y": 30, "flags": 4}, - {"matrix": [2, 2], "x": 40, "y": 30, "flags": 4}, - {"matrix": [2, 3], "x": 55, "y": 30, "flags": 4}, - {"matrix": [2, 4], "x": 70, "y": 30, "flags": 4}, - {"matrix": [2, 5], "x": 84, "y": 30, "flags": 4}, - {"matrix": [2, 6], "x": 99, "y": 30, "flags": 4}, - {"matrix": [2, 7], "x": 114, "y": 30, "flags": 4}, - {"matrix": [2, 8], "x": 129, "y": 30, "flags": 4}, - {"matrix": [2, 9], "x": 143, "y": 30, "flags": 4}, - {"matrix": [2, 10], "x": 158, "y": 30, "flags": 4}, - {"matrix": [2, 11], "x": 173, "y": 30, "flags": 4}, - {"matrix": [2, 13], "x": 196, "y": 30, "flags": 1}, - {"matrix": [2, 14], "x": 224, "y": 30, "flags": 1}, - - {"matrix": [3, 0], "x": 9, "y": 45, "flags": 1}, - {"matrix": [3, 2], "x": 33, "y": 45, "flags": 4}, - {"matrix": [3, 3], "x": 48, "y": 45, "flags": 4}, - {"matrix": [3, 4], "x": 62, "y": 45, "flags": 4}, - {"matrix": [3, 5], "x": 77, "y": 45, "flags": 4}, - {"matrix": [3, 6], "x": 92, "y": 45, "flags": 4}, - {"matrix": [3, 7], "x": 106, "y": 45, "flags": 4}, - {"matrix": [3, 8], "x": 121, "y": 45, "flags": 4}, - {"matrix": [3, 9], "x": 136, "y": 45, "flags": 4}, - {"matrix": [3, 10], "x": 151, "y": 45, "flags": 4}, - {"matrix": [3, 11], "x": 165, "y": 45, "flags": 4}, - {"matrix": [3, 13], "x": 185, "y": 45, "flags": 1}, - {"matrix": [3, 14], "x": 209, "y": 49, "flags": 1}, - - {"matrix": [4, 0], "x": 2, "y": 60, "flags": 1}, - {"matrix": [4, 1], "x": 20, "y": 60, "flags": 1}, - {"matrix": [4, 2], "x": 39, "y": 60, "flags": 1}, - {"matrix": [4, 6], "x": 94, "y": 60, "flags": 4}, - {"matrix": [4, 10], "x": 147, "y": 60, "flags": 1}, - {"matrix": [4, 11], "x": 162, "y": 60, "flags": 1}, - {"matrix": [4, 12], "x": 176, "y": 60, "flags": 1}, - {"matrix": [4, 13], "x": 195, "y": 64, "flags": 1}, - {"matrix": [2, 12], "x": 209, "y": 64, "flags": 1}, - {"matrix": [4, 14], "x": 224, "y": 64, "flags": 1} - - ] - }, - "layouts": { + "layouts": { "LAYOUT_ansi_67": { "layout": [ {"matrix": [0, 0], "x": 0, "y": 0.25}, @@ -155,5 +79,80 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.5} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, + {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 29, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 44, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 59, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 73, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 88, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 103, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 118, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 132, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 147, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 162, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 176, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 198, "y": 0, "flags": 1}, + {"matrix": [0, 14], "x": 224, "y": 0, "flags": 1}, + + {"matrix": [1, 0], "x": 4, "y": 15, "flags": 1}, + {"matrix": [1, 1], "x": 22, "y": 15, "flags": 4}, + {"matrix": [1, 2], "x": 37, "y": 15, "flags": 4}, + {"matrix": [1, 3], "x": 51, "y": 15, "flags": 4}, + {"matrix": [1, 4], "x": 66, "y": 15, "flags": 4}, + {"matrix": [1, 5], "x": 81, "y": 15, "flags": 4}, + {"matrix": [1, 6], "x": 95, "y": 15, "flags": 4}, + {"matrix": [1, 7], "x": 110, "y": 15, "flags": 4}, + {"matrix": [1, 8], "x": 125, "y": 15, "flags": 4}, + {"matrix": [1, 9], "x": 140, "y": 15, "flags": 4}, + {"matrix": [1, 10], "x": 154, "y": 15, "flags": 4}, + {"matrix": [1, 11], "x": 169, "y": 15, "flags": 4}, + {"matrix": [1, 12], "x": 184, "y": 15, "flags": 4}, + {"matrix": [1, 13], "x": 202, "y": 15, "flags": 1}, + {"matrix": [1, 14], "x": 224, "y": 15, "flags": 1}, + + {"matrix": [2, 0], "x": 6, "y": 30, "flags": 1}, + {"matrix": [2, 1], "x": 26, "y": 30, "flags": 4}, + {"matrix": [2, 2], "x": 40, "y": 30, "flags": 4}, + {"matrix": [2, 3], "x": 55, "y": 30, "flags": 4}, + {"matrix": [2, 4], "x": 70, "y": 30, "flags": 4}, + {"matrix": [2, 5], "x": 84, "y": 30, "flags": 4}, + {"matrix": [2, 6], "x": 99, "y": 30, "flags": 4}, + {"matrix": [2, 7], "x": 114, "y": 30, "flags": 4}, + {"matrix": [2, 8], "x": 129, "y": 30, "flags": 4}, + {"matrix": [2, 9], "x": 143, "y": 30, "flags": 4}, + {"matrix": [2, 10], "x": 158, "y": 30, "flags": 4}, + {"matrix": [2, 11], "x": 173, "y": 30, "flags": 4}, + {"matrix": [2, 13], "x": 196, "y": 30, "flags": 1}, + {"matrix": [2, 14], "x": 224, "y": 30, "flags": 1}, + + {"matrix": [3, 0], "x": 9, "y": 45, "flags": 1}, + {"matrix": [3, 2], "x": 33, "y": 45, "flags": 4}, + {"matrix": [3, 3], "x": 48, "y": 45, "flags": 4}, + {"matrix": [3, 4], "x": 62, "y": 45, "flags": 4}, + {"matrix": [3, 5], "x": 77, "y": 45, "flags": 4}, + {"matrix": [3, 6], "x": 92, "y": 45, "flags": 4}, + {"matrix": [3, 7], "x": 106, "y": 45, "flags": 4}, + {"matrix": [3, 8], "x": 121, "y": 45, "flags": 4}, + {"matrix": [3, 9], "x": 136, "y": 45, "flags": 4}, + {"matrix": [3, 10], "x": 151, "y": 45, "flags": 4}, + {"matrix": [3, 11], "x": 165, "y": 45, "flags": 4}, + {"matrix": [3, 13], "x": 185, "y": 45, "flags": 1}, + {"matrix": [3, 14], "x": 209, "y": 49, "flags": 1}, + + {"matrix": [4, 0], "x": 2, "y": 60, "flags": 1}, + {"matrix": [4, 1], "x": 20, "y": 60, "flags": 1}, + {"matrix": [4, 2], "x": 39, "y": 60, "flags": 1}, + {"matrix": [4, 6], "x": 94, "y": 60, "flags": 4}, + {"matrix": [4, 10], "x": 147, "y": 60, "flags": 1}, + {"matrix": [4, 11], "x": 162, "y": 60, "flags": 1}, + {"matrix": [4, 12], "x": 176, "y": 60, "flags": 1}, + {"matrix": [4, 13], "x": 195, "y": 64, "flags": 1}, + {"matrix": [2, 12], "x": 209, "y": 64, "flags": 1}, + {"matrix": [4, 14], "x": 224, "y": 64, "flags": 1} + ] } } diff --git a/keyboards/keychron/q2/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/q2/ansi/keymaps/keychron/keymap.c new file mode 100644 index 0000000000..b10081d635 --- /dev/null +++ b/keyboards/keychron/q2/ansi/keymaps/keychron/keymap.c @@ -0,0 +1,68 @@ +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) + * + * 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 +#include "keychron_common.h" + +enum layers { + MAC_BASE, + WIN_BASE, + MAC_FN1, + WIN_FN1, + _FN2, +}; + +#define FN1_MAC MO(MAC_FN1) +#define FN1_WIN MO(WIN_FN1) +#define FN2 MO(_FN2) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_ansi_67( + 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_INS, + 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_DEL, + 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_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, FN1_MAC, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_BASE] = LAYOUT_ansi_67( + 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_INS, + 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_DEL, + 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_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, FN1_WIN, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN1] = LAYOUT_ansi_67( + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_FN1] = LAYOUT_ansi_67( + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_FN2] = LAYOUT_ansi_67( + KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; diff --git a/keyboards/keychron/q2/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q2/ansi/keymaps/keychron/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/keychron/q2/ansi/keymaps/keychron/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/q2/ansi/rules.mk b/keyboards/keychron/q2/ansi/rules.mk new file mode 100644 index 0000000000..a6f3eba233 --- /dev/null +++ b/keyboards/keychron/q2/ansi/rules.mk @@ -0,0 +1 @@ +KEYCHRON_RGB_ENABLE = yes diff --git a/keyboards/keychron/q2/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q2/ansi_encoder/ansi_encoder.c index 3d135e8722..8720cd2cd9 100644 --- a/keyboards/keychron/q2/ansi_encoder/ansi_encoder.c +++ b/keyboards/keychron/q2/ansi_encoder/ansi_encoder.c @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -16,6 +16,7 @@ #include "quantum.h" +// clang-format off #ifdef RGB_MATRIX_ENABLE const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { /* Refer to SNLED27351 manual for these locations @@ -38,7 +39,6 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { {0, CB3_CA12, CB1_CA12, CB2_CA12}, {0, CB3_CA13, CB1_CA13, CB2_CA13}, {0, CB3_CA14, CB1_CA14, CB2_CA14}, - {0, CB3_CA16, CB1_CA16, CB2_CA16}, {0, CB6_CA1, CB4_CA1, CB5_CA1}, {0, CB6_CA2, CB4_CA2, CB5_CA2}, @@ -97,4 +97,25 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { {1, CB6_CA16, CB4_CA16, CB5_CA16}, }; -#endif // RGB_MATRIX_ENABLE +// Default Color of Per Key RGB +#define DC_RED {HSV_RED} +#define DC_BLU {HSV_BLUE} +#define DC_YLW {HSV_YELLOW} + +HSV default_per_key_led[RGB_MATRIX_LED_COUNT] = { + DC_RED, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_RED, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, DC_YLW, + DC_YLW, DC_YLW, DC_YLW, DC_BLU, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW +}; + +// Default mixed RGB region +uint8_t default_region[RGB_MATRIX_LED_COUNT] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; +#endif diff --git a/keyboards/keychron/q2/ansi_encoder/config.h b/keyboards/keychron/q2/ansi_encoder/config.h index 1850088b1f..6dc59670ae 100644 --- a/keyboards/keychron/q2/ansi_encoder/config.h +++ b/keyboards/keychron/q2/ansi_encoder/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -16,5 +16,8 @@ #pragma once +/* Encoder Configuration*/ +#define ENCODER_DEFAULT_POS 0x3 + /* Enable caps-lock LED */ -#define CAPS_LOCK_LED_INDEX 30 \ No newline at end of file +#define CAPS_LOCK_INDEX 29 diff --git a/keyboards/keychron/q2/ansi_encoder/keyboard.json b/keyboards/keychron/q2/ansi_encoder/keyboard.json index 1e1f22bada..32784c63a4 100644 --- a/keyboards/keychron/q2/ansi_encoder/keyboard.json +++ b/keyboards/keychron/q2/ansi_encoder/keyboard.json @@ -1,91 +1,14 @@ { "usb": { "pid": "0x0111", - "device_version": "1.0.0" + "device_version": "1.1.0" }, "encoder": { - "enabled": true, "rotary": [ {"pin_a": "A10", "pin_b": "B5"} ] }, - "rgb_matrix": { - "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, - {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4}, - {"matrix": [0, 2], "x": 29, "y": 0, "flags": 4}, - {"matrix": [0, 3], "x": 44, "y": 0, "flags": 4}, - {"matrix": [0, 4], "x": 59, "y": 0, "flags": 4}, - {"matrix": [0, 5], "x": 73, "y": 0, "flags": 4}, - {"matrix": [0, 6], "x": 88, "y": 0, "flags": 4}, - {"matrix": [0, 7], "x": 103, "y": 0, "flags": 4}, - {"matrix": [0, 8], "x": 118, "y": 0, "flags": 4}, - {"matrix": [0, 9], "x": 132, "y": 0, "flags": 4}, - {"matrix": [0, 10], "x": 147, "y": 0, "flags": 4}, - {"matrix": [0, 11], "x": 162, "y": 0, "flags": 4}, - {"matrix": [0, 12], "x": 176, "y": 0, "flags": 4}, - {"matrix": [0, 13], "x": 198, "y": 0, "flags": 1}, - {"matrix": [0, 14], "x": 224, "y": 0, "flags": 1}, - - {"matrix": [1, 0], "x": 4, "y": 15, "flags": 1}, - {"matrix": [1, 1], "x": 22, "y": 15, "flags": 4}, - {"matrix": [1, 2], "x": 37, "y": 15, "flags": 4}, - {"matrix": [1, 3], "x": 51, "y": 15, "flags": 4}, - {"matrix": [1, 4], "x": 66, "y": 15, "flags": 4}, - {"matrix": [1, 5], "x": 81, "y": 15, "flags": 4}, - {"matrix": [1, 6], "x": 95, "y": 15, "flags": 4}, - {"matrix": [1, 7], "x": 110, "y": 15, "flags": 4}, - {"matrix": [1, 8], "x": 125, "y": 15, "flags": 4}, - {"matrix": [1, 9], "x": 140, "y": 15, "flags": 4}, - {"matrix": [1, 10], "x": 154, "y": 15, "flags": 4}, - {"matrix": [1, 11], "x": 169, "y": 15, "flags": 4}, - {"matrix": [1, 12], "x": 184, "y": 15, "flags": 4}, - {"matrix": [1, 13], "x": 202, "y": 15, "flags": 1}, - {"matrix": [1, 14], "x": 224, "y": 15, "flags": 1}, - - {"matrix": [2, 0], "x": 6, "y": 30, "flags": 1}, - {"matrix": [2, 1], "x": 26, "y": 30, "flags": 4}, - {"matrix": [2, 2], "x": 40, "y": 30, "flags": 4}, - {"matrix": [2, 3], "x": 55, "y": 30, "flags": 4}, - {"matrix": [2, 4], "x": 70, "y": 30, "flags": 4}, - {"matrix": [2, 5], "x": 84, "y": 30, "flags": 4}, - {"matrix": [2, 6], "x": 99, "y": 30, "flags": 4}, - {"matrix": [2, 7], "x": 114, "y": 30, "flags": 4}, - {"matrix": [2, 8], "x": 129, "y": 30, "flags": 4}, - {"matrix": [2, 9], "x": 143, "y": 30, "flags": 4}, - {"matrix": [2, 10], "x": 158, "y": 30, "flags": 4}, - {"matrix": [2, 11], "x": 173, "y": 30, "flags": 4}, - {"matrix": [2, 13], "x": 196, "y": 30, "flags": 1}, - {"matrix": [2, 14], "x": 224, "y": 30, "flags": 1}, - - {"matrix": [3, 0], "x": 9, "y": 45, "flags": 1}, - {"matrix": [3, 2], "x": 33, "y": 45, "flags": 4}, - {"matrix": [3, 3], "x": 48, "y": 45, "flags": 4}, - {"matrix": [3, 4], "x": 62, "y": 45, "flags": 4}, - {"matrix": [3, 5], "x": 77, "y": 45, "flags": 4}, - {"matrix": [3, 6], "x": 92, "y": 45, "flags": 4}, - {"matrix": [3, 7], "x": 106, "y": 45, "flags": 4}, - {"matrix": [3, 8], "x": 121, "y": 45, "flags": 4}, - {"matrix": [3, 9], "x": 136, "y": 45, "flags": 4}, - {"matrix": [3, 10], "x": 151, "y": 45, "flags": 4}, - {"matrix": [3, 11], "x": 165, "y": 45, "flags": 4}, - {"matrix": [3, 13], "x": 185, "y": 45, "flags": 1}, - {"matrix": [3, 14], "x": 209, "y": 49, "flags": 1}, - - {"matrix": [4, 0], "x": 2, "y": 60, "flags": 1}, - {"matrix": [4, 1], "x": 20, "y": 60, "flags": 1}, - {"matrix": [4, 2], "x": 39, "y": 60, "flags": 1}, - {"matrix": [4, 6], "x": 94, "y": 60, "flags": 4}, - {"matrix": [4, 10], "x": 147, "y": 60, "flags": 1}, - {"matrix": [4, 11], "x": 162, "y": 60, "flags": 1}, - {"matrix": [4, 12], "x": 176, "y": 60, "flags": 1}, - {"matrix": [4, 13], "x": 195, "y": 64, "flags": 1}, - {"matrix": [2, 12], "x": 209, "y": 64, "flags": 1}, - {"matrix": [4, 14], "x": 224, "y": 64, "flags": 1} - - ] - }, - "layouts": { + "layouts": { "LAYOUT_ansi_67": { "layout": [ {"matrix": [0, 0], "x": 0, "y": 0.25}, @@ -161,5 +84,79 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.5} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, + {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 29, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 44, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 59, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 73, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 88, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 103, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 118, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 132, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 147, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 162, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 176, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 198, "y": 0, "flags": 1}, + + {"matrix": [1, 0], "x": 4, "y": 15, "flags": 1}, + {"matrix": [1, 1], "x": 22, "y": 15, "flags": 4}, + {"matrix": [1, 2], "x": 37, "y": 15, "flags": 4}, + {"matrix": [1, 3], "x": 51, "y": 15, "flags": 4}, + {"matrix": [1, 4], "x": 66, "y": 15, "flags": 4}, + {"matrix": [1, 5], "x": 81, "y": 15, "flags": 4}, + {"matrix": [1, 6], "x": 95, "y": 15, "flags": 4}, + {"matrix": [1, 7], "x": 110, "y": 15, "flags": 4}, + {"matrix": [1, 8], "x": 125, "y": 15, "flags": 4}, + {"matrix": [1, 9], "x": 140, "y": 15, "flags": 4}, + {"matrix": [1, 10], "x": 154, "y": 15, "flags": 4}, + {"matrix": [1, 11], "x": 169, "y": 15, "flags": 4}, + {"matrix": [1, 12], "x": 184, "y": 15, "flags": 4}, + {"matrix": [1, 13], "x": 202, "y": 15, "flags": 1}, + {"matrix": [1, 14], "x": 224, "y": 15, "flags": 1}, + + {"matrix": [2, 0], "x": 6, "y": 30, "flags": 1}, + {"matrix": [2, 1], "x": 26, "y": 30, "flags": 4}, + {"matrix": [2, 2], "x": 40, "y": 30, "flags": 4}, + {"matrix": [2, 3], "x": 55, "y": 30, "flags": 4}, + {"matrix": [2, 4], "x": 70, "y": 30, "flags": 4}, + {"matrix": [2, 5], "x": 84, "y": 30, "flags": 4}, + {"matrix": [2, 6], "x": 99, "y": 30, "flags": 4}, + {"matrix": [2, 7], "x": 114, "y": 30, "flags": 4}, + {"matrix": [2, 8], "x": 129, "y": 30, "flags": 4}, + {"matrix": [2, 9], "x": 143, "y": 30, "flags": 4}, + {"matrix": [2, 10], "x": 158, "y": 30, "flags": 4}, + {"matrix": [2, 11], "x": 173, "y": 30, "flags": 4}, + {"matrix": [2, 13], "x": 196, "y": 30, "flags": 1}, + {"matrix": [2, 14], "x": 224, "y": 30, "flags": 1}, + + {"matrix": [3, 0], "x": 9, "y": 45, "flags": 1}, + {"matrix": [3, 2], "x": 33, "y": 45, "flags": 4}, + {"matrix": [3, 3], "x": 48, "y": 45, "flags": 4}, + {"matrix": [3, 4], "x": 62, "y": 45, "flags": 4}, + {"matrix": [3, 5], "x": 77, "y": 45, "flags": 4}, + {"matrix": [3, 6], "x": 92, "y": 45, "flags": 4}, + {"matrix": [3, 7], "x": 106, "y": 45, "flags": 4}, + {"matrix": [3, 8], "x": 121, "y": 45, "flags": 4}, + {"matrix": [3, 9], "x": 136, "y": 45, "flags": 4}, + {"matrix": [3, 10], "x": 151, "y": 45, "flags": 4}, + {"matrix": [3, 11], "x": 165, "y": 45, "flags": 4}, + {"matrix": [3, 13], "x": 185, "y": 45, "flags": 1}, + {"matrix": [3, 14], "x": 209, "y": 49, "flags": 1}, + + {"matrix": [4, 0], "x": 2, "y": 60, "flags": 1}, + {"matrix": [4, 1], "x": 20, "y": 60, "flags": 1}, + {"matrix": [4, 2], "x": 39, "y": 60, "flags": 1}, + {"matrix": [4, 6], "x": 94, "y": 60, "flags": 4}, + {"matrix": [4, 10], "x": 147, "y": 60, "flags": 1}, + {"matrix": [4, 11], "x": 162, "y": 60, "flags": 1}, + {"matrix": [4, 12], "x": 176, "y": 60, "flags": 1}, + {"matrix": [4, 13], "x": 195, "y": 64, "flags": 1}, + {"matrix": [2, 12], "x": 209, "y": 64, "flags": 1}, + {"matrix": [4, 14], "x": 224, "y": 64, "flags": 1} + ] } } diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/keymap.c new file mode 100644 index 0000000000..b4b1b89449 --- /dev/null +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/keymap.c @@ -0,0 +1,78 @@ +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) + * + * 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 +#include "keychron_common.h" + +enum layers { + MAC_BASE, + WIN_BASE, + MAC_FN1, + WIN_FN1, + _FN2, +}; + +#define FN1_MAC MO(MAC_FN1) +#define FN1_WIN MO(WIN_FN1) +#define FN2 MO(_FN2) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_ansi_67( + 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_MUTE, + 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_DEL, + 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_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, FN1_MAC, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_BASE] = LAYOUT_ansi_67( + 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_MUTE, + 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_DEL, + 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_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, FN1_WIN, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN1] = LAYOUT_ansi_67( + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, UG_TOGG, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_FN1] = LAYOUT_ansi_67( + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, UG_TOGG, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_FN2] = LAYOUT_ansi_67( + KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [MAC_FN1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, + [WIN_FN1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, + [_FN2] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, +}; +#endif diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/rules.mk new file mode 100644 index 0000000000..715838ecc5 --- /dev/null +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +VIA_ENABLE = yes diff --git a/keyboards/keychron/q2/ansi_encoder/readme.md b/keyboards/keychron/q2/ansi_encoder/readme.md index 2bb5d3bca8..a6f3eba233 100644 --- a/keyboards/keychron/q2/ansi_encoder/readme.md +++ b/keyboards/keychron/q2/ansi_encoder/readme.md @@ -1,5 +1 @@ -# The ANSI variant of the Keychron Q2 and support encoder - -- Enable EC11 rotary encoder -- Turn colckwise to increase volume and turn anti-colckwise to decrease volume -- Press top right key pushbutton to mute +KEYCHRON_RGB_ENABLE = yes diff --git a/keyboards/keychron/q2/ansi_encoder/rules.mk b/keyboards/keychron/q2/ansi_encoder/rules.mk new file mode 100644 index 0000000000..a6f3eba233 --- /dev/null +++ b/keyboards/keychron/q2/ansi_encoder/rules.mk @@ -0,0 +1 @@ +KEYCHRON_RGB_ENABLE = yes diff --git a/keyboards/keychron/q2/config.h b/keyboards/keychron/q2/config.h index 8b446442cb..c134163eef 100644 --- a/keyboards/keychron/q2/config.h +++ b/keyboards/keychron/q2/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -16,13 +16,31 @@ #pragma once -#define MATRIX_UNSELECT_DRIVE_HIGH +#include "eeconfig_kb.h" +#ifdef RGB_MATRIX_ENABLE /* RGB Matrix Driver Configuration */ #define SNLED27351_I2C_ADDRESS_1 SNLED27351_I2C_ADDRESS_VDDIO #define SNLED27351_I2C_ADDRESS_2 SNLED27351_I2C_ADDRESS_GND -#define SNLED27351_PHASE_CHANNEL SNLED27351_SCAN_PHASE_9_CHANNEL +/* Increase I2C speed to 1000 KHz */ +#define I2C1_TIMINGR_PRESC 0U +#define I2C1_TIMINGR_SCLDEL 3U +#define I2C1_TIMINGR_SDADEL 0U +#define I2C1_TIMINGR_SCLH 15U +#define I2C1_TIMINGR_SCLL 51U -/* Encoder Configuration*/ -#define ENCODER_DEFAULT_POS 0x3 +/* Set LED Current */ +#define SNLED27351_PHASE_CHANNEL SNLED27351_SCAN_PHASE_9_CHANNEL +#define SNLED27351_CURRENT_TUNE \ + { 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D } +#endif + +#define CUSTOM_KEYCODES_ENABLE + +#define MATRIX_UNSELECT_DRIVE_HIGH + +/* Factory test keys */ +#define FN_KEY_1 MO(2) +#define FN_KEY_2 MO(3) +#define FN_KEY_3 MO(4) diff --git a/keyboards/keychron/q2/halconf.h b/keyboards/keychron/q2/halconf.h index 41bddcb279..de493a40f0 100644 --- a/keyboards/keychron/q2/halconf.h +++ b/keyboards/keychron/q2/halconf.h @@ -1,4 +1,4 @@ -/* Copyright 2020 QMK +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -18,4 +18,8 @@ #define HAL_USE_I2C TRUE +#if defined(ENCODER_ENABLE) +# define PAL_USE_CALLBACKS TRUE +#endif + #include_next diff --git a/keyboards/keychron/q2/info.json b/keyboards/keychron/q2/info.json index c322a9902f..78678c670d 100644 --- a/keyboards/keychron/q2/info.json +++ b/keyboards/keychron/q2/info.json @@ -1,16 +1,12 @@ { - "keyboard_name": "Keychron Q2", "manufacturer": "Keychron", - "maintainer": "lalalademaxiya1", + "keyboard_name": "Keychron Q2", + "url": "https://github.com/Keychron", + "maintainer": "Keychron", + "processor": "STM32L432", "bootloader": "stm32-dfu", - "diode_direction": "ROW2COL", - "dynamic_keymap": { - "layer_count": 5 - }, - "eeprom": { - "wear_leveling": { - "backing_size": 4096 - } + "usb": { + "vid": "0x3434" }, "features": { "bootmagic": true, @@ -27,8 +23,24 @@ "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"], "rows": ["B4", "B3", "A15", "A14", "A13"] }, - "processor": "STM32L432", + "diode_direction": "ROW2COL", + "build": { + "debounce_type": "custom" + }, + "debounce": 50, + "eeprom": { + "wear_leveling": { + "driver": "embedded_flash", + "logical_size": 3072, + "backing_size": 6144 + } + }, + "dynamic_keymap": { + "layer_count": 5 + }, "rgb_matrix": { + "driver": "snled27351", + "sleep": true, "animations": { "band_spiral_val": true, "breathing": true, @@ -51,12 +63,6 @@ "solid_splash": true, "splash": true, "typing_heatmap": true - }, - "driver": "snled27351", - "sleep": true - }, - "url": "https://github.com/Keychron", - "usb": { - "vid": "0x3434" + } } -} \ No newline at end of file +} diff --git a/keyboards/keychron/q2/iso/config.h b/keyboards/keychron/q2/iso/config.h index 22ddcba3ad..2f3137ede8 100644 --- a/keyboards/keychron/q2/iso/config.h +++ b/keyboards/keychron/q2/iso/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -17,4 +17,4 @@ #pragma once /* Enable caps-lock LED */ -#define CAPS_LOCK_LED_INDEX 29 \ No newline at end of file +#define CAPS_LOCK_INDEX 29 diff --git a/keyboards/keychron/q2/iso/iso.c b/keyboards/keychron/q2/iso/iso.c index a4117bd7b6..0513fec8e6 100644 --- a/keyboards/keychron/q2/iso/iso.c +++ b/keyboards/keychron/q2/iso/iso.c @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -17,6 +17,8 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE + +// clang-format off const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { /* Refer to SNLED27351 manual for these locations * driver @@ -98,4 +100,25 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { {1, CB6_CA16, CB4_CA16, CB5_CA16} }; -#endif // RGB_MATRIX_ENABLE +// Default Color of Per Key RGB +#define DC_RED {HSV_RED} +#define DC_BLU {HSV_BLUE} +#define DC_YLW {HSV_YELLOW} + +HSV default_per_key_led[RGB_MATRIX_LED_COUNT] = { + DC_RED, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_RED, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, DC_YLW, + DC_YLW, DC_YLW, DC_YLW, DC_BLU, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW +}; + +// Default mixed RGB region +uint8_t default_region[RGB_MATRIX_LED_COUNT] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; +#endif diff --git a/keyboards/keychron/q2/iso/keyboard.json b/keyboards/keychron/q2/iso/keyboard.json index 8a2023320d..5e7285d07b 100644 --- a/keyboards/keychron/q2/iso/keyboard.json +++ b/keyboards/keychron/q2/iso/keyboard.json @@ -1,24 +1,24 @@ { "usb": { "pid": "0x0112", - "device_version": "1.0.0" + "device_version": "1.1.0" }, "rgb_matrix": { "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, - {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4}, - {"matrix": [0, 2], "x": 29, "y": 0, "flags": 4}, - {"matrix": [0, 3], "x": 44, "y": 0, "flags": 4}, - {"matrix": [0, 4], "x": 59, "y": 0, "flags": 4}, - {"matrix": [0, 5], "x": 73, "y": 0, "flags": 4}, - {"matrix": [0, 6], "x": 88, "y": 0, "flags": 4}, - {"matrix": [0, 7], "x": 103, "y": 0, "flags": 4}, - {"matrix": [0, 8], "x": 118, "y": 0, "flags": 4}, - {"matrix": [0, 9], "x": 132, "y": 0, "flags": 4}, - {"matrix": [0, 10], "x": 147, "y": 0, "flags": 4}, - {"matrix": [0, 11], "x": 162, "y": 0, "flags": 4}, - {"matrix": [0, 12], "x": 176, "y": 0, "flags": 4}, - {"matrix": [0, 13], "x": 198, "y": 0, "flags": 1}, + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, + {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 29, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 44, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 59, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 73, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 88, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 103, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 118, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 132, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 147, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 162, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 176, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 198, "y": 0, "flags": 1}, {"matrix": [0, 14], "x": 224, "y": 0, "flags": 1}, {"matrix": [1, 0], "x": 4, "y": 15, "flags": 1}, @@ -52,7 +52,7 @@ {"matrix": [1, 13], "x": 204, "y": 23, "flags": 1}, {"matrix": [2, 14], "x": 224, "y": 30, "flags": 1}, - {"matrix": [3, 0], "x": 9, "y": 45, "flags": 1}, + {"matrix": [3, 0], "x": 2, "y": 45, "flags": 1}, {"matrix": [3, 1], "x": 18, "y": 45, "flags": 4}, {"matrix": [3, 2], "x": 33, "y": 45, "flags": 4}, {"matrix": [3, 3], "x": 48, "y": 45, "flags": 4}, diff --git a/keyboards/keychron/q2/iso/keymaps/keychron/keymap.c b/keyboards/keychron/q2/iso/keymaps/keychron/keymap.c new file mode 100644 index 0000000000..9528402ac3 --- /dev/null +++ b/keyboards/keychron/q2/iso/keymaps/keychron/keymap.c @@ -0,0 +1,68 @@ +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) + * + * 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 +#include "keychron_common.h" + +enum layers { + MAC_BASE, + WIN_BASE, + MAC_FN1, + WIN_FN1, + _FN2, +}; + +#define FN1_MAC MO(MAC_FN1) +#define FN1_WIN MO(WIN_FN1) +#define FN2 MO(_FN2) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_iso_68( + 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_INS, + 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_DEL, + 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_HOME, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, FN1_MAC, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_BASE] = LAYOUT_iso_68( + 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_INS, + 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_DEL, + 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_HOME, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, FN1_WIN, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN1] = LAYOUT_iso_68( + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_FN1] = LAYOUT_iso_68( + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_FN2] = LAYOUT_iso_68( + KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; diff --git a/keyboards/keychron/q2/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q2/iso/keymaps/keychron/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/keychron/q2/iso/keymaps/keychron/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/q2/iso/rules.mk b/keyboards/keychron/q2/iso/rules.mk new file mode 100644 index 0000000000..a6f3eba233 --- /dev/null +++ b/keyboards/keychron/q2/iso/rules.mk @@ -0,0 +1 @@ +KEYCHRON_RGB_ENABLE = yes diff --git a/keyboards/keychron/q2/iso_encoder/config.h b/keyboards/keychron/q2/iso_encoder/config.h index 22ddcba3ad..98563a5ac0 100644 --- a/keyboards/keychron/q2/iso_encoder/config.h +++ b/keyboards/keychron/q2/iso_encoder/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -16,5 +16,8 @@ #pragma once +/* Encoder Configuration */ +#define ENCODER_DEFAULT_POS 0x3 + /* Enable caps-lock LED */ -#define CAPS_LOCK_LED_INDEX 29 \ No newline at end of file +#define CAPS_LOCK_INDEX 28 diff --git a/keyboards/keychron/q2/iso_encoder/iso_encoder.c b/keyboards/keychron/q2/iso_encoder/iso_encoder.c index a4117bd7b6..10408a3c4e 100644 --- a/keyboards/keychron/q2/iso_encoder/iso_encoder.c +++ b/keyboards/keychron/q2/iso_encoder/iso_encoder.c @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -17,6 +17,8 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE + +// clang-format off const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { /* Refer to SNLED27351 manual for these locations * driver @@ -38,7 +40,6 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { {0, CB3_CA12, CB1_CA12, CB2_CA12}, {0, CB3_CA13, CB1_CA13, CB2_CA13}, {0, CB3_CA14, CB1_CA14, CB2_CA14}, - {0, CB3_CA16, CB1_CA16, CB2_CA16}, {0, CB6_CA1, CB4_CA1, CB5_CA1}, {0, CB6_CA2, CB4_CA2, CB5_CA2}, @@ -98,4 +99,25 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { {1, CB6_CA16, CB4_CA16, CB5_CA16} }; +// Default Color of Per Key RGB +#define DC_RED {HSV_RED} +#define DC_BLU {HSV_BLUE} +#define DC_YLW {HSV_YELLOW} + +HSV default_per_key_led[RGB_MATRIX_LED_COUNT] = { + DC_RED, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_RED, DC_YLW, + DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, DC_YLW, + DC_YLW, DC_YLW, DC_YLW, DC_BLU, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW +}; + +// Default mixed RGB region +uint8_t default_region[RGB_MATRIX_LED_COUNT] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q2/iso_encoder/keyboard.json b/keyboards/keychron/q2/iso_encoder/keyboard.json index b828c88931..53facaafc0 100644 --- a/keyboards/keychron/q2/iso_encoder/keyboard.json +++ b/keyboards/keychron/q2/iso_encoder/keyboard.json @@ -1,31 +1,29 @@ { "usb": { "pid": "0x0113", - "device_version": "1.0.0" + "device_version": "1.1.0" }, "encoder": { - "enabled": true, "rotary": [ {"pin_a": "A10", "pin_b": "B5"} ] }, "rgb_matrix": { "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, - {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4}, - {"matrix": [0, 2], "x": 29, "y": 0, "flags": 4}, - {"matrix": [0, 3], "x": 44, "y": 0, "flags": 4}, - {"matrix": [0, 4], "x": 59, "y": 0, "flags": 4}, - {"matrix": [0, 5], "x": 73, "y": 0, "flags": 4}, - {"matrix": [0, 6], "x": 88, "y": 0, "flags": 4}, - {"matrix": [0, 7], "x": 103, "y": 0, "flags": 4}, - {"matrix": [0, 8], "x": 118, "y": 0, "flags": 4}, - {"matrix": [0, 9], "x": 132, "y": 0, "flags": 4}, - {"matrix": [0, 10], "x": 147, "y": 0, "flags": 4}, - {"matrix": [0, 11], "x": 162, "y": 0, "flags": 4}, - {"matrix": [0, 12], "x": 176, "y": 0, "flags": 4}, - {"matrix": [0, 13], "x": 198, "y": 0, "flags": 1}, - {"matrix": [0, 14], "x": 224, "y": 0, "flags": 1}, + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, + {"matrix": [0, 1], "x": 15, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 29, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 44, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 59, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 73, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 88, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 103, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 118, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 132, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 147, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 162, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 176, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 198, "y": 0, "flags": 1}, {"matrix": [1, 0], "x": 4, "y": 15, "flags": 1}, {"matrix": [1, 1], "x": 22, "y": 15, "flags": 4}, diff --git a/keyboards/keychron/q2/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q2/iso_encoder/keymaps/keychron/keymap.c new file mode 100644 index 0000000000..ecc457f618 --- /dev/null +++ b/keyboards/keychron/q2/iso_encoder/keymaps/keychron/keymap.c @@ -0,0 +1,78 @@ +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) + * + * 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 +#include "keychron_common.h" + +enum layers { + MAC_BASE, + WIN_BASE, + MAC_FN1, + WIN_FN1, + _FN2, +}; + +#define FN1_MAC MO(MAC_FN1) +#define FN1_WIN MO(WIN_FN1) +#define FN2 MO(_FN2) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_iso_68( + 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_MUTE, + 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_DEL, + 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_HOME, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, FN1_MAC, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_BASE] = LAYOUT_iso_68( + 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_MUTE, + 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_DEL, + 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_HOME, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, FN1_WIN, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN1] = LAYOUT_iso_68( + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_FN1] = LAYOUT_iso_68( + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_FN2] = LAYOUT_iso_68( + KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [MAC_FN1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, + [WIN_FN1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, + [_FN2] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, +}; +#endif diff --git a/keyboards/keychron/q2/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q2/iso_encoder/keymaps/keychron/rules.mk new file mode 100644 index 0000000000..6ccd6d9194 --- /dev/null +++ b/keyboards/keychron/q2/iso_encoder/keymaps/keychron/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +VIA_ENABLE = yes \ No newline at end of file diff --git a/keyboards/keychron/q2/iso_encoder/rules.mk b/keyboards/keychron/q2/iso_encoder/rules.mk new file mode 100644 index 0000000000..a6f3eba233 --- /dev/null +++ b/keyboards/keychron/q2/iso_encoder/rules.mk @@ -0,0 +1 @@ +KEYCHRON_RGB_ENABLE = yes diff --git a/keyboards/keychron/q2/jis/keymaps/keychron/keymap.c b/keyboards/keychron/q2/jis/keymaps/keychron/keymap.c new file mode 100644 index 0000000000..5b06b49bd4 --- /dev/null +++ b/keyboards/keychron/q2/jis/keymaps/keychron/keymap.c @@ -0,0 +1,68 @@ +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) + * + * 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 +#include "keychron_common.h" + +enum layers { + MAC_BASE, + WIN_BASE, + MAC_FN1, + WIN_FN1, + _FN2, +}; + +#define FN1_MAC MO(MAC_FN1) +#define FN1_WIN MO(WIN_FN1) +#define FN2 MO(_FN2) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_jis_71( + 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_INT3, KC_BSPC, KC_INS, + 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_DEL, + 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_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, FN1_MAC, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_BASE] = LAYOUT_jis_71( + 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_INT3, KC_BSPC, KC_INS, + 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_DEL, + 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_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, FN1_WIN, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN1] = LAYOUT_jis_71( + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_FN1] = LAYOUT_jis_71( + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_FN2] = LAYOUT_jis_71( + KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; diff --git a/keyboards/keychron/q2/jis/keymaps/keychron/rules.mk b/keyboards/keychron/q2/jis/keymaps/keychron/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/keychron/q2/jis/keymaps/keychron/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/q2/jis_encoder/keyboard.json b/keyboards/keychron/q2/jis_encoder/keyboard.json index 11204e720f..0e94fd837b 100644 --- a/keyboards/keychron/q2/jis_encoder/keyboard.json +++ b/keyboards/keychron/q2/jis_encoder/keyboard.json @@ -4,91 +4,11 @@ "device_version": "1.0.0" }, "encoder": { - "enabled": true, "rotary": [ {"pin_a": "A10", "pin_b": "B5"} ] }, - "rgb_matrix": { - "layout": [ - {"matrix": [0, 0], "x": 0, "y": 4, "flags": 1}, - {"matrix": [0, 1], "x": 15, "y": 4, "flags": 4}, - {"matrix": [0, 2], "x": 29, "y": 4, "flags": 4}, - {"matrix": [0, 3], "x": 44, "y": 4, "flags": 4}, - {"matrix": [0, 4], "x": 59, "y": 4, "flags": 4}, - {"matrix": [0, 5], "x": 73, "y": 4, "flags": 4}, - {"matrix": [0, 6], "x": 88, "y": 4, "flags": 4}, - {"matrix": [0, 7], "x": 103, "y": 4, "flags": 4}, - {"matrix": [0, 8], "x": 118, "y": 4, "flags": 4}, - {"matrix": [0, 9], "x": 132, "y": 4, "flags": 4}, - {"matrix": [0, 10], "x": 147, "y": 4, "flags": 4}, - {"matrix": [0, 11], "x": 162, "y": 4, "flags": 4}, - {"matrix": [0, 12], "x": 176, "y": 4, "flags": 4}, - {"matrix": [0, 13], "x": 191, "y": 4, "flags": 4}, - {"matrix": [3, 1], "x": 206, "y": 4, "flags": 1}, - {"matrix": [0, 14], "x": 224, "y": 0, "flags": 1}, - - {"matrix": [1, 0], "x": 4, "y": 19, "flags": 1}, - {"matrix": [1, 1], "x": 22, "y": 19, "flags": 4}, - {"matrix": [1, 2], "x": 37, "y": 19, "flags": 4}, - {"matrix": [1, 3], "x": 51, "y": 19, "flags": 4}, - {"matrix": [1, 4], "x": 66, "y": 19, "flags": 4}, - {"matrix": [1, 5], "x": 81, "y": 19, "flags": 4}, - {"matrix": [1, 6], "x": 95, "y": 19, "flags": 4}, - {"matrix": [1, 7], "x": 110, "y": 19, "flags": 4}, - {"matrix": [1, 8], "x": 125, "y": 19, "flags": 4}, - {"matrix": [1, 9], "x": 140, "y": 19, "flags": 4}, - {"matrix": [1, 10], "x": 154, "y": 19, "flags": 4}, - {"matrix": [1, 11], "x": 169, "y": 19, "flags": 4}, - {"matrix": [1, 12], "x": 184, "y": 19, "flags": 4}, - {"matrix": [1, 14], "x": 224, "y": 19, "flags": 1}, - - {"matrix": [2, 0], "x": 6, "y": 34, "flags": 1}, - {"matrix": [2, 1], "x": 26, "y": 34, "flags": 4}, - {"matrix": [2, 2], "x": 40, "y": 34, "flags": 4}, - {"matrix": [2, 3], "x": 55, "y": 34, "flags": 4}, - {"matrix": [2, 4], "x": 70, "y": 34, "flags": 4}, - {"matrix": [2, 5], "x": 84, "y": 34, "flags": 4}, - {"matrix": [2, 6], "x": 99, "y": 34, "flags": 4}, - {"matrix": [2, 7], "x": 114, "y": 34, "flags": 4}, - {"matrix": [2, 8], "x": 129, "y": 34, "flags": 4}, - {"matrix": [2, 9], "x": 143, "y": 34, "flags": 4}, - {"matrix": [2, 10], "x": 158, "y": 34, "flags": 4}, - {"matrix": [2, 11], "x": 173, "y": 34, "flags": 4}, - {"matrix": [2, 13], "x": 187, "y": 34, "flags": 4}, - {"matrix": [1, 13], "x": 204, "y": 26, "flags": 1}, - {"matrix": [2, 14], "x": 224, "y": 34, "flags": 1}, - - {"matrix": [3, 0], "x": 9, "y": 49, "flags": 1}, - {"matrix": [3, 2], "x": 33, "y": 49, "flags": 4}, - {"matrix": [3, 3], "x": 48, "y": 49, "flags": 4}, - {"matrix": [3, 4], "x": 62, "y": 49, "flags": 4}, - {"matrix": [3, 5], "x": 77, "y": 49, "flags": 4}, - {"matrix": [3, 6], "x": 92, "y": 49, "flags": 4}, - {"matrix": [3, 7], "x": 106, "y": 49, "flags": 4}, - {"matrix": [3, 8], "x": 121, "y": 49, "flags": 4}, - {"matrix": [3, 9], "x": 136, "y": 49, "flags": 4}, - {"matrix": [3, 10], "x": 151, "y": 49, "flags": 4}, - {"matrix": [3, 11], "x": 165, "y": 49, "flags": 4}, - {"matrix": [3, 12], "x": 180, "y": 49, "flags": 4}, - {"matrix": [3, 13], "x": 195, "y": 49, "flags": 1}, - {"matrix": [3, 14], "x": 209, "y": 49, "flags": 1}, - - {"matrix": [4, 0], "x": 2, "y": 64, "flags": 1}, - {"matrix": [4, 1], "x": 18, "y": 64, "flags": 1}, - {"matrix": [4, 2], "x": 35, "y": 64, "flags": 1}, - {"matrix": [4, 3], "x": 51, "y": 64, "flags": 1}, - {"matrix": [4, 6], "x": 92, "y": 64, "flags": 4}, - {"matrix": [4, 9], "x": 134, "y": 64, "flags": 1}, - {"matrix": [4, 10], "x": 151, "y": 64, "flags": 1}, - {"matrix": [4, 11], "x": 165, "y": 64, "flags": 1}, - {"matrix": [4, 12], "x": 180, "y": 64, "flags": 1}, - {"matrix": [4, 13], "x": 195, "y": 64, "flags": 1}, - {"matrix": [2, 12], "x": 209, "y": 64, "flags": 1}, - {"matrix": [4, 14], "x": 224, "y": 64, "flags": 1} - ] - }, - "layouts": { + "layouts": { "LAYOUT_jis_71": { "layout": [ {"matrix": [0, 0], "x": 0, "y": 0.25}, @@ -168,5 +88,84 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 4, "flags": 1}, + {"matrix": [0, 1], "x": 15, "y": 4, "flags": 4}, + {"matrix": [0, 2], "x": 29, "y": 4, "flags": 4}, + {"matrix": [0, 3], "x": 44, "y": 4, "flags": 4}, + {"matrix": [0, 4], "x": 59, "y": 4, "flags": 4}, + {"matrix": [0, 5], "x": 73, "y": 4, "flags": 4}, + {"matrix": [0, 6], "x": 88, "y": 4, "flags": 4}, + {"matrix": [0, 7], "x": 103, "y": 4, "flags": 4}, + {"matrix": [0, 8], "x": 118, "y": 4, "flags": 4}, + {"matrix": [0, 9], "x": 132, "y": 4, "flags": 4}, + {"matrix": [0, 10], "x": 147, "y": 4, "flags": 4}, + {"matrix": [0, 11], "x": 162, "y": 4, "flags": 4}, + {"matrix": [0, 12], "x": 176, "y": 4, "flags": 4}, + {"matrix": [0, 13], "x": 191, "y": 4, "flags": 4}, + {"matrix": [3, 1], "x": 206, "y": 4, "flags": 1}, + {"matrix": [0, 14], "x": 224, "y": 0, "flags": 1}, + + {"matrix": [1, 0], "x": 4, "y": 19, "flags": 1}, + {"matrix": [1, 1], "x": 22, "y": 19, "flags": 4}, + {"matrix": [1, 2], "x": 37, "y": 19, "flags": 4}, + {"matrix": [1, 3], "x": 51, "y": 19, "flags": 4}, + {"matrix": [1, 4], "x": 66, "y": 19, "flags": 4}, + {"matrix": [1, 5], "x": 81, "y": 19, "flags": 4}, + {"matrix": [1, 6], "x": 95, "y": 19, "flags": 4}, + {"matrix": [1, 7], "x": 110, "y": 19, "flags": 4}, + {"matrix": [1, 8], "x": 125, "y": 19, "flags": 4}, + {"matrix": [1, 9], "x": 140, "y": 19, "flags": 4}, + {"matrix": [1, 10], "x": 154, "y": 19, "flags": 4}, + {"matrix": [1, 11], "x": 169, "y": 19, "flags": 4}, + {"matrix": [1, 12], "x": 184, "y": 19, "flags": 4}, + {"matrix": [1, 14], "x": 224, "y": 19, "flags": 1}, + + {"matrix": [2, 0], "x": 6, "y": 34, "flags": 1}, + {"matrix": [2, 1], "x": 26, "y": 34, "flags": 4}, + {"matrix": [2, 2], "x": 40, "y": 34, "flags": 4}, + {"matrix": [2, 3], "x": 55, "y": 34, "flags": 4}, + {"matrix": [2, 4], "x": 70, "y": 34, "flags": 4}, + {"matrix": [2, 5], "x": 84, "y": 34, "flags": 4}, + {"matrix": [2, 6], "x": 99, "y": 34, "flags": 4}, + {"matrix": [2, 7], "x": 114, "y": 34, "flags": 4}, + {"matrix": [2, 8], "x": 129, "y": 34, "flags": 4}, + {"matrix": [2, 9], "x": 143, "y": 34, "flags": 4}, + {"matrix": [2, 10], "x": 158, "y": 34, "flags": 4}, + {"matrix": [2, 11], "x": 173, "y": 34, "flags": 4}, + {"matrix": [2, 13], "x": 187, "y": 34, "flags": 4}, + {"matrix": [1, 13], "x": 204, "y": 26, "flags": 1}, + {"matrix": [2, 14], "x": 224, "y": 34, "flags": 1}, + + {"matrix": [3, 0], "x": 9, "y": 49, "flags": 1}, + {"matrix": [3, 2], "x": 33, "y": 49, "flags": 4}, + {"matrix": [3, 3], "x": 48, "y": 49, "flags": 4}, + {"matrix": [3, 4], "x": 62, "y": 49, "flags": 4}, + {"matrix": [3, 5], "x": 77, "y": 49, "flags": 4}, + {"matrix": [3, 6], "x": 92, "y": 49, "flags": 4}, + {"matrix": [3, 7], "x": 106, "y": 49, "flags": 4}, + {"matrix": [3, 8], "x": 121, "y": 49, "flags": 4}, + {"matrix": [3, 9], "x": 136, "y": 49, "flags": 4}, + {"matrix": [3, 10], "x": 151, "y": 49, "flags": 4}, + {"matrix": [3, 11], "x": 165, "y": 49, "flags": 4}, + {"matrix": [3, 12], "x": 180, "y": 49, "flags": 4}, + {"matrix": [3, 13], "x": 195, "y": 49, "flags": 1}, + {"matrix": [3, 14], "x": 209, "y": 49, "flags": 1}, + + {"matrix": [4, 0], "x": 2, "y": 64, "flags": 1}, + {"matrix": [4, 1], "x": 18, "y": 64, "flags": 1}, + {"matrix": [4, 2], "x": 35, "y": 64, "flags": 1}, + {"matrix": [4, 3], "x": 51, "y": 64, "flags": 1}, + {"matrix": [4, 6], "x": 92, "y": 64, "flags": 4}, + {"matrix": [4, 9], "x": 134, "y": 64, "flags": 1}, + {"matrix": [4, 10], "x": 151, "y": 64, "flags": 1}, + {"matrix": [4, 11], "x": 165, "y": 64, "flags": 1}, + {"matrix": [4, 12], "x": 180, "y": 64, "flags": 1}, + {"matrix": [4, 13], "x": 195, "y": 64, "flags": 1}, + {"matrix": [2, 12], "x": 209, "y": 64, "flags": 1}, + {"matrix": [4, 14], "x": 224, "y": 64, "flags": 1} + ] } } diff --git a/keyboards/keychron/q2/jis_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q2/jis_encoder/keymaps/keychron/keymap.c new file mode 100644 index 0000000000..08ba8f7b7d --- /dev/null +++ b/keyboards/keychron/q2/jis_encoder/keymaps/keychron/keymap.c @@ -0,0 +1,79 @@ +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) + * + * 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 +#include "keychron_common.h" + +enum layers { + MAC_BASE, + WIN_BASE, + MAC_FN1, + WIN_FN1, + _FN2, +}; + +#define FN1_MAC MO(MAC_FN1) +#define FN1_WIN MO(WIN_FN1) +#define FN2 MO(_FN2) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_jis_71( + 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_INT3, KC_BSPC, KC_MUTE, + 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_DEL, + 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_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, FN1_MAC, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_BASE] = LAYOUT_jis_71( + 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_INT3, KC_BSPC, KC_MUTE, + 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_DEL, + 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_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, FN1_WIN, FN2, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN1] = LAYOUT_jis_71( + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, UG_TOGG, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_FN1] = LAYOUT_jis_71( + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, UG_VALD, UG_VALU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, UG_TOGG, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_FN2] = LAYOUT_jis_71( + KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, + UG_TOGG, UG_NEXT, UG_VALU, UG_HUEU, UG_SATU, UG_SPDU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, UG_PREV, UG_VALD, UG_HUED, UG_SATD, UG_SPDD, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [MAC_FN1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, + [WIN_FN1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, + [_FN2] = { ENCODER_CCW_CW(UG_VALD, UG_VALU) }, +}; +#endif + diff --git a/keyboards/keychron/q2/jis_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q2/jis_encoder/keymaps/keychron/rules.mk new file mode 100644 index 0000000000..6ccd6d9194 --- /dev/null +++ b/keyboards/keychron/q2/jis_encoder/keymaps/keychron/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +VIA_ENABLE = yes \ No newline at end of file diff --git a/keyboards/keychron/q2/chconf.h b/keyboards/keychron/q2/keycodes_custom.h similarity index 59% rename from keyboards/keychron/q2/chconf.h rename to keyboards/keychron/q2/keycodes_custom.h index cbbae31079..2e14c70880 100644 --- a/keyboards/keychron/q2/chconf.h +++ b/keyboards/keychron/q2/keycodes_custom.h @@ -1,4 +1,4 @@ -/* Copyright 2020 QMK +/* Copyright 2025 @ Keychron (https://www.keychron.com) * * 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 @@ -16,10 +16,23 @@ #pragma once -#define CH_CFG_ST_FREQUENCY 10000 +#include "keycodes.h" -#define CH_CFG_OPTIMIZE_SPEED FALSE +enum custom_keycodes { + KC_LOPTN = QK_KB_2, + KC_ROPTN, + KC_LCMMD, + KC_RCMMD, + KC_MAC_SIRI, + KC_WIN_TASK_VIEW, + KC_WIN_FILE_EXPLORER, + KC_MAC_SCREEN_SHOT, + KC_WIN_CORTANA, + NEW_SAFE_RANGE, +}; -#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE - -#include_next +#define KC_SIRI KC_MAC_SIRI +#define KC_TASK KC_WIN_TASK_VIEW +#define KC_FILE KC_WIN_FILE_EXPLORER +#define KC_SNAP KC_MAC_SCREEN_SHOT +#define KC_CTANA KC_WIN_CORTANA diff --git a/keyboards/keychron/q2/mcuconf.h b/keyboards/keychron/q2/mcuconf.h index 0ca8c64850..65e9ea080b 100644 --- a/keyboards/keychron/q2/mcuconf.h +++ b/keyboards/keychron/q2/mcuconf.h @@ -1,4 +1,4 @@ -/* Copyright 2020 QMK +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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 diff --git a/keyboards/keychron/q2/q2.c b/keyboards/keychron/q2/q2.c index 01a23b8f3e..0f4a2916d8 100644 --- a/keyboards/keychron/q2/q2.c +++ b/keyboards/keychron/q2/q2.c @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2023 ~ 2025 @ Keychron (https://www.keychron.com) * * 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,58 +14,23 @@ * along with this program. If not, see . */ -#include "quantum.h" +#include "keychron.h" #ifdef DIP_SWITCH_ENABLE - bool dip_switch_update_kb(uint8_t index, bool active) { - if (!dip_switch_update_user(index, active)) { return false;} + if (!dip_switch_update_user(index, active)) { + return false; + } if (index == 0) { default_layer_set(1UL << (active ? 1 : 0)); } return true; } +#endif -#endif // DIP_SWITCH_ENABLE - -#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { return false; } - switch (keycode) { - case QK_RGB_MATRIX_TOGGLE: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } break; - default: { - rgb_matrix_set_flags(LED_FLAG_ALL); - } break; - } - } - if (!rgb_matrix_is_enabled()) { - rgb_matrix_set_flags(LED_FLAG_ALL); - rgb_matrix_enable(); - } - return false; - } - return true; +void keyboard_post_init_kb(void) { + keychron_common_init(); + keyboard_post_init_user(); } -bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { - if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { return false; } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); - } - } - return true; -} - -#endif // CAPS_LOCK_LED_INDEX diff --git a/keyboards/keychron/q2/readme.md b/keyboards/keychron/q2/readme.md index 3abd7280ca..239a934dff 100644 --- a/keyboards/keychron/q2/readme.md +++ b/keyboards/keychron/q2/readme.md @@ -10,22 +10,22 @@ A customizable 65% keyboard. Make example for this keyboard (after setting up your build environment): - make keychron/q2/ansi:default - make keychron/q2/ansi_encoder:default - make keychron/q2/iso:default - make keychron/q2/iso_encoder:default - make keychron/q2/jis:default - make keychron/q2/jis_encoder:default + make keychron/q2/ansi:keychron + make keychron/q2/ansi_encoder:keychron + make keychron/q2/iso:keychron + make keychron/q2/iso_encoder:keychron + make keychron/q2/jis:keychron + make keychron/q2/jis_encoder:keychron Flashing example for this keyboard: - make keychron/q2/ansi:default:flash - make keychron/q2/ansi_encoder:default:flash - make keychron/q2/iso:default:flash - make keychron/q2/iso_encoder:default:flash - make keychron/q2/jis:default:flash - make keychron/q2/jis_encoder:default:flash + make keychron/q2/ansi:keychron:flash + make keychron/q2/ansi_encoder:keychron:flash + make keychron/q2/iso:keychron:flash + make keychron/q2/iso_encoder:keychron:flash + make keychron/q2/jis:keychron:flash + make keychron/q2/jis_encoder:keychron:flash **Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. -See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). \ No newline at end of file +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q2/rules.mk b/keyboards/keychron/q2/rules.mk new file mode 100644 index 0000000000..f23e44b6c3 --- /dev/null +++ b/keyboards/keychron/q2/rules.mk @@ -0,0 +1 @@ +include keyboards/keychron/common/keychron_common.mk diff --git a/keyboards/keychron/q2/via_json/q2_ansi.json b/keyboards/keychron/q2/via_json/q2_ansi.json new file mode 100644 index 0000000000..3ababc65b2 --- /dev/null +++ b/keyboards/keychron/q2/via_json/q2_ansi.json @@ -0,0 +1,396 @@ +{ + "name": "Keychron Q2 ANSI", + "vendorId": "0x3434", + "productId": "0x0110", + "matrix": { + "rows": 5, + "cols": 15 + }, + "customKeycodes": [ + { + "name": "Mission Control", + "title": "Mission Control in macOS", + "shortName": "MCtrl" + }, + { + "name": "Launch Pad", + "title": "Launch Pad in macOS", + "shortName": "LPad" + }, + { + "name": "Left Option", + "title": "Left Option in macOS", + "shortName": "LOpt" + }, + { + "name": "Right Option", + "title": "Right Option in macOS", + "shortName": "ROpt" + }, + { + "name": "Left Cmd", + "title": "Left Command in macOS", + "shortName": "LCmd" + }, + { + "name": "Right Cmd", + "title": "Right Command in macOS", + "shortName": "RCmd" + }, + { + "name": "Siri", + "title": "Siri in macOS", + "shortName": "Siri" + }, + { + "name": "Task View", + "title": "Task View in windows", + "shortName": "Task" + }, + { + "name": "File Explorer", + "title": "File Explorer in windows", + "shortName": "File" + }, + { + "name": "Screen Shot", + "title": "Screenshot in macOS", + "shortName": "SShot" + }, + { + "name": "Cortana", + "title": "Cortana in windows", + "shortName": "Cortana" + } + ], + "keycodes": [ + "qmk_lighting" + ], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [ + 0, + 255 + ], + "content": [ + "id_qmk_rgb_matrix_brightness", + 3, + 1 + ] + }, + { + "label": "Effect", + "type": "dropdown", + "content": [ + "id_qmk_rgb_matrix_effect", + 3, + 2 + ], + "options": [ + [ + "None", + 0 + ], + [ + "Solid Color", + 1 + ], + [ + "Breathing", + 2 + ], + [ + "Band Spiral Val", + 3 + ], + [ + "Cycle All", + 4 + ], + [ + "Cycle Left Right", + 5 + ], + [ + "Cycle Up Down", + 6 + ], + [ + "Rainbow Moving Chevron", + 7 + ], + [ + "Cycle Out In", + 8 + ], + [ + "Cycle Out In Dual", + 9 + ], + [ + "Cycle Pinwheel", + 10 + ], + [ + "Cycle Spiral", + 11 + ], + [ + "Dual Beacon", + 12 + ], + [ + "Rainbow Beacon", + 13 + ], + [ + "Jellybean Raindrops", + 14 + ], + [ + "Pixel Rain", + 15 + ], + [ + "Typing Heatmap", + 16 + ], + [ + "Digital Rain", + 17 + ], + [ + "Reactive Simple", + 18 + ], + [ + "Reactive Multiwide", + 19 + ], + [ + "Reactive Multinexus", + 20 + ], + [ + "Splash", + 21 + ], + [ + "Solid Splash", + 22 + ], + [ + "Per Key RGB", + 23 + ], + [ + "Mix RGB", + 24 + ] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1 && {id_qmk_rgb_matrix_effect} < 23", + "label": "Effect Speed", + "type": "range", + "options": [ + 0, + 255 + ], + "content": [ + "id_qmk_rgb_matrix_effect_speed", + 3, + 3 + ] + }, + { + "showIf": "({id_qmk_rgb_matrix_effect} >= 1 && {id_qmk_rgb_matrix_effect} <= 3) || ({id_qmk_rgb_matrix_effect} >= 18 && {id_qmk_rgb_matrix_effect} <= 20) || {id_qmk_rgb_matrix_effect} == 22", + "label": "Color", + "type": "color", + "content": [ + "id_qmk_rgb_matrix_color", + 3, + 4 + ] + } + ] + } + ] + } + ], + "layouts": { + "keymap": [ + [ + { + "x": 15.25, + "c": "#aaaaaa" + }, + "0,14" + ], + [ + { + "y": -0.75, + "c": "#777777" + }, + "0,0", + { + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + "0,5", + "0,6", + "0,7", + "0,8", + "0,9", + "0,10", + "0,11", + "0,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "0,13" + ], + [ + { + "w": 1.5 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "w": 1.5 + }, + "1,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "1,14" + ], + [ + { + "w": 1.75 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + { + "c": "#777777", + "w": 2.25 + }, + "2,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "2,14" + ], + [ + { + "w": 2.25 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,13" + ], + [ + { + "y": -0.75, + "x": 14.25, + "c": "#cccccc" + }, + "3,14" + ], + [ + { + "y": -0.25, + "c": "#aaaaaa", + "w": 1.25 + }, + "4,0", + { + "w": 1.25 + }, + "4,1", + { + "w": 1.25 + }, + "4,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "4,6", + { + "c": "#aaaaaa" + }, + "4,10", + "4,11", + "4,12" + ], + [ + { + "y": -0.75, + "x": 13.25, + "c": "#cccccc" + }, + "4,13", + "2,12", + "4,14" + ] +] + } +} diff --git a/keyboards/keychron/q2/via_json/q2_ansi_encoder.json b/keyboards/keychron/q2/via_json/q2_ansi_encoder.json new file mode 100644 index 0000000000..5082b1e506 --- /dev/null +++ b/keyboards/keychron/q2/via_json/q2_ansi_encoder.json @@ -0,0 +1,396 @@ +{ + "name": "Keychron Q2 ANSI Knob", + "vendorId": "0x3434", + "productId": "0x0111", + "matrix": { + "rows": 5, + "cols": 15 + }, + "customKeycodes": [ + { + "name": "Mission Control", + "title": "Mission Control in macOS", + "shortName": "MCtrl" + }, + { + "name": "Launch Pad", + "title": "Launch Pad in macOS", + "shortName": "LPad" + }, + { + "name": "Left Option", + "title": "Left Option in macOS", + "shortName": "LOpt" + }, + { + "name": "Right Option", + "title": "Right Option in macOS", + "shortName": "ROpt" + }, + { + "name": "Left Cmd", + "title": "Left Command in macOS", + "shortName": "LCmd" + }, + { + "name": "Right Cmd", + "title": "Right Command in macOS", + "shortName": "RCmd" + }, + { + "name": "Siri", + "title": "Siri in macOS", + "shortName": "Siri" + }, + { + "name": "Task View", + "title": "Task View in windows", + "shortName": "Task" + }, + { + "name": "File Explorer", + "title": "File Explorer in windows", + "shortName": "File" + }, + { + "name": "Screen Shot", + "title": "Screenshot in macOS", + "shortName": "SShot" + }, + { + "name": "Cortana", + "title": "Cortana in windows", + "shortName": "Cortana" + } + ], + "keycodes": [ + "qmk_lighting" + ], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [ + 0, + 255 + ], + "content": [ + "id_qmk_rgb_matrix_brightness", + 3, + 1 + ] + }, + { + "label": "Effect", + "type": "dropdown", + "content": [ + "id_qmk_rgb_matrix_effect", + 3, + 2 + ], + "options": [ + [ + "None", + 0 + ], + [ + "Solid Color", + 1 + ], + [ + "Breathing", + 2 + ], + [ + "Band Spiral Val", + 3 + ], + [ + "Cycle All", + 4 + ], + [ + "Cycle Left Right", + 5 + ], + [ + "Cycle Up Down", + 6 + ], + [ + "Rainbow Moving Chevron", + 7 + ], + [ + "Cycle Out In", + 8 + ], + [ + "Cycle Out In Dual", + 9 + ], + [ + "Cycle Pinwheel", + 10 + ], + [ + "Cycle Spiral", + 11 + ], + [ + "Dual Beacon", + 12 + ], + [ + "Rainbow Beacon", + 13 + ], + [ + "Jellybean Raindrops", + 14 + ], + [ + "Pixel Rain", + 15 + ], + [ + "Typing Heatmap", + 16 + ], + [ + "Digital Rain", + 17 + ], + [ + "Reactive Simple", + 18 + ], + [ + "Reactive Multiwide", + 19 + ], + [ + "Reactive Multinexus", + 20 + ], + [ + "Splash", + 21 + ], + [ + "Solid Splash", + 22 + ], + [ + "Per Key RGB", + 23 + ], + [ + "Mix RGB", + 24 + ] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1 && {id_qmk_rgb_matrix_effect} < 23", + "label": "Effect Speed", + "type": "range", + "options": [ + 0, + 255 + ], + "content": [ + "id_qmk_rgb_matrix_effect_speed", + 3, + 3 + ] + }, + { + "showIf": "({id_qmk_rgb_matrix_effect} >= 1 && {id_qmk_rgb_matrix_effect} <= 3) || ({id_qmk_rgb_matrix_effect} >= 18 && {id_qmk_rgb_matrix_effect} <= 20) || {id_qmk_rgb_matrix_effect} == 22", + "label": "Color", + "type": "color", + "content": [ + "id_qmk_rgb_matrix_color", + 3, + 4 + ] + } + ] + } + ] + } + ], + "layouts": { + "keymap":[ + [ + { + "x": 15.25, + "c": "#aaaaaa" + }, + "0,14\n\n\n\n\n\n\n\n\ne0" + ], + [ + { + "y": -0.75, + "c": "#777777" + }, + "0,0", + { + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + "0,5", + "0,6", + "0,7", + "0,8", + "0,9", + "0,10", + "0,11", + "0,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "0,13" + ], + [ + { + "w": 1.5 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "w": 1.5 + }, + "1,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "1,14" + ], + [ + { + "w": 1.75 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + { + "c": "#777777", + "w": 2.25 + }, + "2,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "2,14" + ], + [ + { + "w": 2.25 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,13" + ], + [ + { + "y": -0.75, + "x": 14.25, + "c": "#cccccc" + }, + "3,14" + ], + [ + { + "y": -0.25, + "c": "#aaaaaa", + "w": 1.25 + }, + "4,0", + { + "w": 1.25 + }, + "4,1", + { + "w": 1.25 + }, + "4,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "4,6", + { + "c": "#aaaaaa" + }, + "4,10", + "4,11", + "4,12" + ], + [ + { + "y": -0.75, + "x": 13.25, + "c": "#cccccc" + }, + "4,13", + "2,12", + "4,14" + ] +] + } +} diff --git a/keyboards/keychron/q2/via_json/q2_iso.json b/keyboards/keychron/q2/via_json/q2_iso.json new file mode 100644 index 0000000000..de7307c943 --- /dev/null +++ b/keyboards/keychron/q2/via_json/q2_iso.json @@ -0,0 +1,396 @@ +{ + "name": "Keychron Q2 ISO", + "vendorId": "0x3434", + "productId": "0x0112", + "matrix": { + "rows": 5, + "cols": 15 + }, + "customKeycodes": [ + { + "name": "Mission Control", + "title": "Mission Control in macOS", + "shortName": "MCtrl" + }, + { + "name": "Launch Pad", + "title": "Launch Pad in macOS", + "shortName": "LPad" + }, + { + "name": "Left Option", + "title": "Left Option in macOS", + "shortName": "LOpt" + }, + { + "name": "Right Option", + "title": "Right Option in macOS", + "shortName": "ROpt" + }, + { + "name": "Left Cmd", + "title": "Left Command in macOS", + "shortName": "LCmd" + }, + { + "name": "Right Cmd", + "title": "Right Command in macOS", + "shortName": "RCmd" + }, + { + "name": "Siri", + "title": "Siri in macOS", + "shortName": "Siri" + }, + { + "name": "Task View", + "title": "Task View in windows", + "shortName": "Task" + }, + { + "name": "File Explorer", + "title": "File Explorer in windows", + "shortName": "File" + }, + { + "name": "Screen Shot", + "title": "Screenshot in macOS", + "shortName": "SShot" + }, + { + "name": "Cortana", + "title": "Cortana in windows", + "shortName": "Cortana" + } + ], + "keycodes": [ + "qmk_lighting" + ], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [ + 0, + 255 + ], + "content": [ + "id_qmk_rgb_matrix_brightness", + 3, + 1 + ] + }, + { + "label": "Effect", + "type": "dropdown", + "content": [ + "id_qmk_rgb_matrix_effect", + 3, + 2 + ], + "options": [ + [ + "None", + 0 + ], + [ + "Solid Color", + 1 + ], + [ + "Breathing", + 2 + ], + [ + "Band Spiral Val", + 3 + ], + [ + "Cycle All", + 4 + ], + [ + "Cycle Left Right", + 5 + ], + [ + "Cycle Up Down", + 6 + ], + [ + "Rainbow Moving Chevron", + 7 + ], + [ + "Cycle Out In", + 8 + ], + [ + "Cycle Out In Dual", + 9 + ], + [ + "Cycle Pinwheel", + 10 + ], + [ + "Cycle Spiral", + 11 + ], + [ + "Dual Beacon", + 12 + ], + [ + "Rainbow Beacon", + 13 + ], + [ + "Jellybean Raindrops", + 14 + ], + [ + "Pixel Rain", + 15 + ], + [ + "Typing Heatmap", + 16 + ], + [ + "Digital Rain", + 17 + ], + [ + "Reactive Simple", + 18 + ], + [ + "Reactive Multiwide", + 19 + ], + [ + "Reactive Multinexus", + 20 + ], + [ + "Splash", + 21 + ], + [ + "Solid Splash", + 22 + ], + [ + "Per Key RGB", + 23 + ], + [ + "Mix RGB", + 24 + ] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1 && {id_qmk_rgb_matrix_effect} < 23", + "label": "Effect Speed", + "type": "range", + "options": [ + 0, + 255 + ], + "content": [ + "id_qmk_rgb_matrix_effect_speed", + 3, + 3 + ] + }, + { + "showIf": "({id_qmk_rgb_matrix_effect} >= 1 && {id_qmk_rgb_matrix_effect} <= 3) || ({id_qmk_rgb_matrix_effect} >= 18 && {id_qmk_rgb_matrix_effect} <= 20) || {id_qmk_rgb_matrix_effect} == 22", + "label": "Color", + "type": "color", + "content": [ + "id_qmk_rgb_matrix_color", + 3, + 4 + ] + } + ] + } + ] + } + ], + "layouts": { + "keymap": [ + [ + { + "x": 15.25, + "c": "#aaaaaa" + }, + "0,14" + ], + [ + { + "y": -0.75, + "c": "#777777" + }, + "0,0", + { + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + "0,5", + "0,6", + "0,7", + "0,8", + "0,9", + "0,10", + "0,11", + "0,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "0,13" + ], + [ + { + "w": 1.5 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "x": 0.25, + "c": "#777777", + "w": 1.25, + "h": 2 + }, + "1,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "1,14" + ], + [ + { + "w": 1.75 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,13", + { + "x": 1.5, + "c": "#aaaaaa" + }, + "2,14" + ], + [ + { + "w": 1.25 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,13" + ], + [ + { + "y": -0.75, + "x": 14.25, + "c": "#cccccc" + }, + "3,14" + ], + [ + { + "y": -0.25, + "c": "#aaaaaa", + "w": 1.25 + }, + "4,0", + { + "w": 1.25 + }, + "4,1", + { + "w": 1.25 + }, + "4,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "4,6", + { + "c": "#aaaaaa" + }, + "4,10", + "4,11", + "4,12" + ], + [ + { + "y": -0.75, + "x": 13.25, + "c": "#cccccc" + }, + "4,13", + "2,12", + "4,14" + ] +] + } +} diff --git a/keyboards/keychron/q2/via_json/q2_iso_encoder.json b/keyboards/keychron/q2/via_json/q2_iso_encoder.json new file mode 100644 index 0000000000..6dc7e4ca13 --- /dev/null +++ b/keyboards/keychron/q2/via_json/q2_iso_encoder.json @@ -0,0 +1,396 @@ +{ + "name": "Keychron Q2 ISO Knob", + "vendorId": "0x3434", + "productId": "0x0113", + "matrix": { + "rows": 5, + "cols": 15 + }, + "customKeycodes": [ + { + "name": "Mission Control", + "title": "Mission Control in macOS", + "shortName": "MCtrl" + }, + { + "name": "Launch Pad", + "title": "Launch Pad in macOS", + "shortName": "LPad" + }, + { + "name": "Left Option", + "title": "Left Option in macOS", + "shortName": "LOpt" + }, + { + "name": "Right Option", + "title": "Right Option in macOS", + "shortName": "ROpt" + }, + { + "name": "Left Cmd", + "title": "Left Command in macOS", + "shortName": "LCmd" + }, + { + "name": "Right Cmd", + "title": "Right Command in macOS", + "shortName": "RCmd" + }, + { + "name": "Siri", + "title": "Siri in macOS", + "shortName": "Siri" + }, + { + "name": "Task View", + "title": "Task View in windows", + "shortName": "Task" + }, + { + "name": "File Explorer", + "title": "File Explorer in windows", + "shortName": "File" + }, + { + "name": "Screen Shot", + "title": "Screenshot in macOS", + "shortName": "SShot" + }, + { + "name": "Cortana", + "title": "Cortana in windows", + "shortName": "Cortana" + } + ], + "keycodes": [ + "qmk_lighting" + ], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [ + 0, + 255 + ], + "content": [ + "id_qmk_rgb_matrix_brightness", + 3, + 1 + ] + }, + { + "label": "Effect", + "type": "dropdown", + "content": [ + "id_qmk_rgb_matrix_effect", + 3, + 2 + ], + "options": [ + [ + "None", + 0 + ], + [ + "Solid Color", + 1 + ], + [ + "Breathing", + 2 + ], + [ + "Band Spiral Val", + 3 + ], + [ + "Cycle All", + 4 + ], + [ + "Cycle Left Right", + 5 + ], + [ + "Cycle Up Down", + 6 + ], + [ + "Rainbow Moving Chevron", + 7 + ], + [ + "Cycle Out In", + 8 + ], + [ + "Cycle Out In Dual", + 9 + ], + [ + "Cycle Pinwheel", + 10 + ], + [ + "Cycle Spiral", + 11 + ], + [ + "Dual Beacon", + 12 + ], + [ + "Rainbow Beacon", + 13 + ], + [ + "Jellybean Raindrops", + 14 + ], + [ + "Pixel Rain", + 15 + ], + [ + "Typing Heatmap", + 16 + ], + [ + "Digital Rain", + 17 + ], + [ + "Reactive Simple", + 18 + ], + [ + "Reactive Multiwide", + 19 + ], + [ + "Reactive Multinexus", + 20 + ], + [ + "Splash", + 21 + ], + [ + "Solid Splash", + 22 + ], + [ + "Per Key RGB", + 23 + ], + [ + "Mix RGB", + 24 + ] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1 && {id_qmk_rgb_matrix_effect} < 23", + "label": "Effect Speed", + "type": "range", + "options": [ + 0, + 255 + ], + "content": [ + "id_qmk_rgb_matrix_effect_speed", + 3, + 3 + ] + }, + { + "showIf": "({id_qmk_rgb_matrix_effect} >= 1 && {id_qmk_rgb_matrix_effect} <= 3) || ({id_qmk_rgb_matrix_effect} >= 18 && {id_qmk_rgb_matrix_effect} <= 20) || {id_qmk_rgb_matrix_effect} == 22", + "label": "Color", + "type": "color", + "content": [ + "id_qmk_rgb_matrix_color", + 3, + 4 + ] + } + ] + } + ] + } + ], + "layouts": { + "keymap": [ + [ + { + "x": 15.25, + "c": "#aaaaaa" + }, + "0,14\n\n\n\n\n\n\n\n\ne0" + ], + [ + { + "y": -0.75, + "c": "#777777" + }, + "0,0", + { + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + "0,5", + "0,6", + "0,7", + "0,8", + "0,9", + "0,10", + "0,11", + "0,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "0,13" + ], + [ + { + "w": 1.5 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "x": 0.25, + "c": "#777777", + "w": 1.25, + "h": 2 + }, + "1,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "1,14" + ], + [ + { + "w": 1.75 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,13", + { + "x": 1.5, + "c": "#aaaaaa" + }, + "2,14" + ], + [ + { + "w": 1.25 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,13" + ], + [ + { + "y": -0.75, + "x": 14.25, + "c": "#cccccc" + }, + "3,14" + ], + [ + { + "y": -0.25, + "c": "#aaaaaa", + "w": 1.25 + }, + "4,0", + { + "w": 1.25 + }, + "4,1", + { + "w": 1.25 + }, + "4,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "4,6", + { + "c": "#aaaaaa" + }, + "4,10", + "4,11", + "4,12" + ], + [ + { + "y": -0.75, + "x": 13.25, + "c": "#cccccc" + }, + "4,13", + "2,12", + "4,14" + ] +] + } +}