aboutsummaryrefslogtreecommitdiff
path: root/keyboards/keychron/q2/rev_0113
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/keychron/q2/rev_0113')
-rw-r--r--keyboards/keychron/q2/rev_0113/config.h28
-rw-r--r--keyboards/keychron/q2/rev_0113/keymaps/default/info.json83
-rw-r--r--keyboards/keychron/q2/rev_0113/keymaps/default/keymap.c94
-rw-r--r--keyboards/keychron/q2/rev_0113/keymaps/via/info.json85
-rw-r--r--keyboards/keychron/q2/rev_0113/keymaps/via/keymap.c154
-rw-r--r--keyboards/keychron/q2/rev_0113/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/q2/rev_0113/readme.md5
-rw-r--r--keyboards/keychron/q2/rev_0113/rev_0113.c31
-rw-r--r--keyboards/keychron/q2/rev_0113/rev_0113.h48
-rw-r--r--keyboards/keychron/q2/rev_0113/rules.mk34
10 files changed, 564 insertions, 0 deletions
diff --git a/keyboards/keychron/q2/rev_0113/config.h b/keyboards/keychron/q2/rev_0113/config.h
new file mode 100644
index 000000000..21ada693c
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/config.h
@@ -0,0 +1,28 @@
1/* Copyright 2021 @ 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/* USB Device descriptor parameter */
20#define PRODUCT_ID 0x0113
21#define DEVICE_VER 0x0100
22
23/* Encoder used pins */
24#define ENCODERS_PAD_A { A10 }
25#define ENCODERS_PAD_B { B5 }
26
27/* Specifies the number of pulses the encoder registers between each detent */
28#define ENCODER_RESOLUTION 2
diff --git a/keyboards/keychron/q2/rev_0113/keymaps/default/info.json b/keyboards/keychron/q2/rev_0113/keymaps/default/info.json
new file mode 100644
index 000000000..8448d4c99
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/keymaps/default/info.json
@@ -0,0 +1,83 @@
1{
2 "keyboard_name": "Keychron Q2",
3 "url": "https://github.com/Keychron",
4 "maintainer": "lalalademaxiya1",
5 "layouts": {
6 "LAYOUT_iso_68": {
7 "layout": [
8 {"label":"Mute", "x":15.25, "y":0},
9
10 {"label":"Esc", "x":0, "y":0.25},
11 {"label":"!", "x":1, "y":0.25},
12 {"label":"@", "x":2, "y":0.25},
13 {"label":"", "x":3, "y":0.25},
14 {"label":"$", "x":4, "y":0.25},
15 {"label":"%", "x":5, "y":0.25},
16 {"label":"^", "x":6, "y":0.25},
17 {"label":"&", "x":7, "y":0.25},
18 {"label":"*", "x":8, "y":0.25},
19 {"label":"(", "x":9, "y":0.25},
20 {"label":")", "x":10, "y":0.25},
21 {"label":"_", "x":11, "y":0.25},
22 {"label":"+", "x":12, "y":0.25},
23 {"label":"Backspace", "x":13, "y":0.25, "w":2},
24
25 {"label":"Tab", "x":0, "y":1.25, "w":1.5},
26 {"label":"Q", "x":1.5, "y":1.25},
27 {"label":"W", "x":2.5, "y":1.25},
28 {"label":"E", "x":3.5, "y":1.25},
29 {"label":"R", "x":4.5, "y":1.25},
30 {"label":"T", "x":5.5, "y":1.25},
31 {"label":"Y", "x":6.5, "y":1.25},
32 {"label":"U", "x":7.5, "y":1.25},
33 {"label":"I", "x":8.5, "y":1.25},
34 {"label":"O", "x":9.5, "y":1.25},
35 {"label":"P", "x":10.5, "y":1.25},
36 {"label":"{", "x":11.5, "y":1.25},
37 {"label":"}", "x":12.5, "y":1.25},
38 {"label":"Delete", "x":15.25, "y":1.25},
39
40 {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
41 {"label":"A", "x":1.75, "y":2.25},
42 {"label":"S", "x":2.75, "y":2.25},
43 {"label":"D", "x":3.75, "y":2.25},
44 {"label":"F", "x":4.75, "y":2.25},
45 {"label":"G", "x":5.75, "y":2.25},
46 {"label":"H", "x":6.75, "y":2.25},
47 {"label":"J", "x":7.75, "y":2.25},
48 {"label":"K", "x":8.75, "y":2.25},
49 {"label":"L", "x":9.75, "y":2.25},
50 {"label":":", "x":10.75, "y":2.25},
51 {"label":"\"", "x":11.75, "y":2.25},
52 {"label":"#~", "x":12.75, "y":2.25},
53 {"label":"Enter", "x":13.75, "y":2.25, "w":1.25},
54 {"label":"Home", "x":15.25, "y":2.25},
55
56 {"label":"Shift", "x":0, "y":3.25, "w":1.25},
57 {"label":"|", "x":1.25, "y":3.25},
58 {"label":"Z", "x":2.25, "y":3.25},
59 {"label":"X", "x":3.25, "y":3.25},
60 {"label":"C", "x":4.25, "y":3.25},
61 {"label":"V", "x":5.25, "y":3.25},
62 {"label":"B", "x":6.25, "y":3.25},
63 {"label":"N", "x":7.25, "y":3.25},
64 {"label":"M", "x":8.25, "y":3.25},
65 {"label":"<", "x":9.25, "y":3.25},
66 {"label":">", "x":10.25, "y":3.25},
67 {"label":"?", "x":11.25, "y":3.25},
68 {"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
69 {"label":"Up", "x":14.25, "y":3.5},
70
71 {"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
72 {"label":"Win", "x":1.25, "y":4.25, "w":1.25},
73 {"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
74 {"label":"Space", "x":3.75, "y":4.25, "w":6.25},
75 {"label":"Alt", "x":10, "y":4.25},
76 {"label":"Fn1", "x":11, "y":4.25},
77 {"label":"Fn2", "x":12, "y":4.25},
78 {"label":"Left", "x":13.25, "y":4.5},
79 {"label":"Down", "x":14.25, "y":4.5},
80 {"label":"Right", "x":15.25, "y":4.5} ]
81 }
82 }
83}
diff --git a/keyboards/keychron/q2/rev_0113/keymaps/default/keymap.c b/keyboards/keychron/q2/rev_0113/keymaps/default/keymap.c
new file mode 100644
index 000000000..e3e6cf737
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/keymaps/default/keymap.c
@@ -0,0 +1,94 @@
1/* Copyright 2021 @ 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
19enum layers{
20 MAC_BASE,
21 WIN_BASE,
22 _FN1,
23 _FN2,
24 _FN3
25};
26
27enum custom_keycodes {
28 KC_MISSION_CONTROL = SAFE_RANGE,
29 KC_LAUNCHPAD
30};
31
32#define KC_WAVE S(KC_GRV)
33#define KC_TASK LGUI(KC_TAB)
34#define KC_FLXP LGUI(KC_E)
35#define KC_MCTL KC_MISSION_CONTROL
36#define KC_LPAD KC_LAUNCHPAD
37
38const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 [MAC_BASE] = LAYOUT_iso_68(
40 KC_ESC, KC_1, KC_2, KC_F3, KC_F4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE,
41 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,
42 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,
43 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,
44 KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
45
46 [WIN_BASE] = LAYOUT_iso_68(
47 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,
48 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,
49 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,
50 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,
51 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
52
53 [_FN1] = LAYOUT_iso_68(
54 KC_GRV, 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_TRNS, KC_TRNS,
55 RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
56 KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
57 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
58 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
59
60 [_FN2] = LAYOUT_iso_68(
61 KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS,
62 RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
63 KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
64 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
65 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
66
67 [_FN3] = LAYOUT_iso_68(
68 KC_WAVE, 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_TRNS, KC_TRNS,
69 RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
70 KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
71 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
72 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
73};
74
75bool process_record_user(uint16_t keycode, keyrecord_t *record) {
76 switch (keycode) {
77 case KC_MISSION_CONTROL:
78 if (record->event.pressed) {
79 host_consumer_send(0x29F);
80 } else {
81 host_consumer_send(0);
82 }
83 return false; // Skip all further processing of this key
84 case KC_LAUNCHPAD:
85 if (record->event.pressed) {
86 host_consumer_send(0x2A0);
87 } else {
88 host_consumer_send(0);
89 }
90 return false; // Skip all further processing of this key
91 default:
92 return true; // Process all other keycodes normally
93 }
94}
diff --git a/keyboards/keychron/q2/rev_0113/keymaps/via/info.json b/keyboards/keychron/q2/rev_0113/keymaps/via/info.json
new file mode 100644
index 000000000..6111f83d2
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/keymaps/via/info.json
@@ -0,0 +1,85 @@
1{
2 "keyboard_name": "Keychron Q2",
3 "url": "https://github.com/Keychron",
4 "maintainer": "lalalademaxiya1",
5 "layouts": {
6 "LAYOUT_iso_68": {
7 "layout": [
8 {"label":"Mute", "x":15.25, "y":0, "w":0.75},
9 {"label":"Vol-", "x":16, "y":0, "w":0.75, "h":0.5},
10 {"label":"Vol+", "x":16, "y":0.5, "w":0.75, "h":0.5},
11
12 {"label":"Esc", "x":0, "y":0.25},
13 {"label":"!", "x":1, "y":0.25},
14 {"label":"@", "x":2, "y":0.25},
15 {"label":"", "x":3, "y":0.25},
16 {"label":"$", "x":4, "y":0.25},
17 {"label":"%", "x":5, "y":0.25},
18 {"label":"^", "x":6, "y":0.25},
19 {"label":"&", "x":7, "y":0.25},
20 {"label":"*", "x":8, "y":0.25},
21 {"label":"(", "x":9, "y":0.25},
22 {"label":")", "x":10, "y":0.25},
23 {"label":"_", "x":11, "y":0.25},
24 {"label":"+", "x":12, "y":0.25},
25 {"label":"Backspace", "x":13, "y":0.25, "w":2},
26
27 {"label":"Tab", "x":0, "y":1.25, "w":1.5},
28 {"label":"Q", "x":1.5, "y":1.25},
29 {"label":"W", "x":2.5, "y":1.25},
30 {"label":"E", "x":3.5, "y":1.25},
31 {"label":"R", "x":4.5, "y":1.25},
32 {"label":"T", "x":5.5, "y":1.25},
33 {"label":"Y", "x":6.5, "y":1.25},
34 {"label":"U", "x":7.5, "y":1.25},
35 {"label":"I", "x":8.5, "y":1.25},
36 {"label":"O", "x":9.5, "y":1.25},
37 {"label":"P", "x":10.5, "y":1.25},
38 {"label":"{", "x":11.5, "y":1.25},
39 {"label":"}", "x":12.5, "y":1.25},
40 {"label":"Delete", "x":15.25, "y":1.25},
41
42 {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
43 {"label":"A", "x":1.75, "y":2.25},
44 {"label":"S", "x":2.75, "y":2.25},
45 {"label":"D", "x":3.75, "y":2.25},
46 {"label":"F", "x":4.75, "y":2.25},
47 {"label":"G", "x":5.75, "y":2.25},
48 {"label":"H", "x":6.75, "y":2.25},
49 {"label":"J", "x":7.75, "y":2.25},
50 {"label":"K", "x":8.75, "y":2.25},
51 {"label":"L", "x":9.75, "y":2.25},
52 {"label":":", "x":10.75, "y":2.25},
53 {"label":"\"", "x":11.75, "y":2.25},
54 {"label":"#~", "x":12.75, "y":2.25},
55 {"label":"Enter", "x":13.75, "y":2.25, "w":1.25},
56 {"label":"Home", "x":15.25, "y":2.25},
57
58 {"label":"Shift", "x":0, "y":3.25, "w":1.25},
59 {"label":"|", "x":1.25, "y":3.25},
60 {"label":"Z", "x":2.25, "y":3.25},
61 {"label":"X", "x":3.25, "y":3.25},
62 {"label":"C", "x":4.25, "y":3.25},
63 {"label":"V", "x":5.25, "y":3.25},
64 {"label":"B", "x":6.25, "y":3.25},
65 {"label":"N", "x":7.25, "y":3.25},
66 {"label":"M", "x":8.25, "y":3.25},
67 {"label":"<", "x":9.25, "y":3.25},
68 {"label":">", "x":10.25, "y":3.25},
69 {"label":"?", "x":11.25, "y":3.25},
70 {"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
71 {"label":"Up", "x":14.25, "y":3.5},
72
73 {"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
74 {"label":"Win", "x":1.25, "y":4.25, "w":1.25},
75 {"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
76 {"label":"Space", "x":3.75, "y":4.25, "w":6.25},
77 {"label":"Alt", "x":10, "y":4.25},
78 {"label":"Fn1", "x":11, "y":4.25},
79 {"label":"Fn2", "x":12, "y":4.25},
80 {"label":"Left", "x":13.25, "y":4.5},
81 {"label":"Down", "x":14.25, "y":4.5},
82 {"label":"Right", "x":15.25, "y":4.5} ]
83 }
84 }
85}
diff --git a/keyboards/keychron/q2/rev_0113/keymaps/via/keymap.c b/keyboards/keychron/q2/rev_0113/keymaps/via/keymap.c
new file mode 100644
index 000000000..9c7ad72be
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/keymaps/via/keymap.c
@@ -0,0 +1,154 @@
1/* Copyright 2021 @ 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
19enum layers{
20 MAC_BASE,
21 WIN_BASE,
22 _FN1,
23 _FN2,
24 _FN3
25};
26
27enum custom_keycodes {
28 KC_MISSION_CONTROL = USER00,
29 KC_LAUNCHPAD,
30 KC_TASK,
31 KC_FLXP
32};
33
34#define KC_WAVE S(KC_GRV)
35#define KC_MCTL KC_MISSION_CONTROL
36#define KC_LPAD KC_LAUNCHPAD
37
38const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 [MAC_BASE] = LAYOUT_all(
40 KC_ESC, KC_1, KC_2, KC_F3, KC_F4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE,
41 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,
42 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,
43 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,
44 KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_VOLD, KC_VOLU, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
45
46 [WIN_BASE] = LAYOUT_all(
47 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,
48 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,
49 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,
50 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,
51 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_VOLD, KC_VOLU, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
52
53 [_FN1] = LAYOUT_all(
54 KC_GRV, 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_TRNS, KC_TRNS,
55 RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
56 KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
57 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
58 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
59
60 [_FN2] = LAYOUT_all(
61 KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS,
62 RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
63 KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
64 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
65 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
66
67 [_FN3] = LAYOUT_all(
68 KC_WAVE, 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_TRNS, KC_TRNS,
69 RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
70 KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
71 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
72 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
73};
74
75#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
76
77#define ENCODERS 1
78static uint8_t encoder_state[ENCODERS] = {0};
79static keypos_t encoder_cw[ENCODERS] = {{ 8, 4 }};
80static keypos_t encoder_ccw[ENCODERS] = {{ 7, 4 }};
81
82void encoder_action_register(uint8_t index, bool clockwise) {
83 keyevent_t encoder_event = (keyevent_t) {
84 .key = clockwise ? encoder_cw[index] : encoder_ccw[index],
85 .pressed = true,
86 .time = (timer_read() | 1)
87 };
88 encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
89 action_exec(encoder_event);
90}
91
92void encoder_action_unregister(void) {
93 for (int index = 0; index < ENCODERS; ++index) {
94 if (encoder_state[index]) {
95 keyevent_t encoder_event = (keyevent_t) {
96 .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
97 .pressed = false,
98 .time = (timer_read() | 1)
99 };
100 encoder_state[index] = 0;
101 action_exec(encoder_event);
102 }
103 }
104}
105
106void matrix_scan_user(void) {
107 encoder_action_unregister();
108}
109
110bool encoder_update_user(uint8_t index, bool clockwise) {
111 encoder_action_register(index, clockwise);
112 return false;
113};
114
115#endif
116
117bool process_record_user(uint16_t keycode, keyrecord_t *record) {
118 switch (keycode) {
119 case KC_MISSION_CONTROL:
120 if (record->event.pressed) {
121 host_consumer_send(0x29F);
122 } else {
123 host_consumer_send(0);
124 }
125 return false; // Skip all further processing of this key
126 case KC_LAUNCHPAD:
127 if (record->event.pressed) {
128 host_consumer_send(0x2A0);
129 } else {
130 host_consumer_send(0);
131 }
132 return false; // Skip all further processing of this key
133 case KC_TASK:
134 if (record->event.pressed) {
135 register_code(KC_LWIN);
136 register_code(KC_TAB);
137 } else {
138 unregister_code(KC_LWIN);
139 unregister_code(KC_TAB);
140 }
141 return false; // Skip all further processing of this key
142 case KC_FLXP:
143 if (record->event.pressed) {
144 register_code(KC_LWIN);
145 register_code(KC_E);
146 } else {
147 unregister_code(KC_LWIN);
148 unregister_code(KC_E);
149 }
150 return false; // Skip all further processing of this key
151 default:
152 return true; // Process all other keycodes normally
153 }
154}
diff --git a/keyboards/keychron/q2/rev_0113/keymaps/via/rules.mk b/keyboards/keychron/q2/rev_0113/keymaps/via/rules.mk
new file mode 100644
index 000000000..bee21da52
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
1VIA_ENABLE = yes
2MOUSEKEY_ENABLE = no \ No newline at end of file
diff --git a/keyboards/keychron/q2/rev_0113/readme.md b/keyboards/keychron/q2/rev_0113/readme.md
new file mode 100644
index 000000000..1d808cbb7
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/readme.md
@@ -0,0 +1,5 @@
1# The ISO variant of the Keychron Q2 and support encoder
2
3- Enable EC11 rotary encoder
4- Turn colckwise to increase volume and turn anti-colckwise to decrease volume
5- Press top right key pushbutton to mute
diff --git a/keyboards/keychron/q2/rev_0113/rev_0113.c b/keyboards/keychron/q2/rev_0113/rev_0113.c
new file mode 100644
index 000000000..c9413d023
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/rev_0113.c
@@ -0,0 +1,31 @@
1/* Copyright 2021 @ 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 ENCODER_ENABLE
20bool encoder_update_kb(uint8_t index, bool clockwise) {
21 if (!encoder_update_user(index, clockwise)) { return false; }
22 if (index == 0) {
23 if (clockwise) {
24 tap_code_delay(KC_VOLU, 10);
25 } else {
26 tap_code_delay(KC_VOLD, 10);
27 }
28 }
29 return true;
30}
31#endif
diff --git a/keyboards/keychron/q2/rev_0113/rev_0113.h b/keyboards/keychron/q2/rev_0113/rev_0113.h
new file mode 100644
index 000000000..21d20463e
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/rev_0113.h
@@ -0,0 +1,48 @@
1/* Copyright 2021 @ 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#include "quantum.h"
20
21#define XXX KC_NO
22
23#define LAYOUT_all( \
24 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E,\
25 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1E,\
26 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K1D, K2E,\
27 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
28 K40, K41, K42, K46, K47, K48, K4A, K4B, K4C, K4D, K2C, K4E \
29) { \
30 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, }, \
31 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, }, \
32 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, }, \
33 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, K3E, }, \
34 { K40, K41, K42, XXX, XXX, XXX, K46, K47, K48, XXX, K4A, K4B, K4C, K4D, K4E, } \
35}
36#define LAYOUT_iso_68( \
37 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E,\
38 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1E,\
39 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K1D, K2E,\
40 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
41 K40, K41, K42, K46, K4A, K4B, K4C, K4D, K2C, K4E \
42) { \
43 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, }, \
44 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, }, \
45 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, }, \
46 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, K3E, }, \
47 { K40, K41, K42, XXX, XXX, XXX, K46, XXX, XXX, XXX, K4A, K4B, K4C, K4D, K4E, } \
48}
diff --git a/keyboards/keychron/q2/rev_0113/rules.mk b/keyboards/keychron/q2/rev_0113/rules.mk
new file mode 100644
index 000000000..52d0bce59
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0113/rules.mk
@@ -0,0 +1,34 @@
1# MCU name
2# MCU = STM32L432
3MCU = cortex-m4
4ARMV = 7
5MCU_FAMILY = STM32
6MCU_SERIES = STM32L4xx
7MCU_LDSCRIPT = STM32L432xB
8MCU_STARTUP = stm32l4xx
9BOARD = GENERIC_STM32_L433XC
10PLATFORM_NAME = platform_l432
11
12# Build Options
13# change yes to no to disable
14#
15BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
16MOUSEKEY_ENABLE = no # Mouse keys
17EXTRAKEY_ENABLE = yes # Audio control and System control
18CONSOLE_ENABLE = no # Console for debug
19COMMAND_ENABLE = no # Commands for debug and configuration
20NKRO_ENABLE = yes # Enable N-Key Rollover
21BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
22RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
23AUDIO_ENABLE = no # Audio output
24ENCODER_ENABLE = yes # Enable Encoder
25DIP_SWITCH_ENABLE = yes
26EEPROM_DRIVER = i2c
27
28# Enter lower-power sleep mode when on the ChibiOS idle thread
29OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
30
31# custom matrix setup
32CUSTOM_MATRIX = lite
33
34SRC += matrix.c