summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2023-03-04 00:53:53 +0000
committerQMK Bot <hello@qmk.fm>2023-03-04 00:53:53 +0000
commit8075eb5ea4daf25cb9b416d59fbbb9448e49368c (patch)
treea9a2107eae563319e1ec7aaf1fce0a869e5d018d
parentfab04ef5806260ba108d5baa85bef10f2ed416f1 (diff)
parent77f7351991cef52a8b02c044acbfe1edb668f749 (diff)
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r--keyboards/keychron/q12/ansi_encoder/ansi_encoder.c170
-rw-r--r--keyboards/keychron/q12/ansi_encoder/config.h30
-rw-r--r--keyboards/keychron/q12/ansi_encoder/info.json132
-rw-r--r--keyboards/keychron/q12/ansi_encoder/keymaps/default/keymap.c69
-rw-r--r--keyboards/keychron/q12/ansi_encoder/keymaps/default/rules.mk1
-rw-r--r--keyboards/keychron/q12/ansi_encoder/keymaps/keychron/keymap.c80
-rw-r--r--keyboards/keychron/q12/ansi_encoder/keymaps/keychron/rules.mk5
-rw-r--r--keyboards/keychron/q12/ansi_encoder/keymaps/via/keymap.c69
-rw-r--r--keyboards/keychron/q12/ansi_encoder/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/q12/ansi_encoder/rules.mk26
-rw-r--r--keyboards/keychron/q12/config.h110
-rw-r--r--keyboards/keychron/q12/halconf.h22
-rw-r--r--keyboards/keychron/q12/iso_encoder/config.h30
-rw-r--r--keyboards/keychron/q12/iso_encoder/info.json133
-rw-r--r--keyboards/keychron/q12/iso_encoder/iso_encoder.c173
-rw-r--r--keyboards/keychron/q12/iso_encoder/keymaps/default/keymap.c69
-rw-r--r--keyboards/keychron/q12/iso_encoder/keymaps/default/rules.mk1
-rw-r--r--keyboards/keychron/q12/iso_encoder/keymaps/keychron/keymap.c80
-rw-r--r--keyboards/keychron/q12/iso_encoder/keymaps/keychron/rules.mk5
-rw-r--r--keyboards/keychron/q12/iso_encoder/keymaps/via/keymap.c69
-rw-r--r--keyboards/keychron/q12/iso_encoder/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/q12/iso_encoder/rules.mk27
-rw-r--r--keyboards/keychron/q12/matrix.c208
-rw-r--r--keyboards/keychron/q12/mcuconf.h22
-rw-r--r--keyboards/keychron/q12/q12.c93
-rw-r--r--keyboards/keychron/q12/readme.md19
26 files changed, 1647 insertions, 0 deletions
diff --git a/keyboards/keychron/q12/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q12/ansi_encoder/ansi_encoder.c
new file mode 100644
index 0000000000..2cfaeae8fc
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/ansi_encoder.c
@@ -0,0 +1,170 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "quantum.h"
18
19#ifdef RGB_MATRIX_ENABLE
20const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = {
21/* Refer to IS31 manual for these locations
22 * driver
23 * | R location
24 * | | G location
25 * | | | B location
26 * | | | | */
27 // {0, I_1, G_1, H_1}
28 {0, I_2, G_2, H_2}, // F13
29 {0, I_3, G_3, H_3}, // F14
30 {0, I_4, G_4, H_4}, // F15
31 {0, I_5, G_5, H_5}, // Esc
32 {0, I_6, G_6, H_6}, // F1
33 {0, I_7, G_7, H_7}, // F2
34 {0, I_8, G_8, H_8}, // F3
35 {0, I_9, G_9, H_9}, // F4
36 {0, I_10, G_10, H_10}, // F5
37 {0, I_11, G_11, H_11}, // F6
38 {0, I_12, G_12, H_12}, // F7
39 {0, I_13, G_13, H_13}, // F8
40 {0, I_14, G_14, H_14}, // F9
41 {0, I_15, G_15, H_15}, // F10
42 {0, I_16, G_16, H_16}, // F11
43 {0, L_16, J_16, K_16}, // F12
44 {0, L_15, J_15, K_15}, // DEL
45 {0, L_14, J_14, K_14}, // Light
46
47
48 {0, C_1, A_1, B_1}, // num_lock
49 {0, C_2, A_2, B_2}, // /
50 {0, C_3, A_3, B_3}, // *
51 {0, C_4, A_4, B_4}, // -
52 {0, C_5, A_5, B_5}, // ~`
53 {0, C_6, A_6, B_6}, // 1!
54 {0, C_7, A_7, B_7}, // 2@
55 {0, C_8, A_8, B_8}, // 3#
56 {0, C_9, A_9, B_9}, // 4$
57 {0, C_10, A_10, B_10}, // 5%
58 {0, C_11, A_11, B_11}, // 6^
59 {0, C_12, A_12, B_12}, // 7&
60 {0, C_13, A_13, B_13}, // 8*
61 {0, C_14, A_14, B_14}, // 9(
62 {0, C_15, A_15, B_15}, // 0)
63 {0, C_16, A_16, B_16}, // -_
64 {0, L_13, J_13, K_13}, // =+
65 {0, L_12, J_12, K_12}, // BackSpace
66 {0, L_11, J_11, K_11}, // PgUp
67
68 {0, F_1, D_1, E_1}, // 7
69 {0, F_2, D_2, E_2}, // 8
70 {0, F_3, D_3, E_3}, // 9
71 {0, F_4, D_4, E_4}, // +
72 {0, F_5, D_5, E_5}, // TAB
73 {0, F_6, D_6, E_6}, // Q
74 {0, F_7, D_7, E_7}, // W
75 {0, F_8, D_8, E_8}, // E
76 {0, F_9, D_9, E_9}, // R
77 {0, F_10, D_10, E_10}, // T
78 {0, F_11, D_11, E_11}, // Y
79 {0, F_12, D_12, E_12}, // U
80 {0, F_13, D_13, E_13}, // I
81 {0, F_14, D_14, E_14}, // O
82 {0, F_15, D_15, E_15}, // P
83 {0, F_16, D_16, E_16}, // [
84 {0, L_10, J_10, K_10}, // ]
85 {0, L_9, J_9, K_9}, // \|
86 {0, L_8, J_8, K_8}, // PgDn
87
88 {1, C_16, A_16, B_16}, // 4
89 {1, C_15, A_15, B_15}, // 5
90 {1, C_14, A_14, B_14}, // 6
91 // {0, F_4, D_4, E_4}, // +
92 {1, C_12, A_12, B_12}, // CapsLock
93 {1, C_11, A_11, B_11}, // A
94 {1, C_10, A_10, B_10}, // S
95 {1, C_9, A_9, B_9}, // D
96 {1, C_8, A_8, B_8}, // F
97 {1, C_7, A_7, B_7}, // G
98 {1, C_6, A_6, B_6}, // H
99 {1, C_5, A_5, B_5}, // J
100 {1, C_4, A_4, B_4}, // k
101 {1, C_3, A_3, B_3}, // l
102 {1, C_2, A_2, B_2}, // ;
103 {1, C_1, A_1, B_1}, // '
104 {1, L_1, J_1, K_1}, // Enter
105 {1, L_2, J_2, K_2}, // Home
106
107 {1, I_16, G_16, H_16}, // 1
108 {1, I_15, G_15, H_15}, // 2
109 {1, I_14, G_14, H_14}, // 3
110 {1, I_13, G_13, H_13}, // Enter
111 {1, I_12, G_12, H_12}, //Shift_L
112 {1, I_10, G_10, H_10}, // Z
113 {1, I_9, G_9, H_9}, // X
114 {1, I_8, G_8, H_8}, // C
115 {1, I_7, G_7, H_7}, // V
116 {1, I_6, G_6, H_6}, // B
117 {1, I_5, G_5, H_5}, // N
118 {1, I_4, G_4, H_4}, // M
119 {1, I_3, G_3, H_3}, // ,
120 {1, I_2, G_2, H_2}, // .
121 {1, I_1, G_1, H_1}, // ?
122 {1, L_3, J_3, K_3}, // Shift_R
123 {1, L_4, J_4, K_4}, // Up
124
125 {1, F_16, D_16, E_16}, // 0
126 {1, F_14, D_14, E_14}, // .
127 {1, F_12, D_12, E_12}, // Ctrl_L
128 {1, F_11, D_11, E_11}, // Win_L
129 {1, F_10, D_10, E_10}, // Alt_L
130 {1, F_6, D_6, E_6}, // Space
131 {1, F_3, D_3, E_3}, // Alt_R
132 {1, F_2, D_2, E_2}, // Fn
133 {1, F_1, D_1, E_1}, // Ctrl_R
134 {1, L_5, J_5, K_5}, // Left
135 {1, L_6, J_6, K_6}, // Down
136 {1, L_7, J_7, K_7}, // Right
137};
138
139#define __ NO_LED
140
141led_config_t g_led_config = {
142 {
143 // Key Matrix to LED Index
144 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, __, 0, 1 },
145 { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 18, 19, 20 },
146 { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 37, 38, 39 },
147 { 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 76, 71, 72, 56, 57, 58 },
148 { 77, __, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, __, 88, 89, 73, 74, 75 },
149 { 92, 93, 94, __, __, 21, 95, 40, __, 96, 97, 98, 99, 100, 101, 90, 2, 91 },
150 },
151 {
152 // LED Index to Physical Position
153 {11,0}, {23,0}, {34,0}, {49,0}, {63,0}, {75,0}, {86,0}, {98,0}, {112,0}, {123,0}, {135,0}, {146,0}, {161,0}, {172,0}, {184,0}, {195,0}, {209,0}, {224,0},
154 {0,15}, {11,15}, {23,15}, {34,15}, {49,15}, {60,15}, {72,15}, {83,15}, {95,15}, {106,15}, {118,15}, {129,15}, {141,15}, {152,15}, {164,15}, {175,15}, {186,15}, {204,15}, {224,15},
155 {0,26}, {11,26}, {23,26}, {34,32}, {52,26}, {66,26}, {78,26}, {89,26}, {101,26}, {112,26}, {123,26}, {135,26}, {146,26}, {158,26}, {169,26}, {181,26}, {192,26}, {207,26}, {224,26},
156 {0,38}, {11,38}, {23,38}, {53,38}, {69,38}, {81,38}, {92,38}, {103,38}, {115,38}, {126,38}, {138,38}, {149,38}, {161,38}, {172,38}, {184,38}, {202,38}, {224,38},
157 {0,49}, {11,49}, {23,49}, {34,55}, {56,49}, {75,49}, {86,49}, {98,49}, {109,49}, {121,49}, {132,49}, {144,49}, {155,49}, {166,49}, {178,49}, {194,49}, {213,52},
158 {6,61}, {23,61}, {50,61}, {65,61}, {79,61}, {122,61}, {163,61}, {175,61}, {186,61}, {201,64}, {213,64}, {224,64},
159 },
160 {
161 // RGB LED Index to Flag
162 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
163 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
164 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
165 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
166 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
167 4, 4, 1, 1, 1, 4, 1, 4, 1, 1, 1, 1,
168 }
169};
170#endif
diff --git a/keyboards/keychron/q12/ansi_encoder/config.h b/keyboards/keychron/q12/ansi_encoder/config.h
new file mode 100644
index 0000000000..56a1f7505f
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/config.h
@@ -0,0 +1,30 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19/* RGB Matrix Configuration */
20#define DRIVER_1_LED_TOTAL 56
21#define DRIVER_2_LED_TOTAL 46
22#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
23
24#define ENCODER_DEFAULT_POS 0x3
25
26/* Enable caps-lock LED */
27#define CAPS_LOCK_LED_INDEX 59
28
29/* Enable num-lock LED */
30#define NUM_LOCK_LED_INDEX 18
diff --git a/keyboards/keychron/q12/ansi_encoder/info.json b/keyboards/keychron/q12/ansi_encoder/info.json
new file mode 100644
index 0000000000..0e3179708a
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/info.json
@@ -0,0 +1,132 @@
1{
2 "keyboard_name": "Keychron Q12",
3 "manufacturer": "Keychron",
4 "url": "https://github.com/Keychron",
5 "maintainer": "lalalademaxiya1",
6 "usb": {
7 "vid": "0x3434",
8 "pid": "0x01D1",
9 "device_version": "1.0.0"
10 },
11 "encoder": {
12 "rotary": [
13 {"pin_a": "A2", "pin_b": "C14"}
14 ]
15 },
16 "processor": "STM32L432",
17 "bootloader": "stm32-dfu",
18 "layouts": {
19 "LAYOUT_ansi_103": {
20 "layout": [
21 {"matrix":[0,15], "x":0, "y":0},
22 {"matrix":[0,16], "x":1, "y":0},
23 {"matrix":[0,17], "x":2, "y":0},
24 {"matrix":[5,16], "x":3, "y":0},
25 {"matrix":[0,0], "x":4.25, "y":0},
26 {"matrix":[0,1], "x":5.5, "y":0},
27 {"matrix":[0,2], "x":6.5, "y":0},
28 {"matrix":[0,3], "x":7.5, "y":0},
29 {"matrix":[0,4], "x":8.5, "y":0},
30 {"matrix":[0,5], "x":9.75, "y":0},
31 {"matrix":[0,6], "x":10.75, "y":0},
32 {"matrix":[0,7], "x":11.75, "y":0},
33 {"matrix":[0,8], "x":12.75, "y":0},
34 {"matrix":[0,9], "x":14, "y":0},
35 {"matrix":[0,10], "x":15, "y":0},
36 {"matrix":[0,11], "x":16, "y":0},
37 {"matrix":[0,12], "x":17, "y":0},
38 {"matrix":[0,13], "x":18.25, "y":0},
39 {"matrix":[0,14], "x":19.5, "y":0},
40
41 {"matrix":[1,15], "x":0, "y":1.25},
42 {"matrix":[1,16], "x":1, "y":1.25},
43 {"matrix":[1,17], "x":2, "y":1.25},
44 {"matrix":[5,5], "x":3, "y":1.25},
45 {"matrix":[1,0], "x":4.25, "y":1.25},
46 {"matrix":[1,1], "x":5.25, "y":1.25},
47 {"matrix":[1,2], "x":6.25, "y":1.25},
48 {"matrix":[1,3], "x":7.25, "y":1.25},
49 {"matrix":[1,4], "x":8.25, "y":1.25},
50 {"matrix":[1,5], "x":9.25, "y":1.25},
51 {"matrix":[1,6], "x":10.25, "y":1.25},
52 {"matrix":[1,7], "x":11.25, "y":1.25},
53 {"matrix":[1,8], "x":12.25, "y":1.25},
54 {"matrix":[1,9], "x":13.25, "y":1.25},
55 {"matrix":[1,10], "x":14.25, "y":1.25},
56 {"matrix":[1,11], "x":15.25, "y":1.25},
57 {"matrix":[1,12], "x":16.25, "y":1.25},
58 {"matrix":[1,13], "x":17.25, "y":1.25, "w":2},
59 {"matrix":[1,14], "x":19.5, "y":1.25},
60
61 {"matrix":[2,15], "x":0, "y":2.25},
62 {"matrix":[2,16], "x":1, "y":2.25},
63 {"matrix":[2,17], "x":2, "y":2.25},
64 {"matrix":[5,7], "x":3, "y":2.25, "h":2},
65 {"matrix":[2,0], "x":4.25, "y":2.25, "w":1.5},
66 {"matrix":[2,1], "x":5.75, "y":2.25},
67 {"matrix":[2,2], "x":6.75, "y":2.25},
68 {"matrix":[2,3], "x":7.75, "y":2.25},
69 {"matrix":[2,4], "x":8.75, "y":2.25},
70 {"matrix":[2,5], "x":9.75, "y":2.25},
71 {"matrix":[2,6], "x":10.75, "y":2.25},
72 {"matrix":[2,7], "x":11.75, "y":2.25},
73 {"matrix":[2,8], "x":12.75, "y":2.25},
74 {"matrix":[2,9], "x":13.75, "y":2.25},
75 {"matrix":[2,10], "x":14.75, "y":2.25},
76 {"matrix":[2,11], "x":15.75, "y":2.25},
77 {"matrix":[2,12], "x":16.75, "y":2.25},
78 {"matrix":[2,13], "x":17.75, "y":2.25, "w":1.5},
79 {"matrix":[2,14], "x":19.5, "y":2.25},
80
81 {"matrix":[3,15], "x":0, "y":3.25},
82 {"matrix":[3,16], "x":1, "y":3.25},
83 {"matrix":[3,17], "x":2, "y":3.25},
84 {"matrix":[3,0], "x":4.25, "y":3.25, "w":1.75},
85 {"matrix":[3,1], "x":6, "y":3.25},
86 {"matrix":[3,2], "x":7, "y":3.25},
87 {"matrix":[3,3], "x":8, "y":3.25},
88 {"matrix":[3,4], "x":9, "y":3.25},
89 {"matrix":[3,5], "x":10, "y":3.25},
90 {"matrix":[3,6], "x":11, "y":3.25},
91 {"matrix":[3,7], "x":12, "y":3.25},
92 {"matrix":[3,8], "x":13, "y":3.25},
93 {"matrix":[3,9], "x":14, "y":3.25},
94 {"matrix":[3,10], "x":15, "y":3.25},
95 {"matrix":[3,11], "x":16, "y":3.25},
96 {"matrix":[3,13], "x":17, "y":3.25, "w":2.25},
97 {"matrix":[3,14], "x":19.5, "y":3.25},
98
99 {"matrix":[4,15], "x":0, "y":4.25},
100 {"matrix":[4,16], "x":1, "y":4.25},
101 {"matrix":[4,17], "x":2, "y":4.25},
102 {"matrix":[3,12], "x":3, "y":4.25, "h":2},
103 {"matrix":[4,0], "x":4.25, "y":4.25, "w":2.25},
104 {"matrix":[4,2], "x":6.5, "y":4.25},
105 {"matrix":[4,3], "x":7.5, "y":4.25},
106 {"matrix":[4,4], "x":8.5, "y":4.25},
107 {"matrix":[4,5], "x":9.5, "y":4.25},
108 {"matrix":[4,6], "x":10.5, "y":4.25},
109 {"matrix":[4,7], "x":11.5, "y":4.25},
110 {"matrix":[4,8], "x":12.5, "y":4.25},
111 {"matrix":[4,9], "x":13.5, "y":4.25},
112 {"matrix":[4,10], "x":14.5, "y":4.25},
113 {"matrix":[4,11], "x":15.5, "y":4.25},
114 {"matrix":[4,13], "x":16.5, "y":4.25, "w":1.75},
115 {"matrix":[4,14], "x":18.5, "y":4.5},
116
117 {"matrix":[5,15], "x":0, "y":5.25, "w":2},
118 {"matrix":[5,17], "x":2, "y":5.25},
119 {"matrix":[5,0], "x":4.25, "y":5.25, "w":1.25},
120 {"matrix":[5,1], "x":5.5, "y":5.25, "w":1.25},
121 {"matrix":[5,2], "x":6.75, "y":5.25, "w":1.25},
122 {"matrix":[5,6], "x":8, "y":5.25, "w":6.25},
123 {"matrix":[5,9], "x":14.25, "y":5.25},
124 {"matrix":[5,10], "x":15.25, "y":5.25},
125 {"matrix":[5,11], "x":16.25, "y":5.25},
126 {"matrix":[5,12], "x":17.5, "y":5.5},
127 {"matrix":[5,13], "x":18.5, "y":5.5},
128 {"matrix":[5,14], "x":19.5, "y":5.5}
129 ]
130 }
131 }
132}
diff --git a/keyboards/keychron/q12/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/q12/ansi_encoder/keymaps/default/keymap.c
new file mode 100644
index 0000000000..9c9ee41ef6
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/keymaps/default/keymap.c
@@ -0,0 +1,69 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18
19// clang-format off
20
21enum layers{
22 MAC_BASE,
23 MAC_FN,
24 WIN_BASE,
25 WIN_FN
26};
27
28#define KC_TASK LGUI(KC_TAB)
29#define KC_FLXP LGUI(KC_E)
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32 [MAC_BASE] = LAYOUT_ansi_103(
33 KC_MUTE, KC_F13, KC_F14, KC_F15, KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, RGB_MOD,
34 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
35 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
36 KC_P4, KC_P5, KC_P6, 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,
37 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
38 KC_P0, KC_PDOT, KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
39 [MAC_FN] = LAYOUT_ansi_103(
40 RGB_TOG, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
41 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
42 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
43 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
44 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
45 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
46 [WIN_BASE] = LAYOUT_ansi_103(
47 KC_MUTE, _______, _______, _______, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, RGB_MOD,
48 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
49 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
50 KC_P4, KC_P5, KC_P6, 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,
51 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
52 KC_P0, KC_PDOT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
53 [WIN_FN] = LAYOUT_ansi_103(
54 RGB_TOG, _______, _______, _______, _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
55 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
56 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
57 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
58 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
59 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
60};
61
62#if defined(ENCODER_MAP_ENABLE)
63const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
64 [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
65 [MAC_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
66 [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
67 [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }
68};
69#endif
diff --git a/keyboards/keychron/q12/ansi_encoder/keymaps/default/rules.mk b/keyboards/keychron/q12/ansi_encoder/keymaps/default/rules.mk
new file mode 100644
index 0000000000..ee32568148
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/keymaps/default/rules.mk
@@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/keychron/q12/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q12/ansi_encoder/keymaps/keychron/keymap.c
new file mode 100644
index 0000000000..abd259d1d1
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/keymaps/keychron/keymap.c
@@ -0,0 +1,80 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18#include "keychron_common.h"
19
20// clang-format off
21
22enum layers{
23 MAC_BASE,
24 MAC_FN,
25 WIN_BASE,
26 WIN_FN
27};
28
29const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
30 [MAC_BASE] = LAYOUT_ansi_103(
31 KC_MUTE, KC_F13, KC_F14, KC_F15, KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, RGB_MOD,
32 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
33 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
34 KC_P4, KC_P5, KC_P6, 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,
35 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
36 KC_P0, KC_PDOT, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
37 [MAC_FN] = LAYOUT_ansi_103(
38 RGB_TOG, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
39 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
40 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
41 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
42 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
43 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
44 [WIN_BASE] = LAYOUT_ansi_103(
45 KC_MUTE, _______, _______, _______, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, RGB_MOD,
46 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
47 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
48 KC_P4, KC_P5, KC_P6, 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,
49 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
50 KC_P0, KC_PDOT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
51 [WIN_FN] = LAYOUT_ansi_103(
52 RGB_TOG, _______, _______, _______, _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
53 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
54 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
55 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
56 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
57 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
58};
59
60// clang-format on
61
62#if defined(ENCODER_MAP_ENABLE)
63const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
64 [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
65 [MAC_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
66 [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
67 [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }
68};
69#endif
70
71void housekeeping_task_user(void) {
72 housekeeping_task_keychron();
73}
74
75bool process_record_user(uint16_t keycode, keyrecord_t *record) {
76 if (!process_record_keychron(keycode, record)) {
77 return false;
78 }
79 return true;
80}
diff --git a/keyboards/keychron/q12/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q12/ansi_encoder/keymaps/keychron/rules.mk
new file mode 100644
index 0000000000..9cf1a9b56c
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/keymaps/keychron/rules.mk
@@ -0,0 +1,5 @@
1VIA_ENABLE = yes
2ENCODER_MAP_ENABLE = yes
3
4VPATH += keyboards/keychron/common
5SRC += keychron_common.c
diff --git a/keyboards/keychron/q12/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q12/ansi_encoder/keymaps/via/keymap.c
new file mode 100644
index 0000000000..9c9ee41ef6
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/keymaps/via/keymap.c
@@ -0,0 +1,69 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18
19// clang-format off
20
21enum layers{
22 MAC_BASE,
23 MAC_FN,
24 WIN_BASE,
25 WIN_FN
26};
27
28#define KC_TASK LGUI(KC_TAB)
29#define KC_FLXP LGUI(KC_E)
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32 [MAC_BASE] = LAYOUT_ansi_103(
33 KC_MUTE, KC_F13, KC_F14, KC_F15, KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, RGB_MOD,
34 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
35 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
36 KC_P4, KC_P5, KC_P6, 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,
37 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
38 KC_P0, KC_PDOT, KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
39 [MAC_FN] = LAYOUT_ansi_103(
40 RGB_TOG, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
41 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
42 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
43 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
44 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
45 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
46 [WIN_BASE] = LAYOUT_ansi_103(
47 KC_MUTE, _______, _______, _______, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, RGB_MOD,
48 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
49 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
50 KC_P4, KC_P5, KC_P6, 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,
51 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
52 KC_P0, KC_PDOT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
53 [WIN_FN] = LAYOUT_ansi_103(
54 RGB_TOG, _______, _______, _______, _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
55 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
56 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
57 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
58 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
59 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
60};
61
62#if defined(ENCODER_MAP_ENABLE)
63const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
64 [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
65 [MAC_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
66 [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
67 [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }
68};
69#endif
diff --git a/keyboards/keychron/q12/ansi_encoder/keymaps/via/rules.mk b/keyboards/keychron/q12/ansi_encoder/keymaps/via/rules.mk
new file mode 100644
index 0000000000..f1adcab005
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
1VIA_ENABLE = yes
2ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/keychron/q12/ansi_encoder/rules.mk b/keyboards/keychron/q12/ansi_encoder/rules.mk
new file mode 100644
index 0000000000..bf60bb7d7d
--- /dev/null
+++ b/keyboards/keychron/q12/ansi_encoder/rules.mk
@@ -0,0 +1,26 @@
1# Build Options
2# change yes to no to disable.
3#
4BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
5MOUSEKEY_ENABLE = yes # Mouse keys
6EXTRAKEY_ENABLE = yes # Audio control and System control
7CONSOLE_ENABLE = no # Console for debug
8COMMAND_ENABLE = no # Commands for debug and configuration
9NKRO_ENABLE = yes # Enable USB N-key Rollover
10BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
11RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
12AUDIO_ENABLE = no # Audio output
13ENCODER_ENABLE = yes # Enable Encoder
14DIP_SWITCH_ENABLE = yes
15RGB_MATRIX_ENABLE = yes
16RGB_MATRIX_DRIVER = CKLED2001
17EEPROM_DRIVER = wear_leveling
18WEAR_LEVELING_DRIVER = embedded_flash
19
20# Enter lower-power sleep mode when on the ChibiOS idle thread
21OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
22
23# custom matrix setup
24CUSTOM_MATRIX = lite
25
26SRC += matrix.c
diff --git a/keyboards/keychron/q12/config.h b/keyboards/keychron/q12/config.h
new file mode 100644
index 0000000000..95281b4854
--- /dev/null
+++ b/keyboards/keychron/q12/config.h
@@ -0,0 +1,110 @@
1/* Copyright 2023 @ Keychron(https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19/* Key matrix pins */
20#define MATRIX_ROW_PINS \
21 { B5, B4, B3, A15, A14, A13 }
22#define MATRIX_COL_PINS \
23 { A10, A9, A8, B1, B0, A7, A6, A5, A4, A3, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
24
25/* COL2ROW or ROW2COL */
26#define DIODE_DIRECTION ROW2COL
27
28/* RGB Matrix Driver Configuration */
29#define DRIVER_COUNT 2
30#define DRIVER_ADDR_1 0b1110111
31#define DRIVER_ADDR_2 0b1110100
32
33/* Increase I2C speed to 1000 KHz */
34#define I2C1_TIMINGR_PRESC 0U
35#define I2C1_TIMINGR_SCLDEL 3U
36#define I2C1_TIMINGR_SDADEL 0U
37#define I2C1_TIMINGR_SCLH 15U
38#define I2C1_TIMINGR_SCLL 51U
39
40#define CKLED2001_CURRENT_TUNE \
41 { 0xAD, 0xAD, 0x55, 0xAD, 0xAD, 0x55, 0xAD, 0xAD, 0x55, 0xAD, 0xAD, 0x55 }
42
43/* DIP switch */
44#define DIP_SWITCH_MATRIX_GRID \
45 { \
46 { 5, 4 } \
47 }
48#define SCAN_COUNT_MAX 100
49
50/* Disable DIP switch in matrix data */
51#define MATRIX_MASKED
52
53/* turn off effects when suspended */
54#define RGB_DISABLE_WHEN_USB_SUSPENDED
55
56/* EEPROM Driver Configuration */
57// #define WEAR_LEVELING_LOGICAL_SIZE 2048 // default
58// #define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) // default
59
60// RGB Matrix Animation modes. Explicitly enabled
61// For full list of effects, see:
62// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
63// #define ENABLE_RGB_MATRIX_ALPHAS_MODS
64// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
65// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
66#define ENABLE_RGB_MATRIX_BREATHING
67// #define ENABLE_RGB_MATRIX_BAND_SAT
68// #define ENABLE_RGB_MATRIX_BAND_VAL
69// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
70// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
71// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
72#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
73#define ENABLE_RGB_MATRIX_CYCLE_ALL
74#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
75#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
76#define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
77#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
78#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
79#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
80#define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
81#define ENABLE_RGB_MATRIX_DUAL_BEACON
82#define ENABLE_RGB_MATRIX_RAINBOW_BEACON
83// #define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
84// #define ENABLE_RGB_MATRIX_RAINDROPS
85#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
86// #define ENABLE_RGB_MATRIX_HUE_BREATHING
87// #define ENABLE_RGB_MATRIX_HUE_PENDULUM
88// #define ENABLE_RGB_MATRIX_HUE_WAVE
89#define ENABLE_RGB_MATRIX_PIXEL_RAIN
90// #define ENABLE_RGB_MATRIX_PIXEL_FLOW
91// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
92// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
93#define ENABLE_RGB_MATRIX_TYPING_HEATMAP
94#define ENABLE_RGB_MATRIX_DIGITAL_RAIN
95// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined
96#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
97// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE
98// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
99#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
100// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
101// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
102// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
103#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
104#define ENABLE_RGB_MATRIX_SPLASH
105// #define ENABLE_RGB_MATRIX_MULTISPLASH
106#define ENABLE_RGB_MATRIX_SOLID_SPLASH
107// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
108
109#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
110#define RGB_MATRIX_KEYPRESSES
diff --git a/keyboards/keychron/q12/halconf.h b/keyboards/keychron/q12/halconf.h
new file mode 100644
index 0000000000..e490b49e00
--- /dev/null
+++ b/keyboards/keychron/q12/halconf.h
@@ -0,0 +1,22 @@
1/* Copyright 2020 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#define HAL_USE_I2C TRUE
20#define PAL_USE_CALLBACKS TRUE
21
22#include_next <halconf.h>
diff --git a/keyboards/keychron/q12/iso_encoder/config.h b/keyboards/keychron/q12/iso_encoder/config.h
new file mode 100644
index 0000000000..eb0957d7af
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/config.h
@@ -0,0 +1,30 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19/* RGB Matrix Configuration */
20#define DRIVER_1_LED_TOTAL 56
21#define DRIVER_2_LED_TOTAL 47
22#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
23
24#define ENCODER_DEFAULT_POS 0x3
25
26/* Enable caps-lock LED */
27#define CAPS_LOCK_LED_INDEX 58
28
29/* Enable num-lock LED */
30#define NUM_LOCK_LED_INDEX 18
diff --git a/keyboards/keychron/q12/iso_encoder/info.json b/keyboards/keychron/q12/iso_encoder/info.json
new file mode 100644
index 0000000000..c945fbc771
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/info.json
@@ -0,0 +1,133 @@
1{
2 "keyboard_name": "Keychron Q12",
3 "manufacturer": "Keychron",
4 "url": "https://github.com/Keychron",
5 "maintainer": "lalalademaxiya1",
6 "usb": {
7 "vid": "0x3434",
8 "pid": "0x01D3",
9 "device_version": "1.0.0"
10 },
11 "encoder": {
12 "rotary": [
13 {"pin_a": "A2", "pin_b": "C14"}
14 ]
15 },
16 "processor": "STM32L432",
17 "bootloader": "stm32-dfu",
18 "layouts": {
19 "LAYOUT_iso_104": {
20 "layout": [
21 {"matrix":[0,15], "x":0, "y":0},
22 {"matrix":[0,16], "x":1, "y":0},
23 {"matrix":[0,17], "x":2, "y":0},
24 {"matrix":[5,16], "x":3, "y":0},
25 {"matrix":[0,0], "x":4.25, "y":0},
26 {"matrix":[0,1], "x":5.5, "y":0},
27 {"matrix":[0,2], "x":6.5, "y":0},
28 {"matrix":[0,3], "x":7.5, "y":0},
29 {"matrix":[0,4], "x":8.5, "y":0},
30 {"matrix":[0,5], "x":9.75, "y":0},
31 {"matrix":[0,6], "x":10.75, "y":0},
32 {"matrix":[0,7], "x":11.75, "y":0},
33 {"matrix":[0,8], "x":12.75, "y":0},
34 {"matrix":[0,9], "x":14, "y":0},
35 {"matrix":[0,10], "x":15, "y":0},
36 {"matrix":[0,11], "x":16, "y":0},
37 {"matrix":[0,12], "x":17, "y":0},
38 {"matrix":[0,13], "x":18.25, "y":0},
39 {"matrix":[0,14], "x":19.5, "y":0},
40
41 {"matrix":[1,15], "x":0, "y":1.25},
42 {"matrix":[1,16], "x":1, "y":1.25},
43 {"matrix":[1,17], "x":2, "y":1.25},
44 {"matrix":[5,5], "x":3, "y":1.25},
45 {"matrix":[1,0], "x":4.25, "y":1.25},
46 {"matrix":[1,1], "x":5.25, "y":1.25},
47 {"matrix":[1,2], "x":6.25, "y":1.25},
48 {"matrix":[1,3], "x":7.25, "y":1.25},
49 {"matrix":[1,4], "x":8.25, "y":1.25},
50 {"matrix":[1,5], "x":9.25, "y":1.25},
51 {"matrix":[1,6], "x":10.25, "y":1.25},
52 {"matrix":[1,7], "x":11.25, "y":1.25},
53 {"matrix":[1,8], "x":12.25, "y":1.25},
54 {"matrix":[1,9], "x":13.25, "y":1.25},
55 {"matrix":[1,10], "x":14.25, "y":1.25},
56 {"matrix":[1,11], "x":15.25, "y":1.25},
57 {"matrix":[1,12], "x":16.25, "y":1.25},
58 {"matrix":[1,13], "x":17.25, "y":1.25, "w":2},
59 {"matrix":[1,14], "x":19.5, "y":1.25},
60
61 {"matrix":[2,15], "x":0, "y":2.25},
62 {"matrix":[2,16], "x":1, "y":2.25},
63 {"matrix":[2,17], "x":2, "y":2.25},
64 {"matrix":[5,7], "x":3, "y":2.25, "h":2},
65 {"matrix":[2,0], "x":4.25, "y":2.25, "w":1.5},
66 {"matrix":[2,1], "x":5.75, "y":2.25},
67 {"matrix":[2,2], "x":6.75, "y":2.25},
68 {"matrix":[2,3], "x":7.75, "y":2.25},
69 {"matrix":[2,4], "x":8.75, "y":2.25},
70 {"matrix":[2,5], "x":9.75, "y":2.25},
71 {"matrix":[2,6], "x":10.75, "y":2.25},
72 {"matrix":[2,7], "x":11.75, "y":2.25},
73 {"matrix":[2,8], "x":12.75, "y":2.25},
74 {"matrix":[2,9], "x":13.75, "y":2.25},
75 {"matrix":[2,10], "x":14.75, "y":2.25},
76 {"matrix":[2,11], "x":15.75, "y":2.25},
77 {"matrix":[2,12], "x":16.75, "y":2.25},
78 {"matrix":[2,14], "x":19.5, "y":2.25},
79
80 {"matrix":[3,15], "x":0, "y":3.25},
81 {"matrix":[3,16], "x":1, "y":3.25},
82 {"matrix":[3,17], "x":2, "y":3.25},
83 {"matrix":[3,0], "x":4.25, "y":3.25, "w":1.75},
84 {"matrix":[3,1], "x":6, "y":3.25},
85 {"matrix":[3,2], "x":7, "y":3.25},
86 {"matrix":[3,3], "x":8, "y":3.25},
87 {"matrix":[3,4], "x":9, "y":3.25},
88 {"matrix":[3,5], "x":10, "y":3.25},
89 {"matrix":[3,6], "x":11, "y":3.25},
90 {"matrix":[3,7], "x":12, "y":3.25},
91 {"matrix":[3,8], "x":13, "y":3.25},
92 {"matrix":[3,9], "x":14, "y":3.25},
93 {"matrix":[3,10], "x":15, "y":3.25},
94 {"matrix":[3,11], "x":16, "y":3.25},
95 {"matrix":[3,13], "x":17, "y":3.25},
96 {"matrix":[2,13], "x":18, "y":2.25, "w":1.25, "h":2},
97 {"matrix":[3,14], "x":19.5, "y":3.25},
98
99 {"matrix":[4,15], "x":0, "y":4.25},
100 {"matrix":[4,16], "x":1, "y":4.25},
101 {"matrix":[4,17], "x":2, "y":4.25},
102 {"matrix":[3,12], "x":3, "y":4.25, "h":2},
103 {"matrix":[4,0], "x":4.25, "y":4.25, "w":1.25},
104 {"matrix":[4,1], "x":5.5, "y":4.25},
105 {"matrix":[4,2], "x":6.5, "y":4.25},
106 {"matrix":[4,3], "x":7.5, "y":4.25},
107 {"matrix":[4,4], "x":8.5, "y":4.25},
108 {"matrix":[4,5], "x":9.5, "y":4.25},
109 {"matrix":[4,6], "x":10.5, "y":4.25},
110 {"matrix":[4,7], "x":11.5, "y":4.25},
111 {"matrix":[4,8], "x":12.5, "y":4.25},
112 {"matrix":[4,9], "x":13.5, "y":4.25},
113 {"matrix":[4,10], "x":14.5, "y":4.25},
114 {"matrix":[4,11], "x":15.5, "y":4.25},
115 {"matrix":[4,13], "x":16.5, "y":4.25, "w":1.75},
116 {"matrix":[4,14], "x":18.5, "y":4.5},
117
118 {"matrix":[5,15], "x":0, "y":5.25, "w":2},
119 {"matrix":[5,17], "x":2, "y":5.25},
120 {"matrix":[5,0], "x":4.25, "y":5.25, "w":1.25},
121 {"matrix":[5,1], "x":5.5, "y":5.25, "w":1.25},
122 {"matrix":[5,2], "x":6.75, "y":5.25, "w":1.25},
123 {"matrix":[5,6], "x":8, "y":5.25, "w":6.25},
124 {"matrix":[5,9], "x":14.25, "y":5.25},
125 {"matrix":[5,10], "x":15.25, "y":5.25},
126 {"matrix":[5,11], "x":16.25, "y":5.25},
127 {"matrix":[5,12], "x":17.5, "y":5.5},
128 {"matrix":[5,13], "x":18.5, "y":5.5},
129 {"matrix":[5,14], "x":19.5, "y":5.5}
130 ]
131 }
132 }
133}
diff --git a/keyboards/keychron/q12/iso_encoder/iso_encoder.c b/keyboards/keychron/q12/iso_encoder/iso_encoder.c
new file mode 100644
index 0000000000..8090649d33
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/iso_encoder.c
@@ -0,0 +1,173 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "quantum.h"
18
19#ifdef RGB_MATRIX_ENABLE
20
21const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = {
22/* Refer to IS31 manual for these locations
23 * driver
24 * | R location
25 * | | G location
26 * | | | B location
27 * | | | | */
28 // {0, I_1, G_1, H_1}
29 {0, I_2, G_2, H_2}, // F13
30 {0, I_3, G_3, H_3}, // F14
31 {0, I_4, G_4, H_4}, // F15
32 {0, I_5, G_5, H_5}, // Esc
33 {0, I_6, G_6, H_6}, // F1
34 {0, I_7, G_7, H_7}, // F2
35 {0, I_8, G_8, H_8}, // F3
36 {0, I_9, G_9, H_9}, // F4
37 {0, I_10, G_10, H_10}, // F5
38 {0, I_11, G_11, H_11}, // F6
39 {0, I_12, G_12, H_12}, // F7
40 {0, I_13, G_13, H_13}, // F8
41 {0, I_14, G_14, H_14}, // F9
42 {0, I_15, G_15, H_15}, // F10
43 {0, I_16, G_16, H_16}, // F11
44 {0, L_16, J_16, K_16}, // F12
45 {0, L_15, J_15, K_15}, // DEL
46 {0, L_14, J_14, K_14}, // Light
47
48
49 {0, C_1, A_1, B_1}, // num_lock
50 {0, C_2, A_2, B_2}, // /
51 {0, C_3, A_3, B_3}, // *
52 {0, C_4, A_4, B_4}, // -
53 {0, C_5, A_5, B_5}, // ~`
54 {0, C_6, A_6, B_6}, // 1!
55 {0, C_7, A_7, B_7}, // 2@
56 {0, C_8, A_8, B_8}, // 3#
57 {0, C_9, A_9, B_9}, // 4$
58 {0, C_10, A_10, B_10}, // 5%
59 {0, C_11, A_11, B_11}, // 6^
60 {0, C_12, A_12, B_12}, // 7&
61 {0, C_13, A_13, B_13}, // 8*
62 {0, C_14, A_14, B_14}, // 9(
63 {0, C_15, A_15, B_15}, // 0)
64 {0, C_16, A_16, B_16}, // -_
65 {0, L_13, J_13, K_13}, // =+
66 {0, L_12, J_12, K_12}, // BackSpace
67 {0, L_11, J_11, K_11}, // PgUp
68
69 {0, F_1, D_1, E_1}, // 7
70 {0, F_2, D_2, E_2}, // 8
71 {0, F_3, D_3, E_3}, // 9
72 {0, F_4, D_4, E_4}, // +
73 {0, F_5, D_5, E_5}, // TAB
74 {0, F_6, D_6, E_6}, // Q
75 {0, F_7, D_7, E_7}, // W
76 {0, F_8, D_8, E_8}, // E
77 {0, F_9, D_9, E_9}, // R
78 {0, F_10, D_10, E_10}, // T
79 {0, F_11, D_11, E_11}, // Y
80 {0, F_12, D_12, E_12}, // U
81 {0, F_13, D_13, E_13}, // I
82 {0, F_14, D_14, E_14}, // O
83 {0, F_15, D_15, E_15}, // P
84 {0, F_16, D_16, E_16}, // [
85 {0, L_10, J_10, K_10}, // ]
86 // {0, L_9, J_9, K_9}, // \|
87 {0, L_8, J_8, K_8}, // PgDn
88
89 {1, C_16, A_16, B_16}, // 4
90 {1, C_15, A_15, B_15}, // 5
91 {1, C_14, A_14, B_14}, // 6
92 // {0, F_4, D_4, E_4}, // +
93 {1, C_12, A_12, B_12}, // CapsLock
94 {1, C_11, A_11, B_11}, // A
95 {1, C_10, A_10, B_10}, // S
96 {1, C_9, A_9, B_9}, // D
97 {1, C_8, A_8, B_8}, // F
98 {1, C_7, A_7, B_7}, // G
99 {1, C_6, A_6, B_6}, // H
100 {1, C_5, A_5, B_5}, // J
101 {1, C_4, A_4, B_4}, // k
102 {1, C_3, A_3, B_3}, // l
103 {1, C_2, A_2, B_2}, // ;
104 {1, C_1, A_1, B_1}, // '
105 {1, L_1, J_1, K_1}, // #~
106 {0, L_9, J_9, K_9}, // Enter
107 {1, L_2, J_2, K_2}, // Home
108
109 {1, I_16, G_16, H_16}, // 1
110 {1, I_15, G_15, H_15}, // 2
111 {1, I_14, G_14, H_14}, // 3
112 {1, I_13, G_13, H_13}, // Enter
113 {1, I_12, G_12, H_12}, //Shift_L
114 {1, I_11, G_11, H_11}, // |
115 {1, I_10, G_10, H_10}, // Z
116 {1, I_9, G_9, H_9}, // X
117 {1, I_8, G_8, H_8}, // C
118 {1, I_7, G_7, H_7}, // V
119 {1, I_6, G_6, H_6}, // B
120 {1, I_5, G_5, H_5}, // N
121 {1, I_4, G_4, H_4}, // M
122 {1, I_3, G_3, H_3}, // ,
123 {1, I_2, G_2, H_2}, // .
124 {1, I_1, G_1, H_1}, // ?
125 {1, L_3, J_3, K_3}, // Shift_R
126 {1, L_4, J_4, K_4}, // Up
127
128 {1, F_16, D_16, E_16}, // 0
129 {1, F_14, D_14, E_14}, // .
130 {1, F_12, D_12, E_12}, // Ctrl_L
131 {1, F_11, D_11, E_11}, // Win_L
132 {1, F_10, D_10, E_10}, // Alt_L
133 {1, F_6, D_6, E_6}, // Space
134 {1, F_3, D_3, E_3}, // Alt_R
135 {1, F_2, D_2, E_2}, // Fn
136 {1, F_1, D_1, E_1}, // Ctrl_R
137 {1, L_5, J_5, K_5}, // Left
138 {1, L_6, J_6, K_6}, // Down
139 {1, L_7, J_7, K_7}, // Right
140};
141
142#define __ NO_LED
143
144led_config_t g_led_config = {
145 {
146 // Key Matrix to LED Index
147 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, __, 0, 1 },
148 { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 18, 19, 20 },
149 { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 71, 54, 37, 38, 39 },
150 { 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 76, 70, 72, 55, 56, 57 },
151 { 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, __, 89, 90, 73, 74, 75 },
152 { 93, 94, 95, __, __, 21, 96, 40, __, 97, 98, 99, 100, 101, 102, 91, 2, 92 },
153 },
154 {
155 // LED Index to Physical Position
156 {11,0}, {23,0}, {34,0}, {49,0}, {63,0}, {75,0}, {86,0}, {98,0}, {112,0}, {123,0}, {135,0}, {146,0}, {160,0}, {172,0}, {183,0}, {194,0}, {209,0}, {224,0},
157 {0,15}, {11,15}, {23,15}, {34,15}, {49,15}, {60,15}, {72,15}, {83,15}, {95,15}, {106,15}, {117,15}, {129,15}, {140,15}, {152,15}, {163,15}, {175,15}, {186,15}, {204,15}, {224,15},
158 {0,26}, {11,26}, {23,26}, {34,32}, {52,26}, {66,26}, {77,26}, {89,26}, {100,26}, {112,26}, {123,26}, {135,26}, {146,26}, {158,26}, {169,26}, {180,26}, {192,26}, {224,26},
159 {0,38}, {11,38}, {23,38}, {53,38}, {69,38}, {80,38}, {92,38}, {103,38}, {115,38}, {126,38}, {137,38}, {149,38}, {160,38}, {172,38}, {183,38}, {195,38}, {210,34}, {224,38},
160 {0,49}, {11,49}, {23,49}, {34,55}, {50,49}, {63,49}, {75,49}, {86,49}, {97,49}, {109,49}, {120,49}, {132,49}, {143,49}, {155,49}, {166,49}, {177,49}, {193,49}, {212,52},
161 {6,61}, {23,61}, {50,61}, {65,61}, {79,61}, {122,61}, {163,61}, {174,61}, {186,61}, {201,64}, {212,64}, {223,64},
162 },
163 {
164 // RGB LED Index to Flag
165 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
166 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
167 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
168 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
169 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
170 4, 4, 1, 1, 1, 4, 1, 4, 1, 1, 1, 1,
171 }
172};
173#endif
diff --git a/keyboards/keychron/q12/iso_encoder/keymaps/default/keymap.c b/keyboards/keychron/q12/iso_encoder/keymaps/default/keymap.c
new file mode 100644
index 0000000000..93c94fc13b
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/keymaps/default/keymap.c
@@ -0,0 +1,69 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18
19// clang-format off
20
21enum layers{
22 MAC_BASE,
23 MAC_FN,
24 WIN_BASE,
25 WIN_FN
26};
27
28#define KC_TASK LGUI(KC_TAB)
29#define KC_FLXP LGUI(KC_E)
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32 [MAC_BASE] = LAYOUT_iso_104(
33 KC_MUTE, KC_F13, KC_F14, KC_F15, KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, RGB_MOD,
34 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
35 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
36 KC_P4, KC_P5, KC_P6, 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,
37 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
38 KC_P0, KC_PDOT, KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
39 [MAC_FN] = LAYOUT_iso_104(
40 RGB_TOG, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
41 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
42 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
43 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
44 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
45 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
46 [WIN_BASE] = LAYOUT_iso_104(
47 KC_MUTE, _______, _______, _______, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, RGB_MOD,
48 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
49 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
50 KC_P4, KC_P5, KC_P6, 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,
51 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
52 KC_P0, KC_PDOT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
53 [WIN_FN] = LAYOUT_iso_104(
54 RGB_TOG, _______, _______, _______, _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
55 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
56 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
57 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
58 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
59 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
60};
61
62#if defined(ENCODER_MAP_ENABLE)
63const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
64 [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
65 [MAC_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
66 [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
67 [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }
68};
69#endif
diff --git a/keyboards/keychron/q12/iso_encoder/keymaps/default/rules.mk b/keyboards/keychron/q12/iso_encoder/keymaps/default/rules.mk
new file mode 100644
index 0000000000..ee32568148
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/keymaps/default/rules.mk
@@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/keychron/q12/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q12/iso_encoder/keymaps/keychron/keymap.c
new file mode 100644
index 0000000000..ff4d369757
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/keymaps/keychron/keymap.c
@@ -0,0 +1,80 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18#include "keychron_common.h"
19
20// clang-format off
21
22enum layers{
23 MAC_BASE,
24 MAC_FN,
25 WIN_BASE,
26 WIN_FN
27};
28
29const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
30 [MAC_BASE] = LAYOUT_iso_104(
31 KC_MUTE, KC_F13, KC_F14, KC_F15, KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, RGB_MOD,
32 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
33 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
34 KC_P4, KC_P5, KC_P6, 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,
35 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
36 KC_P0, KC_PDOT, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
37 [MAC_FN] = LAYOUT_iso_104(
38 RGB_TOG, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
39 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
40 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
41 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
42 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
43 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
44 [WIN_BASE] = LAYOUT_iso_104(
45 KC_MUTE, _______, _______, _______, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, RGB_MOD,
46 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
47 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
48 KC_P4, KC_P5, KC_P6, 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,
49 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
50 KC_P0, KC_PDOT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
51 [WIN_FN] = LAYOUT_iso_104(
52 RGB_TOG, _______, _______, _______, _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
53 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
54 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
55 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
56 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
57 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
58};
59
60// clang-format on
61
62#if defined(ENCODER_MAP_ENABLE)
63const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
64 [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
65 [MAC_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
66 [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
67 [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }
68};
69#endif
70
71void housekeeping_task_user(void) {
72 housekeeping_task_keychron();
73}
74
75bool process_record_user(uint16_t keycode, keyrecord_t *record) {
76 if (!process_record_keychron(keycode, record)) {
77 return false;
78 }
79 return true;
80}
diff --git a/keyboards/keychron/q12/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q12/iso_encoder/keymaps/keychron/rules.mk
new file mode 100644
index 0000000000..9cf1a9b56c
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/keymaps/keychron/rules.mk
@@ -0,0 +1,5 @@
1VIA_ENABLE = yes
2ENCODER_MAP_ENABLE = yes
3
4VPATH += keyboards/keychron/common
5SRC += keychron_common.c
diff --git a/keyboards/keychron/q12/iso_encoder/keymaps/via/keymap.c b/keyboards/keychron/q12/iso_encoder/keymaps/via/keymap.c
new file mode 100644
index 0000000000..93c94fc13b
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/keymaps/via/keymap.c
@@ -0,0 +1,69 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18
19// clang-format off
20
21enum layers{
22 MAC_BASE,
23 MAC_FN,
24 WIN_BASE,
25 WIN_FN
26};
27
28#define KC_TASK LGUI(KC_TAB)
29#define KC_FLXP LGUI(KC_E)
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32 [MAC_BASE] = LAYOUT_iso_104(
33 KC_MUTE, KC_F13, KC_F14, KC_F15, KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, RGB_MOD,
34 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
35 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
36 KC_P4, KC_P5, KC_P6, 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,
37 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
38 KC_P0, KC_PDOT, KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
39 [MAC_FN] = LAYOUT_iso_104(
40 RGB_TOG, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
41 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
42 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
43 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
44 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
45 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
46 [WIN_BASE] = LAYOUT_iso_104(
47 KC_MUTE, _______, _______, _______, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, RGB_MOD,
48 KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_GRV, 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_PGUP,
49 KC_P7, KC_P8, KC_P9, KC_PPLS, 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_PGDN,
50 KC_P4, KC_P5, KC_P6, 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,
51 KC_P1, KC_P2, KC_P3, KC_PENT, 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,
52 KC_P0, KC_PDOT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
53 [WIN_FN] = LAYOUT_iso_104(
54 RGB_TOG, _______, _______, _______, _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
55 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
56 _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
57 _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
58 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
59 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
60};
61
62#if defined(ENCODER_MAP_ENABLE)
63const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
64 [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
65 [MAC_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
66 [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
67 [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }
68};
69#endif
diff --git a/keyboards/keychron/q12/iso_encoder/keymaps/via/rules.mk b/keyboards/keychron/q12/iso_encoder/keymaps/via/rules.mk
new file mode 100644
index 0000000000..f1adcab005
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
1VIA_ENABLE = yes
2ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/keychron/q12/iso_encoder/rules.mk b/keyboards/keychron/q12/iso_encoder/rules.mk
new file mode 100644
index 0000000000..f76ec9b08d
--- /dev/null
+++ b/keyboards/keychron/q12/iso_encoder/rules.mk
@@ -0,0 +1,27 @@
1# Build Options
2# change yes to no to disable.
3#
4BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
5MOUSEKEY_ENABLE = yes # Mouse keys
6EXTRAKEY_ENABLE = yes # Audio control and System control
7CONSOLE_ENABLE = no # Console for debug
8COMMAND_ENABLE = no # Commands for debug and configuration
9NKRO_ENABLE = yes # Enable USB N-key Rollover
10BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
11RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
12AUDIO_ENABLE = no # Audio output
13ENCODER_ENABLE = yes # Enable Encoder
14DIP_SWITCH_ENABLE = yes
15RGB_MATRIX_ENABLE = yes
16RGB_MATRIX_DRIVER = CKLED2001
17EEPROM_DRIVER = wear_leveling
18WEAR_LEVELING_DRIVER = embedded_flash
19
20# Enter lower-power sleep mode when on the ChibiOS idle thread
21OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
22
23# custom matrix setup
24CUSTOM_MATRIX = lite
25
26VPATH ?= keyboards/keychron/common
27SRC += matrix.c
diff --git a/keyboards/keychron/q12/matrix.c b/keyboards/keychron/q12/matrix.c
new file mode 100644
index 0000000000..8229517fd9
--- /dev/null
+++ b/keyboards/keychron/q12/matrix.c
@@ -0,0 +1,208 @@
1/* Copyright 2022 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "matrix.h"
18#include "quantum.h"
19
20// Pin connected to DS of 74HC595
21#define DATA_PIN C15
22// Pin connected to SH_CP of 74HC595
23#define CLOCK_PIN A1
24// Pin connected to ST_CP of 74HC595
25#define LATCH_PIN A0
26
27#ifdef MATRIX_ROW_PINS
28static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
29#endif // MATRIX_ROW_PINS
30#ifdef MATRIX_COL_PINS
31static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
32#endif // MATRIX_COL_PINS
33
34#define ROWS_PER_HAND (MATRIX_ROWS)
35
36static inline void setPinOutput_writeLow(pin_t pin) {
37 ATOMIC_BLOCK_FORCEON {
38 setPinOutput(pin);
39 writePinLow(pin);
40 }
41}
42
43static inline void setPinOutput_writeHigh(pin_t pin) {
44 ATOMIC_BLOCK_FORCEON {
45 setPinOutput(pin);
46 writePinHigh(pin);
47 }
48}
49
50static inline void setPinInputHigh_atomic(pin_t pin) {
51 ATOMIC_BLOCK_FORCEON {
52 setPinInputHigh(pin);
53 }
54}
55
56static inline uint8_t readMatrixPin(pin_t pin) {
57 if (pin != NO_PIN) {
58 return readPin(pin);
59 } else {
60 return 1;
61 }
62}
63
64static void shiftOut(uint8_t dataOut) {
65 for (uint8_t i = 0; i < 8; i++) {
66 if (dataOut & 0x1) {
67 setPinOutput_writeHigh(DATA_PIN);
68 } else {
69 setPinOutput_writeLow(DATA_PIN);
70 }
71 dataOut = dataOut >> 1;
72 setPinOutput_writeHigh(CLOCK_PIN);
73 setPinOutput_writeLow(CLOCK_PIN);
74 }
75 setPinOutput_writeHigh(LATCH_PIN);
76 setPinOutput_writeLow(LATCH_PIN);
77}
78
79static void shiftout_single(uint8_t data) {
80 if (data & 0x1) {
81 setPinOutput_writeHigh(DATA_PIN);
82 } else {
83 setPinOutput_writeLow(DATA_PIN);
84 }
85 setPinOutput_writeHigh(CLOCK_PIN);
86 setPinOutput_writeLow(CLOCK_PIN);
87
88 setPinOutput_writeHigh(LATCH_PIN);
89 setPinOutput_writeLow(LATCH_PIN);
90}
91
92static bool select_col(uint8_t col) {
93 pin_t pin = col_pins[col];
94
95 if (pin != NO_PIN) {
96 setPinOutput_writeLow(pin);
97 return true;
98 } else {
99 if (col == 10) {
100 shiftout_single(0x00);
101 } else {
102 shiftout_single(0x01);
103 }
104 return true;
105 }
106 return false;
107}
108
109static void unselect_col(uint8_t col) {
110 pin_t pin = col_pins[col];
111
112 if (pin != NO_PIN) {
113#ifdef MATRIX_UNSELECT_DRIVE_HIGH
114 setPinOutput_writeHigh(pin);
115#else
116 setPinInputHigh_atomic(pin);
117#endif
118 } else {
119 if (col == (MATRIX_COLS - 1))
120 setPinOutput_writeHigh(CLOCK_PIN);
121 setPinOutput_writeLow(CLOCK_PIN);
122 setPinOutput_writeHigh(LATCH_PIN);
123 setPinOutput_writeLow(LATCH_PIN);
124 }
125}
126
127static void unselect_cols(void) {
128 // unselect column pins
129 for (uint8_t x = 0; x < MATRIX_COLS; x++) {
130 pin_t pin = col_pins[x];
131 if (pin != NO_PIN) {
132#ifdef MATRIX_UNSELECT_DRIVE_HIGH
133 setPinOutput_writeHigh(pin);
134#else
135 setPinInputHigh_atomic(pin);
136#endif
137 }
138 if (x == 10)
139 // unselect shift Register
140 shiftOut(0xFF);
141 }
142}
143
144static void matrix_init_pins(void) {
145 unselect_cols();
146 for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
147 if (row_pins[x] != NO_PIN) {
148 setPinInputHigh_atomic(row_pins[x]);
149 }
150 }
151}
152
153static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) {
154 bool key_pressed = false;
155
156 // Select col
157 if (!select_col(current_col)) { // select col
158 return; // skip NO_PIN col
159 }
160
161 if (current_col < 10) {
162 matrix_output_select_delay();
163 } else {
164 for (int8_t cycle = 4; cycle > 0; cycle--) {
165 matrix_output_select_delay(); // 0.25us
166 matrix_output_select_delay();
167 matrix_output_select_delay();
168 matrix_output_select_delay();
169 }
170 }
171
172 // For each row...
173 for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) {
174 // Check row pin state
175 if (readMatrixPin(row_pins[row_index]) == 0) {
176 // Pin LO, set col bit
177 current_matrix[row_index] |= row_shifter;
178 key_pressed = true;
179 } else {
180 // Pin HI, clear col bit
181 current_matrix[row_index] &= ~row_shifter;
182 }
183 }
184
185 // // Unselect col
186 unselect_col(current_col);
187 matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH
188}
189
190void matrix_init_custom(void) {
191 // initialize key pins
192 matrix_init_pins();
193}
194
195bool matrix_scan_custom(matrix_row_t current_matrix[]) {
196 matrix_row_t curr_matrix[MATRIX_ROWS] = {0};
197
198 // Set col, read rows
199 matrix_row_t row_shifter = MATRIX_ROW_SHIFTER;
200 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) {
201 matrix_read_rows_on_col(curr_matrix, current_col, row_shifter);
202 }
203
204 bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0;
205 if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix));
206
207 return changed;
208}
diff --git a/keyboards/keychron/q12/mcuconf.h b/keyboards/keychron/q12/mcuconf.h
new file mode 100644
index 0000000000..0ca8c64850
--- /dev/null
+++ b/keyboards/keychron/q12/mcuconf.h
@@ -0,0 +1,22 @@
1/* Copyright 2020 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include_next <mcuconf.h>
20
21#undef STM32_I2C_USE_I2C1
22#define STM32_I2C_USE_I2C1 TRUE
diff --git a/keyboards/keychron/q12/q12.c b/keyboards/keychron/q12/q12.c
new file mode 100644
index 0000000000..3d8eab5659
--- /dev/null
+++ b/keyboards/keychron/q12/q12.c
@@ -0,0 +1,93 @@
1/* Copyright 2023 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "quantum.h"
18
19// clang-format off
20const matrix_row_t matrix_mask[] = {
21 0b111111111111111111,
22 0b111111111111111111,
23 0b111111111111111111,
24 0b111111111111111111,
25 0b111111111111111111,
26 0b111111111111101111,
27};
28// clang-format on
29#ifdef DIP_SWITCH_ENABLE
30bool dip_switch_update_kb(uint8_t index, bool active) {
31 if (!dip_switch_update_user(index, active)) {
32 return false;
33 }
34 if (index == 0) {
35 default_layer_set(1UL << (active ? 2 : 0));
36 }
37 return true;
38}
39#endif
40
41#if defined(RGB_MATRIX_ENABLE) && (defined(CAPS_LOCK_LED_INDEX) || defined(NUM_LOCK_LED_INDEX))
42bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
43 if (!process_record_user(keycode, record)) {
44 return false;
45 }
46 switch (keycode) {
47 case RGB_TOG:
48 if (record->event.pressed) {
49 switch (rgb_matrix_get_flags()) {
50 case LED_FLAG_ALL: {
51 rgb_matrix_set_flags(LED_FLAG_NONE);
52 rgb_matrix_set_color_all(0, 0, 0);
53 } break;
54 default: {
55 rgb_matrix_set_flags(LED_FLAG_ALL);
56 } break;
57 }
58 }
59 if (!rgb_matrix_is_enabled()) {
60 rgb_matrix_set_flags(LED_FLAG_ALL);
61 rgb_matrix_enable();
62 }
63 return false;
64 }
65 return true;
66}
67
68bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
69 if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
70 return false;
71 }
72 // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue);
73# if defined(CAPS_LOCK_LED_INDEX)
74 if (host_keyboard_led_state().caps_lock) {
75 RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255);
76 } else {
77 if (!rgb_matrix_get_flags()) {
78 RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0);
79 }
80 }
81# endif // CAPS_LOCK_LED_INDEX
82# if defined(NUM_LOCK_LED_INDEX)
83 if (host_keyboard_led_state().num_lock) {
84 RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 255, 255, 255);
85 } else {
86 if (!rgb_matrix_get_flags()) {
87 RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 0, 0, 0);
88 }
89 }
90# endif // NUM_LOCK_LED_INDEX
91 return true;
92}
93#endif
diff --git a/keyboards/keychron/q12/readme.md b/keyboards/keychron/q12/readme.md
new file mode 100644
index 0000000000..be9ec6f3e8
--- /dev/null
+++ b/keyboards/keychron/q12/readme.md
@@ -0,0 +1,19 @@
1# Keychron Q12
2
3A customizable 96% keyboard.
4
5* Keyboard Maintainer: [Keychron](https://github.com/keychron)
6* Hardware Supported: Keychron Q12
7* Hardware Availability: [Keychron](https://www.keychron.com)
8
9Make example for this keyboard (after setting up your build environment):
10
11 make keychron/q12/q12_ansi_stm32l432:default
12
13Flashing example for this keyboard:
14
15 make keychron/q12/q12_ansi_stm32l432:default:flash
16
17**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard.
18
19See 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).