aboutsummaryrefslogtreecommitdiff
path: root/keyboards/keychron
diff options
context:
space:
mode:
authorlalalademaxiya1 <66767061+lalalademaxiya1@users.noreply.github.com>2022-01-15 02:58:09 +0800
committerGitHub <noreply@github.com>2022-01-14 10:58:09 -0800
commitca0f922e073db9804ab0b55c62a43d81a957dce8 (patch)
tree551937bb95a21e264754deb60394dde87e2e4855 /keyboards/keychron
parent9e92d8a9054329200661efbc92022af7c67675bb (diff)
downloadqmk_firmware-ca0f922e073db9804ab0b55c62a43d81a957dce8.tar.gz
qmk_firmware-ca0f922e073db9804ab0b55c62a43d81a957dce8.zip
[Keyboard] Add Keychron_q1 rev_0101 and Keychron q2 series (#15025)
Co-authored-by: Joel Challis <git@zvecr.com> Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Cesar Rojas <cesar.fieoner@gmail.com> Co-authored-by: lokher <lokher@gmail.com> Co-authored-by: Adam Karim <adam@akarsoft.com>
Diffstat (limited to 'keyboards/keychron')
-rw-r--r--keyboards/keychron/q1/config.h11
-rw-r--r--keyboards/keychron/q1/q1.h5
-rw-r--r--keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c95
-rw-r--r--keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c109
-rw-r--r--keyboards/keychron/q1/rev_0101/config.h37
-rw-r--r--keyboards/keychron/q1/rev_0101/keymaps/default/info.json97
-rw-r--r--keyboards/keychron/q1/rev_0101/keymaps/default/keymap.c90
-rw-r--r--keyboards/keychron/q1/rev_0101/keymaps/via/info.json100
-rw-r--r--keyboards/keychron/q1/rev_0101/keymaps/via/keymap.c131
-rw-r--r--keyboards/keychron/q1/rev_0101/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/q1/rev_0101/readme.md4
-rw-r--r--keyboards/keychron/q1/rev_0101/rev_0101.c156
-rw-r--r--keyboards/keychron/q1/rev_0101/rev_0101.h52
-rw-r--r--keyboards/keychron/q1/rev_0101/rules.mk22
-rw-r--r--keyboards/keychron/q1/rev_0102/keymaps/default/keymap.c87
-rw-r--r--keyboards/keychron/q1/rev_0102/keymaps/via/keymap.c109
-rw-r--r--keyboards/keychron/q1/rev_0102/rev_0102.c3
-rw-r--r--keyboards/keychron/q2/chconf.h30
-rw-r--r--keyboards/keychron/q2/config.h54
-rw-r--r--keyboards/keychron/q2/halconf.h26
-rw-r--r--keyboards/keychron/q2/matrix.c139
-rw-r--r--keyboards/keychron/q2/mcuconf.h27
-rw-r--r--keyboards/keychron/q2/q2.c33
-rw-r--r--keyboards/keychron/q2/q2.h29
-rw-r--r--keyboards/keychron/q2/readme.md19
-rw-r--r--keyboards/keychron/q2/rev_0110/config.h21
-rw-r--r--keyboards/keychron/q2/rev_0110/info.json82
-rw-r--r--keyboards/keychron/q2/rev_0110/keymaps/default/keymap.c94
-rw-r--r--keyboards/keychron/q2/rev_0110/keymaps/via/keymap.c112
-rw-r--r--keyboards/keychron/q2/rev_0110/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/q2/rev_0110/readme.md1
-rw-r--r--keyboards/keychron/q2/rev_0110/rev_0110.c17
-rw-r--r--keyboards/keychron/q2/rev_0110/rev_0110.h35
-rw-r--r--keyboards/keychron/q2/rev_0110/rules.mk34
-rw-r--r--keyboards/keychron/q2/rev_0111/config.h28
-rw-r--r--keyboards/keychron/q2/rev_0111/keymaps/default/info.json82
-rw-r--r--keyboards/keychron/q2/rev_0111/keymaps/default/keymap.c94
-rw-r--r--keyboards/keychron/q2/rev_0111/keymaps/via/info.json84
-rw-r--r--keyboards/keychron/q2/rev_0111/keymaps/via/keymap.c154
-rw-r--r--keyboards/keychron/q2/rev_0111/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/q2/rev_0111/readme.md5
-rw-r--r--keyboards/keychron/q2/rev_0111/rev_0111.c31
-rw-r--r--keyboards/keychron/q2/rev_0111/rev_0111.h48
-rw-r--r--keyboards/keychron/q2/rev_0111/rules.mk34
-rw-r--r--keyboards/keychron/q2/rev_0112/config.h21
-rw-r--r--keyboards/keychron/q2/rev_0112/info.json83
-rw-r--r--keyboards/keychron/q2/rev_0112/keymaps/default/keymap.c94
-rw-r--r--keyboards/keychron/q2/rev_0112/keymaps/via/keymap.c112
-rw-r--r--keyboards/keychron/q2/rev_0112/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/q2/rev_0112/readme.md1
-rw-r--r--keyboards/keychron/q2/rev_0112/rev_0112.c17
-rw-r--r--keyboards/keychron/q2/rev_0112/rev_0112.h36
-rw-r--r--keyboards/keychron/q2/rev_0112/rules.mk34
-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
63 files changed, 3255 insertions, 136 deletions
diff --git a/keyboards/keychron/q1/config.h b/keyboards/keychron/q1/config.h
index 8107dd625..de69b9e92 100644
--- a/keyboards/keychron/q1/config.h
+++ b/keyboards/keychron/q1/config.h
@@ -16,7 +16,6 @@
16 16
17#pragma once 17#pragma once
18 18
19
20/* USB Device descriptor parameter */ 19/* USB Device descriptor parameter */
21#define VENDOR_ID 0x3434 20#define VENDOR_ID 0x3434
22#define MANUFACTURER Keychron 21#define MANUFACTURER Keychron
@@ -49,6 +48,11 @@
49/* Disable RGB lighting when PC is in suspend */ 48/* Disable RGB lighting when PC is in suspend */
50#define RGB_DISABLE_WHEN_USB_SUSPENDED 49#define RGB_DISABLE_WHEN_USB_SUSPENDED
51 50
51/* Allow VIA to edit lighting */
52#ifdef VIA_ENABLE
53#define VIA_QMK_RGBLIGHT_ENABLE
54#endif
55
52// RGB Matrix Animation modes. Explicitly enabled 56// RGB Matrix Animation modes. Explicitly enabled
53// For full list of effects, see: 57// For full list of effects, see:
54// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects 58// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
@@ -97,3 +101,8 @@
97#define ENABLE_RGB_MATRIX_MULTISPLASH 101#define ENABLE_RGB_MATRIX_MULTISPLASH
98#define ENABLE_RGB_MATRIX_SOLID_SPLASH 102#define ENABLE_RGB_MATRIX_SOLID_SPLASH
99#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH 103#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
104
105/* Allow VIA to edit lighting */
106#ifdef VIA_ENABLE
107#define VIA_QMK_RGBLIGHT_ENABLE
108#endif
diff --git a/keyboards/keychron/q1/q1.h b/keyboards/keychron/q1/q1.h
index eb9a7d69a..cf6d19621 100644
--- a/keyboards/keychron/q1/q1.h
+++ b/keyboards/keychron/q1/q1.h
@@ -18,9 +18,10 @@
18 18
19#include "quantum.h" 19#include "quantum.h"
20 20
21
22#if defined(KEYBOARD_keychron_q1_rev_0100) 21#if defined(KEYBOARD_keychron_q1_rev_0100)
23# include "rev_0100.h" 22# include "rev_0100.h"
23#elif defined(KEYBOARD_keychron_q1_rev_0101)
24# include "rev_0101.h"
24#elif defined(KEYBOARD_keychron_q1_rev_0102) 25#elif defined(KEYBOARD_keychron_q1_rev_0102)
25# include "rev_0102.h" 26# include "rev_0102.h"
26#endif \ No newline at end of file 27#endif
diff --git a/keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c b/keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c
index e000dd7dd..d1f71e9da 100644
--- a/keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c
+++ b/keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c
@@ -16,49 +16,74 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19
20enum layers{ 19enum layers{
21 MAC_BASE, 20 MAC_BASE,
22 MAC_FN, 21 MAC_FN,
23 WIN_BASE, 22 WIN_BASE,
24 WIN_FN 23 WIN_FN
24};
25
26enum custom_keycodes {
27 KC_MISSION_CONTROL = SAFE_RANGE,
28 KC_LAUNCHPAD
25}; 29};
26 30
27#define KC_TASK LGUI(KC_TAB) 31#define KC_TASK LGUI(KC_TAB)
28#define KC_FLXP LGUI(KC_E) 32#define KC_FLXP LGUI(KC_E)
33#define KC_MCTL KC_MISSION_CONTROL
34#define KC_LPAD KC_LAUNCHPAD
29 35
30const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 [MAC_BASE] = LAYOUT_ansi_82(
38 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, KC_INS,
39 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,
40 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,
41 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,
42 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,
43 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
31 44
32[MAC_BASE] = LAYOUT_ansi_82( 45 [MAC_FN] = LAYOUT_ansi_82(
33 KC_ESC, KC_BRID, KC_BRIU, KC_F3, KC_F4, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, 46 KC_TRNS, 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,
34 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_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, KC_TRNS,
35 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 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, KC_TRNS,
36 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_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,
37 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_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,
38 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
39 52
40[MAC_FN] = LAYOUT_ansi_82( 53 [WIN_BASE] = LAYOUT_ansi_82(
41 KC_TRNS, 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, 54 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, KC_INS,
42 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, KC_TRNS, 55 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,
43 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, KC_TRNS, 56 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,
44 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, 57 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,
45 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_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,
46 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 59 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
47 60
48[WIN_BASE] = LAYOUT_ansi_82( 61 [WIN_FN] = LAYOUT_ansi_82(
49 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, KC_INS, 62 KC_TRNS, 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,
50 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, 63 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, KC_TRNS,
51 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, 64 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, KC_TRNS,
52 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, 65 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,
53 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, 66 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,
54 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 67 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
55 68};
56[WIN_FN] = LAYOUT_ansi_82(
57 KC_TRNS, 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,
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, KC_TRNS, KC_TRNS, KC_TRNS,
59 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, KC_TRNS,
60 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,
61 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,
62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
63 69
64}; \ No newline at end of file 70bool process_record_user(uint16_t keycode, keyrecord_t *record) {
71 switch (keycode) {
72 case KC_MISSION_CONTROL:
73 if (record->event.pressed) {
74 host_consumer_send(0x29F);
75 } else {
76 host_consumer_send(0);
77 }
78 return false; // Skip all further processing of this key
79 case KC_LAUNCHPAD:
80 if (record->event.pressed) {
81 host_consumer_send(0x2A0);
82 } else {
83 host_consumer_send(0);
84 }
85 return false; // Skip all further processing of this key
86 default:
87 return true; // Process all other keycodes normally
88 }
89}
diff --git a/keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c b/keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c
index e000dd7dd..1e6316782 100644
--- a/keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c
+++ b/keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c
@@ -16,7 +16,6 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19
20enum layers{ 19enum layers{
21 MAC_BASE, 20 MAC_BASE,
22 MAC_FN, 21 MAC_FN,
@@ -24,41 +23,85 @@ enum layers{
24 WIN_FN 23 WIN_FN
25}; 24};
26 25
27#define KC_TASK LGUI(KC_TAB) 26enum custom_keycodes {
28#define KC_FLXP LGUI(KC_E) 27 KC_MISSION_CONTROL = USER00,
28 KC_LAUNCHPAD,
29 KC_TASK,
30 KC_FLXP
31};
29 32
30const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 33#define KC_MCTL KC_MISSION_CONTROL
34#define KC_LPAD KC_LAUNCHPAD
31 35
32[MAC_BASE] = LAYOUT_ansi_82( 36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
33 KC_ESC, KC_BRID, KC_BRIU, KC_F3, KC_F4, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, 37 [MAC_BASE] = LAYOUT_ansi_82(
34 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, 38 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, KC_INS,
35 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, 39 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,
36 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, 40 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,
37 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, 41 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,
38 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 42 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,
43 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
39 44
40[MAC_FN] = LAYOUT_ansi_82( 45 [MAC_FN] = LAYOUT_ansi_82(
41 KC_TRNS, 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, 46 KC_TRNS, 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,
42 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, KC_TRNS, 47 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, KC_TRNS,
43 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, KC_TRNS, 48 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, KC_TRNS,
44 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, 49 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,
45 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, 50 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,
46 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
47 52
48[WIN_BASE] = LAYOUT_ansi_82( 53 [WIN_BASE] = LAYOUT_ansi_82(
49 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, KC_INS, 54 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, KC_INS,
50 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, 55 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,
51 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, 56 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,
52 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, 57 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,
53 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, 58 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,
54 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 59 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
55 60
56[WIN_FN] = LAYOUT_ansi_82( 61 [WIN_FN] = LAYOUT_ansi_82(
57 KC_TRNS, 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 KC_TRNS, 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,
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, KC_TRNS, KC_TRNS, KC_TRNS, 63 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, KC_TRNS,
59 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, KC_TRNS, 64 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, KC_TRNS,
60 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, 65 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,
61 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, 66 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,
62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) 67 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
68};
63 69
64}; \ No newline at end of file 70bool process_record_user(uint16_t keycode, keyrecord_t *record) {
71 switch (keycode) {
72 case KC_MISSION_CONTROL:
73 if (record->event.pressed) {
74 host_consumer_send(0x29F);
75 } else {
76 host_consumer_send(0);
77 }
78 return false; // Skip all further processing of this key
79 case KC_LAUNCHPAD:
80 if (record->event.pressed) {
81 host_consumer_send(0x2A0);
82 } else {
83 host_consumer_send(0);
84 }
85 return false; // Skip all further processing of this key
86 case KC_TASK:
87 if (record->event.pressed) {
88 register_code(KC_LWIN);
89 register_code(KC_TAB);
90 } else {
91 unregister_code(KC_LWIN);
92 unregister_code(KC_TAB);
93 }
94 return false; // Skip all further processing of this key
95 case KC_FLXP:
96 if (record->event.pressed) {
97 register_code(KC_LWIN);
98 register_code(KC_E);
99 } else {
100 unregister_code(KC_LWIN);
101 unregister_code(KC_E);
102 }
103 return false; // Skip all further processing of this key
104 default:
105 return true; // Process all other keycodes normally
106 }
107}
diff --git a/keyboards/keychron/q1/rev_0101/config.h b/keyboards/keychron/q1/rev_0101/config.h
new file mode 100644
index 000000000..c127a3630
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/config.h
@@ -0,0 +1,37 @@
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 0x0101
21#define DEVICE_VER 0x0100
22
23/* key matrix pins */
24#define MATRIX_ROW_PINS { D3, D2, B3, B2, B1, B0 }
25#define MATRIX_COL_PINS { D5, D4, D6, D7, B4, B5, B6, C6, C7, F7, F6, F5, F4, F1, F0 }
26
27/* RGB Matrix Configuration */
28#define DRIVER_1_LED_TOTAL 59
29#define DRIVER_2_LED_TOTAL 23
30#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
31
32/* Encoder used pins */
33#define ENCODERS_PAD_A { E6 }
34#define ENCODERS_PAD_B { B7 }
35
36/* Specifies the number of pulses the encoder registers between each detent */
37#define ENCODER_RESOLUTION 4
diff --git a/keyboards/keychron/q1/rev_0101/keymaps/default/info.json b/keyboards/keychron/q1/rev_0101/keymaps/default/info.json
new file mode 100644
index 000000000..56bf48acc
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/keymaps/default/info.json
@@ -0,0 +1,97 @@
1{
2 "keyboard_name": "Keychron Q1",
3 "url": "https://github.com/Keychron",
4 "maintainer": "lalalademaxiya1",
5 "layouts": {
6 "LAYOUT_ansi_82": {
7 "layout": [
8 {"label":"Esc", "x":0, "y":0},
9 {"label":"F1", "x":1.25, "y":0},
10 {"label":"F2", "x":2.25, "y":0},
11 {"label":"F3", "x":3.25, "y":0},
12 {"label":"F4", "x":4.25, "y":0},
13 {"label":"F5", "x":5.5, "y":0},
14 {"label":"F6", "x":6.5, "y":0},
15 {"label":"F7", "x":7.5, "y":0},
16 {"label":"F8", "x":8.5, "y":0},
17 {"label":"F9", "x":9.75, "y":0},
18 {"label":"F10", "x":10.75, "y":0},
19 {"label":"F11", "x":11.75, "y":0},
20 {"label":"F12", "x":12.75, "y":0},
21 {"label":"Delete", "x":14, "y":0},
22 {"label":"Mute", "x":15.25, "y":0},
23
24 {"label":"~", "x":0, "y":1.25},
25 {"label":"!", "x":1, "y":1.25},
26 {"label":"@", "x":2, "y":1.25},
27 {"label":"#", "x":3, "y":1.25},
28 {"label":"$", "x":4, "y":1.25},
29 {"label":"%", "x":5, "y":1.25},
30 {"label":"^", "x":6, "y":1.25},
31 {"label":"&", "x":7, "y":1.25},
32 {"label":"*", "x":8, "y":1.25},
33 {"label":"(", "x":9, "y":1.25},
34 {"label":")", "x":10, "y":1.25},
35 {"label":"_", "x":11, "y":1.25},
36 {"label":"+", "x":12, "y":1.25},
37 {"label":"Backspace", "x":13, "y":1.25, "w":2},
38 {"label":"Page Up", "x":15.25, "y":1.25},
39
40 {"label":"Tab", "x":0, "y":2.25, "w":1.5},
41 {"label":"Q", "x":1.5, "y":2.25},
42 {"label":"W", "x":2.5, "y":2.25},
43 {"label":"E", "x":3.5, "y":2.25},
44 {"label":"R", "x":4.5, "y":2.25},
45 {"label":"T", "x":5.5, "y":2.25},
46 {"label":"Y", "x":6.5, "y":2.25},
47 {"label":"U", "x":7.5, "y":2.25},
48 {"label":"I", "x":8.5, "y":2.25},
49 {"label":"O", "x":9.5, "y":2.25},
50 {"label":"P", "x":10.5, "y":2.25},
51 {"label":"{", "x":11.5, "y":2.25},
52 {"label":"}", "x":12.5, "y":2.25},
53 {"label":"|", "x":13.5, "y":2.25, "w":1.5},
54 {"label":"Page Down", "x":15.25, "y":2.25},
55
56 {"label":"Caps Lock", "x":0, "y":3.25, "w":1.75},
57 {"label":"A", "x":1.75, "y":3.25},
58 {"label":"S", "x":2.75, "y":3.25},
59 {"label":"D", "x":3.75, "y":3.25},
60 {"label":"F", "x":4.75, "y":3.25},
61 {"label":"G", "x":5.75, "y":3.25},
62 {"label":"H", "x":6.75, "y":3.25},
63 {"label":"J", "x":7.75, "y":3.25},
64 {"label":"K", "x":8.75, "y":3.25},
65 {"label":"L", "x":9.75, "y":3.25},
66 {"label":":", "x":10.75, "y":3.25},
67 {"label":"\"", "x":11.75, "y":3.25},
68 {"label":"Enter", "x":12.75, "y":3.25, "w":2.25},
69 {"label":"Home", "x":15.25, "y":3.25},
70
71 {"label":"Shift", "x":0, "y":4.25, "w":2.25},
72 {"label":"Z", "x":2.25, "y":4.25},
73 {"label":"X", "x":3.25, "y":4.25},
74 {"label":"C", "x":4.25, "y":4.25},
75 {"label":"V", "x":5.25, "y":4.25},
76 {"label":"B", "x":6.25, "y":4.25},
77 {"label":"N", "x":7.25, "y":4.25},
78 {"label":"M", "x":8.25, "y":4.25},
79 {"label":"<", "x":9.25, "y":4.25},
80 {"label":">", "x":10.25, "y":4.25},
81 {"label":"?", "x":11.25, "y":4.25},
82 {"label":"Shift", "x":12.25, "y":4.25, "w":1.75},
83 {"label":"Up", "x":14.25, "y":4.5},
84
85 {"label":"Ctrl", "x":0, "y":5.25, "w":1.25},
86 {"label":"Win", "x":1.25, "y":5.25, "w":1.25},
87 {"label":"Alt", "x":2.5, "y":5.25, "w":1.25},
88 {"label":"Space", "x":3.75, "y":5.25, "w":6.25},
89 {"label":"Alt", "x":10, "y":5.25},
90 {"label":"Fn", "x":11, "y":5.25},
91 {"label":"Ctrl", "x":12, "y":5.25},
92 {"label":"Left", "x":13.25, "y":5.5},
93 {"label":"Down", "x":14.25, "y":5.5},
94 {"label":"Right", "x":15.25, "y":5.5} ]
95 }
96 }
97} \ No newline at end of file
diff --git a/keyboards/keychron/q1/rev_0101/keymaps/default/keymap.c b/keyboards/keychron/q1/rev_0101/keymaps/default/keymap.c
new file mode 100644
index 000000000..92806bf9f
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/keymaps/default/keymap.c
@@ -0,0 +1,90 @@
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 MAC_FN,
22 WIN_BASE,
23 WIN_FN
24};
25
26enum custom_keycodes {
27 KC_MISSION_CONTROL = SAFE_RANGE,
28 KC_LAUNCHPAD
29};
30
31#define KC_TASK LGUI(KC_TAB)
32#define KC_FLXP LGUI(KC_E)
33#define KC_MCTL KC_MISSION_CONTROL
34#define KC_LPAD KC_LAUNCHPAD
35
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 [MAC_BASE] = LAYOUT_ansi_82(
38 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, KC_MUTE,
39 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,
40 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,
41 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,
42 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,
43 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
44
45 [MAC_FN] = LAYOUT_ansi_82(
46 KC_TRNS, 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,
47 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, KC_TRNS,
48 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, KC_TRNS,
49 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,
50 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,
51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
52
53 [WIN_BASE] = LAYOUT_ansi_82(
54 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, KC_MUTE,
55 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,
56 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,
57 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,
58 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,
59 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
60
61 [WIN_FN] = LAYOUT_ansi_82(
62 KC_TRNS, 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,
63 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, KC_TRNS,
64 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, KC_TRNS,
65 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,
66 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,
67 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
68};
69
70
71bool process_record_user(uint16_t keycode, keyrecord_t *record) {
72 switch (keycode) {
73 case KC_MISSION_CONTROL:
74 if (record->event.pressed) {
75 host_consumer_send(0x29F);
76 } else {
77 host_consumer_send(0);
78 }
79 return false; // Skip all further processing of this key
80 case KC_LAUNCHPAD:
81 if (record->event.pressed) {
82 host_consumer_send(0x2A0);
83 } else {
84 host_consumer_send(0);
85 }
86 return false; // Skip all further processing of this key
87 default:
88 return true; // Process all other keycodes normally
89 }
90}
diff --git a/keyboards/keychron/q1/rev_0101/keymaps/via/info.json b/keyboards/keychron/q1/rev_0101/keymaps/via/info.json
new file mode 100644
index 000000000..a921ee3e4
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/keymaps/via/info.json
@@ -0,0 +1,100 @@
1{
2 "keyboard_name": "Keychron Q1",
3 "url": "https://github.com/Keychron",
4 "maintainer": "lalalademaxiya1",
5 "layouts": {
6 "LAYOUT_all": {
7 "layout": [
8 {"label":"Esc", "x":0, "y":0},
9 {"label":"F1", "x":1.25, "y":0},
10 {"label":"F2", "x":2.25, "y":0},
11 {"label":"F3", "x":3.25, "y":0},
12 {"label":"F4", "x":4.25, "y":0},
13 {"label":"F5", "x":5.5, "y":0},
14 {"label":"F6", "x":6.5, "y":0},
15 {"label":"F7", "x":7.5, "y":0},
16 {"label":"F8", "x":8.5, "y":0},
17 {"label":"F9", "x":9.75, "y":0},
18 {"label":"F10", "x":10.75, "y":0},
19 {"label":"F11", "x":11.75, "y":0},
20 {"label":"F12", "x":12.75, "y":0},
21 {"label":"Delete", "x":14, "y":0},
22
23 {"label":"Mute", "x":15.25, "y":0, "w":0.75},
24 {"label":"Vol-", "x":16, "y":0, "w":0.75, "h":0.5},
25 {"label":"Vol+", "x":16, "y":0.5, "w":0.75, "h":0.5},
26
27 {"label":"~", "x":0, "y":1.25},
28 {"label":"!", "x":1, "y":1.25},
29 {"label":"@", "x":2, "y":1.25},
30 {"label":"#", "x":3, "y":1.25},
31 {"label":"$", "x":4, "y":1.25},
32 {"label":"%", "x":5, "y":1.25},
33 {"label":"^", "x":6, "y":1.25},
34 {"label":"&", "x":7, "y":1.25},
35 {"label":"*", "x":8, "y":1.25},
36 {"label":"(", "x":9, "y":1.25},
37 {"label":")", "x":10, "y":1.25},
38 {"label":"_", "x":11, "y":1},
39 {"label":"+", "x":12, "y":1.25},
40 {"label":"Backspace", "x":13, "y":1.25, "w":2},
41 {"label":"Page Up", "x":15.25, "y":1.25},
42
43 {"label":"Tab", "x":0, "y":2.25, "w":1.5},
44 {"label":"Q", "x":1.5, "y":2.25},
45 {"label":"W", "x":2.5, "y":2.25},
46 {"label":"E", "x":3.5, "y":2.25},
47 {"label":"R", "x":4.5, "y":2.25},
48 {"label":"T", "x":5.5, "y":2.25},
49 {"label":"Y", "x":6.5, "y":2.25},
50 {"label":"U", "x":7.5, "y":2.25},
51 {"label":"I", "x":8.5, "y":2.25},
52 {"label":"O", "x":9.5, "y":2.25},
53 {"label":"P", "x":10.5, "y":2.25},
54 {"label":"{", "x":11.5, "y":2.25},
55 {"label":"}", "x":12.5, "y":2.25},
56 {"label":"|", "x":13.5, "y":2.25, "w":1.5},
57 {"label":"Page Down", "x":15.25, "y":2.25},
58
59 {"label":"Caps Lock", "x":0, "y":3.25, "w":1.75},
60 {"label":"A", "x":1.75, "y":3.25},
61 {"label":"S", "x":2.75, "y":3.25},
62 {"label":"D", "x":3.75, "y":3.25},
63 {"label":"F", "x":4.75, "y":3.25},
64 {"label":"G", "x":5.75, "y":3.25},
65 {"label":"H", "x":6.75, "y":3.25},
66 {"label":"J", "x":7.75, "y":3.25},
67 {"label":"K", "x":8.75, "y":3.25},
68 {"label":"L", "x":9.75, "y":3.25},
69 {"label":":", "x":10.75, "y":3.25},
70 {"label":"\"", "x":11.75, "y":3.25},
71 {"label":"Enter", "x":12.75, "y":3.25, "w":2.25},
72 {"label":"Home", "x":15.25, "y":3.25},
73
74 {"label":"Shift", "x":0, "y":4.25, "w":2.25},
75 {"label":"Z", "x":2.25, "y":4.25},
76 {"label":"X", "x":3.25, "y":4.25},
77 {"label":"C", "x":4.25, "y":4.25},
78 {"label":"V", "x":5.25, "y":4.25},
79 {"label":"B", "x":6.25, "y":4.25},
80 {"label":"N", "x":7.25, "y":4.25},
81 {"label":"M", "x":8.25, "y":4.25},
82 {"label":"<", "x":9.25, "y":4.25},
83 {"label":">", "x":10.25, "y":4.25},
84 {"label":"?", "x":11.25, "y":4.25},
85 {"label":"Shift", "x":12.25, "y":4.25, "w":1.75},
86 {"label":"Up", "x":14.25, "y":4.5},
87
88 {"label":"Ctrl", "x":0, "y":5.25, "w":1.25},
89 {"label":"Win", "x":1.25, "y":5.25, "w":1.25},
90 {"label":"Alt", "x":2.5, "y":5.25, "w":1.25},
91 {"label":"Space", "x":3.75, "y":5.25, "w":6.25},
92 {"label":"Alt", "x":10, "y":5.25},
93 {"label":"Fn", "x":11, "y":5.25},
94 {"label":"Ctrl", "x":12, "y":5.25},
95 {"label":"Left", "x":13.25, "y":5.5},
96 {"label":"Down", "x":14.25, "y":5.5},
97 {"label":"Right", "x":15.25, "y":5.5} ]
98 }
99 }
100}
diff --git a/keyboards/keychron/q1/rev_0101/keymaps/via/keymap.c b/keyboards/keychron/q1/rev_0101/keymaps/via/keymap.c
new file mode 100644
index 000000000..1103f7442
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/keymaps/via/keymap.c
@@ -0,0 +1,131 @@
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 MAC_FN,
22 WIN_BASE,
23 WIN_FN
24};
25
26enum custom_keycodes {
27 KC_MISSION_CONTROL = USER00,
28 KC_LAUNCHPAD
29};
30
31#define KC_MCTL KC_MISSION_CONTROL
32#define KC_LPAD KC_LAUNCHPAD
33#define KC_TASK G(KC_TAB)
34#define KC_FLXP G(KC_E)
35
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 [MAC_BASE] = LAYOUT_all(
38 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, KC_MUTE,
39 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,
40 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,
41 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,
42 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,
43 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_VOLD, KC_VOLU, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
44
45 [MAC_FN] = LAYOUT_all(
46 KC_TRNS, 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,
47 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, KC_TRNS,
48 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, KC_TRNS,
49 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,
50 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,
51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
52
53 [WIN_BASE] = LAYOUT_all(
54 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, KC_MUTE,
55 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,
56 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,
57 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,
58 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,
59 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_VOLD, KC_VOLU, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
60
61 [WIN_FN] = LAYOUT_all(
62 KC_TRNS, 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,
63 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, KC_TRNS,
64 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, KC_TRNS,
65 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,
66 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,
67 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
68};
69
70#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
71
72#define ENCODERS 1
73static uint8_t encoder_state[ENCODERS] = {0};
74static keypos_t encoder_cw[ENCODERS] = {{ 8, 5 }};
75static keypos_t encoder_ccw[ENCODERS] = {{ 7, 5 }};
76
77void encoder_action_unregister(void) {
78 for (int index = 0; index < ENCODERS; ++index) {
79 if (encoder_state[index]) {
80 keyevent_t encoder_event = (keyevent_t) {
81 .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
82 .pressed = false,
83 .time = (timer_read() | 1)
84 };
85 encoder_state[index] = 0;
86 action_exec(encoder_event);
87 }
88 }
89}
90
91void encoder_action_register(uint8_t index, bool clockwise) {
92 keyevent_t encoder_event = (keyevent_t) {
93 .key = clockwise ? encoder_cw[index] : encoder_ccw[index],
94 .pressed = true,
95 .time = (timer_read() | 1)
96 };
97 encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
98 action_exec(encoder_event);
99}
100
101void matrix_scan_user(void) {
102 encoder_action_unregister();
103}
104
105bool encoder_update_user(uint8_t index, bool clockwise) {
106 encoder_action_register(index, clockwise);
107 return false;
108};
109
110#endif
111
112bool process_record_user(uint16_t keycode, keyrecord_t *record) {
113 switch (keycode) {
114 case KC_MISSION_CONTROL:
115 if (record->event.pressed) {
116 host_consumer_send(0x29F);
117 } else {
118 host_consumer_send(0);
119 }
120 return false; // Skip all further processing of this key
121 case KC_LAUNCHPAD:
122 if (record->event.pressed) {
123 host_consumer_send(0x2A0);
124 } else {
125 host_consumer_send(0);
126 }
127 return false; // Skip all further processing of this key
128 default:
129 return true; // Process all other keycodes normally
130 }
131}
diff --git a/keyboards/keychron/q1/rev_0101/keymaps/via/rules.mk b/keyboards/keychron/q1/rev_0101/keymaps/via/rules.mk
new file mode 100644
index 000000000..bee21da52
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/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/q1/rev_0101/readme.md b/keyboards/keychron/q1/rev_0101/readme.md
new file mode 100644
index 000000000..d7693349b
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/readme.md
@@ -0,0 +1,4 @@
1# The ANSI variant of the Keychron Q1
2- Enable EC11 rotary encoder
3- Turn colckwise to increase volume and turn anti-colckwise to decrease volume
4- Press top right key pushbutton to mute \ No newline at end of file
diff --git a/keyboards/keychron/q1/rev_0101/rev_0101.c b/keyboards/keychron/q1/rev_0101/rev_0101.c
new file mode 100644
index 000000000..dd7f69529
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/rev_0101.c
@@ -0,0 +1,156 @@
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 RGB_MATRIX_ENABLE
20const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
21/* Refer to IS31 manual for these locations
22 * driver
23 * | R location
24 * | | G location
25 * | | | B location
26 * | | | | */
27 {0, C_1, A_1, B_1},
28 {0, C_3, A_3, B_3},
29 {0, C_4, A_4, B_4},
30 {0, C_5, A_5, B_5},
31 {0, C_6, A_6, B_6},
32 {0, C_7, A_7, B_7},
33 {0, C_8, A_8, B_8},
34 {0, C_9, A_9, B_9},
35 {0, C_10, A_10, B_10},
36 {0, C_11, A_11, B_11},
37 {0, C_12, A_12, B_12},
38 {0, C_13, A_13, B_13},
39 {0, C_14, A_14, B_14},
40 {0, C_15, A_15, B_15},
41 {0, C_16, A_16, B_16},
42
43 {0, F_1, D_1, E_1},
44 {0, F_2, D_2, E_2},
45 {0, F_3, D_3, E_3},
46 {0, F_4, D_4, E_4},
47 {0, F_5, D_5, E_5},
48 {0, F_6, D_6, E_6},
49 {0, F_7, D_7, E_7},
50 {0, F_8, D_8, E_8},
51 {0, F_9, D_9, E_9},
52 {0, F_10, D_10, E_10},
53 {0, F_11, D_11, E_11},
54 {0, F_12, D_12, E_12},
55 {0, F_13, D_13, E_13},
56 {0, F_14, D_14, E_14},
57 {0, F_16, D_16, E_16},
58
59 {0, I_1, G_1, H_1},
60 {0, I_2, G_2, H_2},
61 {0, I_3, G_3, H_3},
62 {0, I_4, G_4, H_4},
63 {0, I_5, G_5, H_5},
64 {0, I_6, G_6, H_6},
65 {0, I_7, G_7, H_7},
66 {0, I_8, G_8, H_8},
67 {0, I_9, G_9, H_9},
68 {0, I_10, G_10, H_10},
69 {0, I_11, G_11, H_11},
70 {0, I_12, G_12, H_12},
71 {0, I_13, G_13, H_13},
72 {0, I_14, G_14, H_14},
73 {0, I_16, G_16, H_16},
74
75 {0, L_1, J_1, K_1},
76 {0, L_2, J_2, K_2},
77 {0, L_3, J_3, K_3},
78 {0, L_4, J_4, K_4},
79 {0, L_5, J_5, K_5},
80 {0, L_6, J_6, K_6},
81 {0, L_7, J_7, K_7},
82 {0, L_8, J_8, K_8},
83 {0, L_9, J_9, K_9},
84 {0, L_10, J_10, K_10},
85 {0, L_11, J_11, K_11},
86 {0, L_12, J_12, K_12},
87 {0, L_14, J_14, K_14},
88 {0, L_16, J_16, K_16},
89
90 {1, C_1, A_1, B_1},
91 {1, C_3, A_3, B_3},
92 {1, C_4, A_4, B_4},
93 {1, C_5, A_5, B_5},
94 {1, C_6, A_6, B_6},
95 {1, C_7, A_7, B_7},
96 {1, C_8, A_8, B_8},
97 {1, C_9, A_9, B_9},
98 {1, C_10, A_10, B_10},
99 {1, C_11, A_11, B_11},
100 {1, C_12, A_12, B_12},
101 {1, C_14, A_14, B_14},
102 {1, C_15, A_15, B_15},
103
104 {1, F_1, D_1, E_1},
105 {1, F_2, D_2, E_2},
106 {1, F_3, D_3, E_3},
107 {1, F_7, D_7, E_7},
108 {1, F_11, D_11, E_11},
109 {1, F_12, D_12, E_12},
110 {1, F_13, D_13, E_13},
111 {1, F_14, D_14, E_14},
112 {1, F_15, D_15, E_15},
113 {1, F_16, D_16, E_16}
114};
115
116led_config_t g_led_config = {
117 {
118 { 0, NO_LED, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 },
119 { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 },
120 { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 },
121 { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 },
122 { 59, NO_LED, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 },
123 { 72, 73, 74, NO_LED, NO_LED, NO_LED, 75, NO_LED, NO_LED, NO_LED, 76, 77, 78, 79, 81 }
124 },
125 {
126 {0, 0}, {30, 0}, {45, 0}, {60, 0}, {75, 0}, {90, 0}, {105, 0}, {120, 0}, {135, 0}, {150, 0}, {165, 0}, {180, 0}, {195, 0}, {210, 0}, {224, 0},
127 {0,13}, {15,13}, {30,13}, {45,13}, {60,13}, {75,13}, {90,13}, {105,13}, {120,13}, {135,13}, {150,13}, {165,13}, {180,13}, {195,13}, {224,13},
128 {0,26}, {15,26}, {30,26}, {45,26}, {60,26}, {75,26}, {90,26}, {105,26}, {120,26}, {135,26}, {150,26}, {165,26}, {180,26}, {195,26}, {224,26},
129 {0,39}, {15,39}, {30,39}, {45,39}, {60,39}, {75,39}, {90,39}, {105,39}, {120,39}, {135,39}, {150,39}, {165,39}, {195,39}, {224,39},
130 {0,52}, {30,52}, {45,52}, {60,52}, {75,52}, {90,52}, {105,52}, {120,52}, {135,52}, {150,52}, {165,52}, {195,52}, {210,52},
131 {0,64}, {15,64}, {30,64}, {90,64}, {150,64}, {165,64}, {180,64}, {195,64}, {210,64}, {224,64}
132 },
133 {
134 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
135 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
136 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
137 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
138 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
139 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
140 }
141};
142#endif
143
144#ifdef ENCODER_ENABLE
145bool encoder_update_kb(uint8_t index, bool clockwise) {
146 if (!encoder_update_user(index, clockwise)) { return false; }
147 if (index == 0) {
148 if (clockwise) {
149 tap_code(KC_VOLU);
150 } else {
151 tap_code(KC_VOLD);
152 }
153 }
154 return true;
155}
156#endif
diff --git a/keyboards/keychron/q1/rev_0101/rev_0101.h b/keyboards/keychron/q1/rev_0101/rev_0101.h
new file mode 100644
index 000000000..132003c4f
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/rev_0101.h
@@ -0,0 +1,52 @@
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, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
25 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
26 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
27 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
28 K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K3C, \
29 K50, K51, K52, K56, K57, K58, K5A, K5B, K5C, K5D, K4C, K5E \
30 ) { \
31 { K00, xxx, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
32 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
33 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
34 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
35 { K40, xxx, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E }, \
36 { K50, K51, K52, xxx, xxx, xxx, K56, K57, K58, xxx, K5A, K5B, K5C, K5D, K5E } \
37 }
38#define LAYOUT_ansi_82( \
39 K00, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
40 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
41 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
42 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
43 K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K3C, \
44 K50, K51, K52, K56, K5A, K5B, K5C, K5D, K4C, K5E \
45 ) { \
46 { K00, xxx, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
47 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
48 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
49 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
50 { K40, xxx, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E }, \
51 { K50, K51, K52, xxx, xxx, xxx, K56, xxx, xxx, xxx, K5A, K5B, K5C, K5D, K5E } \
52 }
diff --git a/keyboards/keychron/q1/rev_0101/rules.mk b/keyboards/keychron/q1/rev_0101/rules.mk
new file mode 100644
index 000000000..8d2be4eb5
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0101/rules.mk
@@ -0,0 +1,22 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = atmel-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
11MOUSEKEY_ENABLE = no # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15NKRO_ENABLE = yes # Enable N-Key Rollover
16BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
17RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
18AUDIO_ENABLE = no # Audio output
19ENCODER_ENABLE = yes # Enable Encoder
20DIP_SWITCH_ENABLE = yes
21RGB_MATRIX_ENABLE = yes
22RGB_MATRIX_DRIVER = IS31FL3733 \ No newline at end of file
diff --git a/keyboards/keychron/q1/rev_0102/keymaps/default/keymap.c b/keyboards/keychron/q1/rev_0102/keymaps/default/keymap.c
index b4a7d6442..3d0a9e5c6 100644
--- a/keyboards/keychron/q1/rev_0102/keymaps/default/keymap.c
+++ b/keyboards/keychron/q1/rev_0102/keymaps/default/keymap.c
@@ -16,7 +16,6 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19
20enum layers{ 19enum layers{
21 MAC_BASE, 20 MAC_BASE,
22 MAC_FN, 21 MAC_FN,
@@ -24,41 +23,67 @@ enum layers{
24 WIN_FN 23 WIN_FN
25}; 24};
26 25
26enum custom_keycodes {
27 KC_MISSION_CONTROL = SAFE_RANGE,
28 KC_LAUNCHPAD
29};
30
27#define KC_TASK LGUI(KC_TAB) 31#define KC_TASK LGUI(KC_TAB)
28#define KC_FLXP LGUI(KC_E) 32#define KC_FLXP LGUI(KC_E)
33#define KC_MCTL KC_MISSION_CONTROL
34#define KC_LPAD KC_LAUNCHPAD
29 35
30const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 [MAC_BASE] = LAYOUT_iso_83(
38 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, KC_INS,
39 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,
40 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,
41 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,
42 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,
43 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
31 44
32[MAC_BASE] = LAYOUT_iso_83( 45 [MAC_FN] = LAYOUT_iso_83(
33 KC_ESC, KC_BRID, KC_BRIU, KC_F3, KC_F4, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, 46 KC_TRNS, 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,
34 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_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, KC_TRNS,
35 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 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,
36 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_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,
37 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_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,
38 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
39
40[MAC_FN] = LAYOUT_iso_83(
41 KC_TRNS, 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,
42 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, KC_TRNS,
43 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,
44 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,
45 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,
46 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
47 52
48[WIN_BASE] = LAYOUT_iso_83( 53 [WIN_BASE] = LAYOUT_iso_83(
49 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, KC_INS, 54 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, KC_INS,
50 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, 55 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,
51 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, 56 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,
52 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, 57 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,
53 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, 58 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,
54 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 59 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
55 60
56[WIN_FN] = LAYOUT_iso_83( 61 [WIN_FN] = LAYOUT_iso_83(
57 KC_TRNS, 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 KC_TRNS, 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,
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, KC_TRNS, KC_TRNS, KC_TRNS, 63 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, KC_TRNS,
59 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, 64 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,
60 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, 65 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,
61 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, 66 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,
62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) 67 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
68 };
63 69
64}; \ No newline at end of file 70bool process_record_user(uint16_t keycode, keyrecord_t *record) {
71 switch (keycode) {
72 case KC_MISSION_CONTROL:
73 if (record->event.pressed) {
74 host_consumer_send(0x29F);
75 } else {
76 host_consumer_send(0);
77 }
78 return false; // Skip all further processing of this key
79 case KC_LAUNCHPAD:
80 if (record->event.pressed) {
81 host_consumer_send(0x2A0);
82 } else {
83 host_consumer_send(0);
84 }
85 return false; // Skip all further processing of this key
86 default:
87 return true; // Process all other keycodes normally
88 }
89}
diff --git a/keyboards/keychron/q1/rev_0102/keymaps/via/keymap.c b/keyboards/keychron/q1/rev_0102/keymaps/via/keymap.c
index b4a7d6442..d1652e65d 100644
--- a/keyboards/keychron/q1/rev_0102/keymaps/via/keymap.c
+++ b/keyboards/keychron/q1/rev_0102/keymaps/via/keymap.c
@@ -16,7 +16,6 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19
20enum layers{ 19enum layers{
21 MAC_BASE, 20 MAC_BASE,
22 MAC_FN, 21 MAC_FN,
@@ -24,41 +23,85 @@ enum layers{
24 WIN_FN 23 WIN_FN
25}; 24};
26 25
27#define KC_TASK LGUI(KC_TAB) 26enum custom_keycodes {
28#define KC_FLXP LGUI(KC_E) 27 KC_MISSION_CONTROL = USER00,
28 KC_LAUNCHPAD,
29 KC_TASK,
30 KC_FLXP
31};
29 32
30const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 33#define KC_MCTL KC_MISSION_CONTROL
34#define KC_LPAD KC_LAUNCHPAD
31 35
32[MAC_BASE] = LAYOUT_iso_83( 36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
33 KC_ESC, KC_BRID, KC_BRIU, KC_F3, KC_F4, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, 37 [MAC_BASE] = LAYOUT_iso_83(
34 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, 38 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, KC_INS,
35 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, 39 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,
36 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, 40 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,
37 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, 41 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,
38 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 42 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,
43 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
39 44
40[MAC_FN] = LAYOUT_iso_83( 45 [MAC_FN] = LAYOUT_iso_83(
41 KC_TRNS, 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, 46 KC_TRNS, 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,
42 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, KC_TRNS, 47 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, KC_TRNS,
43 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, 48 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,
44 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, 49 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,
45 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, 50 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,
46 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
47 52
48[WIN_BASE] = LAYOUT_iso_83( 53 [WIN_BASE] = LAYOUT_iso_83(
49 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, KC_INS, 54 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, KC_INS,
50 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, 55 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,
51 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, 56 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,
52 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, 57 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,
53 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, 58 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,
54 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 59 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
55 60
56[WIN_FN] = LAYOUT_iso_83( 61 [WIN_FN] = LAYOUT_iso_83(
57 KC_TRNS, 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 KC_TRNS, 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,
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, KC_TRNS, KC_TRNS, KC_TRNS, 63 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, KC_TRNS,
59 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, 64 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,
60 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, 65 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,
61 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, 66 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,
62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) 67 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
68};
63 69
64}; \ No newline at end of file 70bool process_record_user(uint16_t keycode, keyrecord_t *record) {
71 switch (keycode) {
72 case KC_MISSION_CONTROL:
73 if (record->event.pressed) {
74 host_consumer_send(0x29F);
75 } else {
76 host_consumer_send(0);
77 }
78 return false; // Skip all further processing of this key
79 case KC_LAUNCHPAD:
80 if (record->event.pressed) {
81 host_consumer_send(0x2A0);
82 } else {
83 host_consumer_send(0);
84 }
85 return false; // Skip all further processing of this key
86 case KC_TASK:
87 if (record->event.pressed) {
88 register_code(KC_LWIN);
89 register_code(KC_TAB);
90 } else {
91 unregister_code(KC_LWIN);
92 unregister_code(KC_TAB);
93 }
94 return false; // Skip all further processing of this key
95 case KC_FLXP:
96 if (record->event.pressed) {
97 register_code(KC_LWIN);
98 register_code(KC_E);
99 } else {
100 unregister_code(KC_LWIN);
101 unregister_code(KC_E);
102 }
103 return false; // Skip all further processing of this key
104 default:
105 return true; // Process all other keycodes normally
106 }
107}
diff --git a/keyboards/keychron/q1/rev_0102/rev_0102.c b/keyboards/keychron/q1/rev_0102/rev_0102.c
index e8a2c85ae..f1468d109 100644
--- a/keyboards/keychron/q1/rev_0102/rev_0102.c
+++ b/keyboards/keychron/q1/rev_0102/rev_0102.c
@@ -16,7 +16,7 @@
16 16
17#include "quantum.h" 17#include "quantum.h"
18 18
19 19#ifdef RGB_MATRIX_ENABLE
20const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { 20const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
21/* Refer to IS31 manual for these locations 21/* Refer to IS31 manual for these locations
22 * driver 22 * driver
@@ -141,3 +141,4 @@ led_config_t g_led_config = {
141 141
142 } 142 }
143}; 143};
144#endif
diff --git a/keyboards/keychron/q2/chconf.h b/keyboards/keychron/q2/chconf.h
new file mode 100644
index 000000000..a331fdef3
--- /dev/null
+++ b/keyboards/keychron/q2/chconf.h
@@ -0,0 +1,30 @@
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/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/acheron/arctic/chconf.h -r platforms/chibios/common/configs/chconf.h`
20 */
21
22#pragma once
23
24#define CH_CFG_ST_FREQUENCY 10000
25
26#define CH_CFG_OPTIMIZE_SPEED FALSE
27
28#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
29
30#include_next <chconf.h> \ No newline at end of file
diff --git a/keyboards/keychron/q2/config.h b/keyboards/keychron/q2/config.h
new file mode 100644
index 000000000..263be4684
--- /dev/null
+++ b/keyboards/keychron/q2/config.h
@@ -0,0 +1,54 @@
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 VENDOR_ID 0x3434
21#define MANUFACTURER Keychron
22#define PRODUCT Keychron Q2
23
24/* key matrix size */
25#define MATRIX_ROWS 5
26#define MATRIX_COLS 15
27
28/* key matrix pins */
29#define MATRIX_ROW_PINS { B4, B3, A15, A14, A13 }
30#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, A6, A7, B0, B1, A8, A9, H3 }
31
32/* DIP switch */
33#define DIP_SWITCH_MATRIX_GRID { {4, 4} }
34
35/* COL2ROW or ROW2COL */
36#define DIODE_DIRECTION ROW2COL
37
38/* Set 0 if debouncing isn't needed */
39#define DEBOUNCE 5
40
41/* Disable DIP switch in matrix data */
42#define MATRIX_MASKED
43
44/* NKRO */
45#define FORCE_NKRO
46
47/* turn off effects when suspended */
48#define RGB_DISABLE_WHEN_USB_SUSPENDED
49
50/* Use 5 dynamic keymap layers */
51#define DYNAMIC_KEYMAP_LAYER_COUNT 5
52
53/* EEPROM Driver Configuration */
54#define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100010
diff --git a/keyboards/keychron/q2/halconf.h b/keyboards/keychron/q2/halconf.h
new file mode 100644
index 000000000..a9304b859
--- /dev/null
+++ b/keyboards/keychron/q2/halconf.h
@@ -0,0 +1,26 @@
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/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/nk65/halconf.h -r platforms/chibios/QMK_PROTON_C/configs/halconf.h`
20 */
21
22#pragma once
23
24#define HAL_USE_I2C TRUE
25
26#include_next <halconf.h> \ No newline at end of file
diff --git a/keyboards/keychron/q2/matrix.c b/keyboards/keychron/q2/matrix.c
new file mode 100644
index 000000000..1e493d33e
--- /dev/null
+++ b/keyboards/keychron/q2/matrix.c
@@ -0,0 +1,139 @@
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 <stdint.h>
18#include <stdbool.h>
19#include <string.h>
20#include "util.h"
21#include "matrix.h"
22#include "debounce.h"
23#include "quantum.h"
24
25#ifdef MATRIX_ROW_PINS
26static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
27#endif // MATRIX_ROW_PINS
28#ifdef MATRIX_COL_PINS
29static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
30#endif // MATRIX_COL_PINS
31
32#define ROWS_PER_HAND (MATRIX_ROWS)
33
34/* matrix state(1:on, 0:off) */
35extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
36extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values
37
38static inline void setPinOutput_writeLow(pin_t pin) {
39 ATOMIC_BLOCK_FORCEON {
40 setPinOutput(pin);
41 writePinLow(pin);
42 }
43}
44
45static inline void setPinOutput_writeHigh(pin_t pin) {
46 ATOMIC_BLOCK_FORCEON {
47 setPinOutput(pin);
48 writePinHigh(pin);
49 }
50}
51
52static inline void setPinInputHigh_atomic(pin_t pin) {
53 ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
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 bool select_col(uint8_t col) {
65 pin_t pin = col_pins[col];
66 if (pin != NO_PIN) {
67 setPinOutput_writeLow(pin);
68 return true;
69 }
70 return false;
71}
72
73static void unselect_col(uint8_t col) {
74 pin_t pin = col_pins[col];
75 if (pin != NO_PIN) {
76 setPinOutput_writeHigh(pin);
77 }
78}
79
80static void unselect_cols(void) {
81 for (uint8_t x = 0; x < MATRIX_COLS; x++) {
82 unselect_col(x);
83 }
84}
85
86void matrix_init_pins(void) {
87 unselect_cols();
88 for (uint8_t x = 0; x < ROWS_PER_HAND; x++) {
89 if (row_pins[x] != NO_PIN) {
90 setPinInputHigh_atomic(row_pins[x]);
91 }
92 }
93}
94
95void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
96 bool key_pressed = false;
97
98 // Select col
99 if (!select_col(current_col)) { // select col
100 return; // skip NO_PIN col
101 }
102 matrix_output_select_delay();
103
104 // For each row...
105 for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) {
106 // Check row pin state
107 if (readMatrixPin(row_pins[row_index]) == 0) {
108 // Pin LO, set col bit
109 current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
110 key_pressed = true;
111 } else {
112 // Pin HI, clear col bit
113 current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << current_col);
114 }
115 }
116
117 // Unselect col
118 unselect_col(current_col);
119 matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH
120}
121
122void matrix_init_custom(void) {
123 // initialize key pins
124 matrix_init_pins();
125}
126
127bool matrix_scan_custom(matrix_row_t current_matrix[]) {
128 matrix_row_t curr_matrix[MATRIX_ROWS] = {0};
129
130 // Set col, read rows
131 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
132 matrix_read_rows_on_col(curr_matrix, current_col);
133 }
134
135 bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0;
136 if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix));
137
138 return (uint8_t)changed;
139}
diff --git a/keyboards/keychron/q2/mcuconf.h b/keyboards/keychron/q2/mcuconf.h
new file mode 100644
index 000000000..6ab916aea
--- /dev/null
+++ b/keyboards/keychron/q2/mcuconf.h
@@ -0,0 +1,27 @@
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/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/acheron/arctic/mcuconf.h -r platforms/chibios/GENERIC_STM32_F072XB/configs/mcuconf.h`
20 */
21
22#pragma once
23
24#include_next <mcuconf.h>
25
26#undef STM32_I2C_USE_I2C1
27#define STM32_I2C_USE_I2C1 TRUE \ No newline at end of file
diff --git a/keyboards/keychron/q2/q2.c b/keyboards/keychron/q2/q2.c
new file mode 100644
index 000000000..03d1ee7db
--- /dev/null
+++ b/keyboards/keychron/q2/q2.c
@@ -0,0 +1,33 @@
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 "q2.h"
18
19const matrix_row_t matrix_mask[] = {
20 0b1111111111111111,
21 0b1111111111111111,
22 0b1111111111111111,
23 0b1111111111111111,
24 0b1111111111101111,
25};
26
27bool dip_switch_update_kb(uint8_t index, bool active) {
28 if (!dip_switch_update_user(index, active)) { return false;}
29 if (index == 0) {
30 default_layer_set(1UL << (active ? 1 : 0));
31 }
32 return true;
33}
diff --git a/keyboards/keychron/q2/q2.h b/keyboards/keychron/q2/q2.h
new file mode 100644
index 000000000..22bd1afe8
--- /dev/null
+++ b/keyboards/keychron/q2/q2.h
@@ -0,0 +1,29 @@
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#if defined(KEYBOARD_keychron_q2_rev_0110)
22# include "rev_0110.h"
23#elif defined(KEYBOARD_keychron_q2_rev_0111)
24# include "rev_0111.h"
25#elif defined(KEYBOARD_keychron_q2_rev_0112)
26# include "rev_0112.h"
27#elif defined(KEYBOARD_keychron_q2_rev_0113)
28# include "rev_0113.h"
29#endif
diff --git a/keyboards/keychron/q2/readme.md b/keyboards/keychron/q2/readme.md
new file mode 100644
index 000000000..bdceb98d4
--- /dev/null
+++ b/keyboards/keychron/q2/readme.md
@@ -0,0 +1,19 @@
1# Keychron Q2
2
3A customizable 65% keyboard.
4
5* Keyboard Maintainer: [Keychron](https://github.com/keychron)
6* Hardware Supported: Keychron Q2
7* Hardware Availability: [Keychron](https://www.keychron.com)
8
9Make example for this keyboard (after setting up your build environment):
10
11 make keychron/q2/rev_0110:default
12
13Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid))
14
15 make keychron/q2/rev_0110: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).
diff --git a/keyboards/keychron/q2/rev_0110/config.h b/keyboards/keychron/q2/rev_0110/config.h
new file mode 100644
index 000000000..d9fc5c174
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/config.h
@@ -0,0 +1,21 @@
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 0x0110
21#define DEVICE_VER 0x0100
diff --git a/keyboards/keychron/q2/rev_0110/info.json b/keyboards/keychron/q2/rev_0110/info.json
new file mode 100644
index 000000000..caf3ebf7c
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/info.json
@@ -0,0 +1,82 @@
1{
2 "keyboard_name": "Keychron Q2",
3 "url": "https://github.com/Keychron",
4 "maintainer": "lalalademaxiya1",
5 "layouts": {
6 "LAYOUT_ansi_67": {
7 "layout": [
8 {"label":"Insert", "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":"|", "x":13.5, "y":1.25, "w":1.5},
39 {"label":"Delete", "x":15.25, "y":1.25},
40
41 {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
42 {"label":"A", "x":1.75, "y":2.25},
43 {"label":"S", "x":2.75, "y":2.25},
44 {"label":"D", "x":3.75, "y":2.25},
45 {"label":"F", "x":4.75, "y":2.25},
46 {"label":"G", "x":5.75, "y":2.25},
47 {"label":"H", "x":6.75, "y":2.25},
48 {"label":"J", "x":7.75, "y":2.25},
49 {"label":"K", "x":8.75, "y":2.25},
50 {"label":"L", "x":9.75, "y":2.25},
51 {"label":":", "x":10.75, "y":2.25},
52 {"label":"\"", "x":11.75, "y":2.25},
53 {"label":"Enter", "x":12.75, "y":2.25, "w":2.25},
54 {"label":"Home", "x":15.25, "y":2.25},
55
56 {"label":"Shift", "x":0, "y":3.25, "w":2.25},
57 {"label":"Z", "x":2.25, "y":3.25},
58 {"label":"X", "x":3.25, "y":3.25},
59 {"label":"C", "x":4.25, "y":3.25},
60 {"label":"V", "x":5.25, "y":3.25},
61 {"label":"B", "x":6.25, "y":3.25},
62 {"label":"N", "x":7.25, "y":3.25},
63 {"label":"M", "x":8.25, "y":3.25},
64 {"label":"<", "x":9.25, "y":3.25},
65 {"label":">", "x":10.25, "y":3.25},
66 {"label":"?", "x":11.25, "y":3.25},
67 {"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
68 {"label":"Up", "x":14.25, "y":3.5},
69
70 {"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
71 {"label":"Win", "x":1.25, "y":4.25, "w":1.25},
72 {"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
73 {"label":"Space", "x":3.75, "y":4.25, "w":6.25},
74 {"label":"Alt", "x":10, "y":4.25},
75 {"label":"Fn1", "x":11, "y":4.25},
76 {"label":"Fn2", "x":12, "y":4.25},
77 {"label":"Left", "x":13.25, "y":4.5},
78 {"label":"Down", "x":14.25, "y":4.5},
79 {"label":"Right", "x":15.25, "y":4.5} ]
80 }
81 }
82}
diff --git a/keyboards/keychron/q2/rev_0110/keymaps/default/keymap.c b/keyboards/keychron/q2/rev_0110/keymaps/default/keymap.c
new file mode 100644
index 000000000..429157eef
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/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_ansi_67(
40 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
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_BSLS, 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_ENT, KC_HOME,
43 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,
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_ansi_67(
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_INS,
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_BSLS, 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_ENT, KC_HOME,
50 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,
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_ansi_67(
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, 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,
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,
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_ansi_67(
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, 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,
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,
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_ansi_67(
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, 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,
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,
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_0110/keymaps/via/keymap.c b/keyboards/keychron/q2/rev_0110/keymaps/via/keymap.c
new file mode 100644
index 000000000..b23c92e95
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/keymaps/via/keymap.c
@@ -0,0 +1,112 @@
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_ansi_67(
40 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
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_BSLS, 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_ENT, KC_HOME,
43 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,
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_ansi_67(
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_INS,
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_BSLS, 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_ENT, KC_HOME,
50 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,
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_ansi_67(
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, 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,
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,
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_ansi_67(
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, 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,
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,
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_ansi_67(
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, 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,
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,
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 case KC_TASK:
92 if (record->event.pressed) {
93 register_code(KC_LWIN);
94 register_code(KC_TAB);
95 } else {
96 unregister_code(KC_LWIN);
97 unregister_code(KC_TAB);
98 }
99 return false; // Skip all further processing of this key
100 case KC_FLXP:
101 if (record->event.pressed) {
102 register_code(KC_LWIN);
103 register_code(KC_E);
104 } else {
105 unregister_code(KC_LWIN);
106 unregister_code(KC_E);
107 }
108 return false; // Skip all further processing of this key
109 default:
110 return true; // Process all other keycodes normally
111 }
112}
diff --git a/keyboards/keychron/q2/rev_0110/keymaps/via/rules.mk b/keyboards/keychron/q2/rev_0110/keymaps/via/rules.mk
new file mode 100644
index 000000000..bee21da52
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/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_0110/readme.md b/keyboards/keychron/q2/rev_0110/readme.md
new file mode 100644
index 000000000..d3134cedb
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/readme.md
@@ -0,0 +1 @@
# The ANSI variant of the Keychron Q2
diff --git a/keyboards/keychron/q2/rev_0110/rev_0110.c b/keyboards/keychron/q2/rev_0110/rev_0110.c
new file mode 100644
index 000000000..d91a41fca
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/rev_0110.c
@@ -0,0 +1,17 @@
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"
diff --git a/keyboards/keychron/q2/rev_0110/rev_0110.h b/keyboards/keychron/q2/rev_0110/rev_0110.h
new file mode 100644
index 000000000..669a79d31
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/rev_0110.h
@@ -0,0 +1,35 @@
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_ansi_67( \
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, K1D, K1E,\
26 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K2E,\
27 K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
28 K40, K41, K42, K46, 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, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, K3E, }, \
34 { K40, K41, K42, XXX, XXX, XXX, K46, XXX, XXX, XXX, K4A, K4B, K4C, K4D, K4E, } \
35}
diff --git a/keyboards/keychron/q2/rev_0110/rules.mk b/keyboards/keychron/q2/rev_0110/rules.mk
new file mode 100644
index 000000000..0d4e74501
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0110/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 = no # 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
diff --git a/keyboards/keychron/q2/rev_0111/config.h b/keyboards/keychron/q2/rev_0111/config.h
new file mode 100644
index 000000000..cc50d0688
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/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 0x0111
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_0111/keymaps/default/info.json b/keyboards/keychron/q2/rev_0111/keymaps/default/info.json
new file mode 100644
index 000000000..590ed6d11
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/keymaps/default/info.json
@@ -0,0 +1,82 @@
1{
2 "keyboard_name": "Keychron Q2",
3 "url": "https://github.com/Keychron",
4 "maintainer": "lalalademaxiya1",
5 "layouts": {
6 "LAYOUT_ansi_": {
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":"|", "x":13.5, "y":1.25, "w":1.5},
39 {"label":"Delete", "x":15.25, "y":1.25},
40
41 {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
42 {"label":"A", "x":1.75, "y":2.25},
43 {"label":"S", "x":2.75, "y":2.25},
44 {"label":"D", "x":3.75, "y":2.25},
45 {"label":"F", "x":4.75, "y":2.25},
46 {"label":"G", "x":5.75, "y":2.25},
47 {"label":"H", "x":6.75, "y":2.25},
48 {"label":"J", "x":7.75, "y":2.25},
49 {"label":"K", "x":8.75, "y":2.25},
50 {"label":"L", "x":9.75, "y":2.25},
51 {"label":":", "x":10.75, "y":2.25},
52 {"label":"\"", "x":11.75, "y":2.25},
53 {"label":"Enter", "x":12.75, "y":2.25, "w":2.25},
54 {"label":"Home", "x":15.25, "y":2.25},
55
56 {"label":"Shift", "x":0, "y":3.25, "w":2.25},
57 {"label":"Z", "x":2.25, "y":3.25},
58 {"label":"X", "x":3.25, "y":3.25},
59 {"label":"C", "x":4.25, "y":3.25},
60 {"label":"V", "x":5.25, "y":3.25},
61 {"label":"B", "x":6.25, "y":3.25},
62 {"label":"N", "x":7.25, "y":3.25},
63 {"label":"M", "x":8.25, "y":3.25},
64 {"label":"<", "x":9.25, "y":3.25},
65 {"label":">", "x":10.25, "y":3.25},
66 {"label":"?", "x":11.25, "y":3.25},
67 {"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
68 {"label":"Up", "x":14.25, "y":3.5},
69
70 {"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
71 {"label":"Win", "x":1.25, "y":4.25, "w":1.25},
72 {"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
73 {"label":"Space", "x":3.75, "y":4.25, "w":6.25},
74 {"label":"Alt", "x":10, "y":4.25},
75 {"label":"Fn1", "x":11, "y":4.25},
76 {"label":"Fn2", "x":12, "y":4.25},
77 {"label":"Left", "x":13.25, "y":4.5},
78 {"label":"Down", "x":14.25, "y":4.5},
79 {"label":"Right", "x":15.25, "y":4.5} ]
80 }
81 }
82}
diff --git a/keyboards/keychron/q2/rev_0111/keymaps/default/keymap.c b/keyboards/keychron/q2/rev_0111/keymaps/default/keymap.c
new file mode 100644
index 000000000..f5a066760
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/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_ansi_67(
40 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,
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_BSLS, 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_ENT, KC_HOME,
43 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,
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_ansi_67(
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_BSLS, 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_ENT, KC_HOME,
50 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,
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_ansi_67(
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, 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,
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,
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_ansi_67(
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, 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,
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,
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_ansi_67(
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, 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,
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,
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_0111/keymaps/via/info.json b/keyboards/keychron/q2/rev_0111/keymaps/via/info.json
new file mode 100644
index 000000000..0e2ad8463
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/keymaps/via/info.json
@@ -0,0 +1,84 @@
1{
2 "keyboard_name": "Keychron Q2",
3 "url": "https://github.com/Keychron",
4 "maintainer": "lalalademaxiya1",
5 "layouts": {
6 "LAYOUT_ansi_": {
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":"|", "x":13.5, "y":1.25, "w":1.5},
41 {"label":"Delete", "x":15.25, "y":1.25},
42
43 {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
44 {"label":"A", "x":1.75, "y":2.25},
45 {"label":"S", "x":2.75, "y":2.25},
46 {"label":"D", "x":3.75, "y":2.25},
47 {"label":"F", "x":4.75, "y":2.25},
48 {"label":"G", "x":5.75, "y":2.25},
49 {"label":"H", "x":6.75, "y":2.25},
50 {"label":"J", "x":7.75, "y":2.25},
51 {"label":"K", "x":8.75, "y":2.25},
52 {"label":"L", "x":9.75, "y":2.25},
53 {"label":":", "x":10.75, "y":2.25},
54 {"label":"\"", "x":11.75, "y":2.25},
55 {"label":"Enter", "x":12.75, "y":2.25, "w":2.25},
56 {"label":"Home", "x":15.25, "y":2.25},
57
58 {"label":"Shift", "x":0, "y":3.25, "w":2.25},
59 {"label":"Z", "x":2.25, "y":3.25},
60 {"label":"X", "x":3.25, "y":3.25},
61 {"label":"C", "x":4.25, "y":3.25},
62 {"label":"V", "x":5.25, "y":3.25},
63 {"label":"B", "x":6.25, "y":3.25},
64 {"label":"N", "x":7.25, "y":3.25},
65 {"label":"M", "x":8.25, "y":3.25},
66 {"label":"<", "x":9.25, "y":3.25},
67 {"label":">", "x":10.25, "y":3.25},
68 {"label":"?", "x":11.25, "y":3.25},
69 {"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
70 {"label":"Up", "x":14.25, "y":3.5},
71
72 {"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
73 {"label":"Win", "x":1.25, "y":4.25, "w":1.25},
74 {"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
75 {"label":"Space", "x":3.75, "y":4.25, "w":6.25},
76 {"label":"Alt", "x":10, "y":4.25},
77 {"label":"Fn1", "x":11, "y":4.25},
78 {"label":"Fn2", "x":12, "y":4.25},
79 {"label":"Left", "x":13.25, "y":4.5},
80 {"label":"Down", "x":14.25, "y":4.5},
81 {"label":"Right", "x":15.25, "y":4.5} ]
82 }
83 }
84}
diff --git a/keyboards/keychron/q2/rev_0111/keymaps/via/keymap.c b/keyboards/keychron/q2/rev_0111/keymaps/via/keymap.c
new file mode 100644
index 000000000..15cdbb027
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/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_3, KC_4, 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_BSLS, 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_ENT, KC_HOME,
43 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,
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_BSLS, 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_ENT, KC_HOME,
50 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,
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, 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,
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,
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, 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,
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,
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, 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,
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,
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_0111/keymaps/via/rules.mk b/keyboards/keychron/q2/rev_0111/keymaps/via/rules.mk
new file mode 100644
index 000000000..bee21da52
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/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_0111/readme.md b/keyboards/keychron/q2/rev_0111/readme.md
new file mode 100644
index 000000000..2bb5d3bca
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/readme.md
@@ -0,0 +1,5 @@
1# The ANSI 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_0111/rev_0111.c b/keyboards/keychron/q2/rev_0111/rev_0111.c
new file mode 100644
index 000000000..c9413d023
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/rev_0111.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_0111/rev_0111.h b/keyboards/keychron/q2/rev_0111/rev_0111.h
new file mode 100644
index 000000000..0b1cfade1
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/rev_0111.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, K1D, K1E,\
26 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K2E,\
27 K30, 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, XXX, 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_ansi_67( \
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, K1D, K1E,\
39 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K2E,\
40 K30, 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, XXX, 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_0111/rules.mk b/keyboards/keychron/q2/rev_0111/rules.mk
new file mode 100644
index 000000000..52d0bce59
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0111/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
diff --git a/keyboards/keychron/q2/rev_0112/config.h b/keyboards/keychron/q2/rev_0112/config.h
new file mode 100644
index 000000000..b76640d65
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/config.h
@@ -0,0 +1,21 @@
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 0x0112
21#define DEVICE_VER 0x0100
diff --git a/keyboards/keychron/q2/rev_0112/info.json b/keyboards/keychron/q2/rev_0112/info.json
new file mode 100644
index 000000000..83a7addfe
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/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":"Insert", "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_0112/keymaps/default/keymap.c b/keyboards/keychron/q2/rev_0112/keymaps/default/keymap.c
new file mode 100644
index 000000000..75667b44c
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/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_INS,
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_INS,
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_0112/keymaps/via/keymap.c b/keyboards/keychron/q2/rev_0112/keymaps/via/keymap.c
new file mode 100644
index 000000000..0a91857f1
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/keymaps/via/keymap.c
@@ -0,0 +1,112 @@
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_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_INS,
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_INS,
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 case KC_TASK:
92 if (record->event.pressed) {
93 register_code(KC_LWIN);
94 register_code(KC_TAB);
95 } else {
96 unregister_code(KC_LWIN);
97 unregister_code(KC_TAB);
98 }
99 return false; // Skip all further processing of this key
100 case KC_FLXP:
101 if (record->event.pressed) {
102 register_code(KC_LWIN);
103 register_code(KC_E);
104 } else {
105 unregister_code(KC_LWIN);
106 unregister_code(KC_E);
107 }
108 return false; // Skip all further processing of this key
109 default:
110 return true; // Process all other keycodes normally
111 }
112}
diff --git a/keyboards/keychron/q2/rev_0112/keymaps/via/rules.mk b/keyboards/keychron/q2/rev_0112/keymaps/via/rules.mk
new file mode 100644
index 000000000..bee21da52
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/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_0112/readme.md b/keyboards/keychron/q2/rev_0112/readme.md
new file mode 100644
index 000000000..29404e03c
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/readme.md
@@ -0,0 +1 @@
# The ISO variant of the Keychron Q2
diff --git a/keyboards/keychron/q2/rev_0112/rev_0112.c b/keyboards/keychron/q2/rev_0112/rev_0112.c
new file mode 100644
index 000000000..d91a41fca
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/rev_0112.c
@@ -0,0 +1,17 @@
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"
diff --git a/keyboards/keychron/q2/rev_0112/rev_0112.h b/keyboards/keychron/q2/rev_0112/rev_0112.h
new file mode 100644
index 000000000..2ab66fb84
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/rev_0112.h
@@ -0,0 +1,36 @@
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_iso_68( \
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, 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, XXX, XXX, XXX, K4A, K4B, K4C, K4D, K4E, } \
35}
36
diff --git a/keyboards/keychron/q2/rev_0112/rules.mk b/keyboards/keychron/q2/rev_0112/rules.mk
new file mode 100644
index 000000000..0d4e74501
--- /dev/null
+++ b/keyboards/keychron/q2/rev_0112/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 = no # 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
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