From 145d89ab9192d08b7e22a14105d27988944b7b0c Mon Sep 17 00:00:00 2001
From: lokher <lokher@gmail.com>
Date: Sun, 25 Jul 2021 00:37:24 +0800
Subject: [PATCH] [Keyboard] Add Keychron Q1 (#13397)

Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
---
 keyboards/keychron/q1/config.h                |  51 ++++++
 keyboards/keychron/q1/q1.c                    | 159 ++++++++++++++++++
 keyboards/keychron/q1/q1.h                    |  23 +++
 keyboards/keychron/q1/readme.md               |  21 +++
 keyboards/keychron/q1/rev_0100/config.h       |  26 +++
 keyboards/keychron/q1/rev_0100/info.json      |  93 ++++++++++
 .../q1/rev_0100/keymaps/default/keymap.c      |  66 ++++++++
 .../keychron/q1/rev_0100/keymaps/via/keymap.c |  66 ++++++++
 .../keychron/q1/rev_0100/keymaps/via/rules.mk |   2 +
 keyboards/keychron/q1/rev_0100/readme.md      |  21 +++
 keyboards/keychron/q1/rev_0100/rev_0100.h     |  37 ++++
 keyboards/keychron/q1/rev_0100/rules.mk       |  25 +++
 12 files changed, 590 insertions(+)
 create mode 100644 keyboards/keychron/q1/config.h
 create mode 100644 keyboards/keychron/q1/q1.c
 create mode 100644 keyboards/keychron/q1/q1.h
 create mode 100644 keyboards/keychron/q1/readme.md
 create mode 100644 keyboards/keychron/q1/rev_0100/config.h
 create mode 100644 keyboards/keychron/q1/rev_0100/info.json
 create mode 100644 keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c
 create mode 100644 keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c
 create mode 100644 keyboards/keychron/q1/rev_0100/keymaps/via/rules.mk
 create mode 100644 keyboards/keychron/q1/rev_0100/readme.md
 create mode 100644 keyboards/keychron/q1/rev_0100/rev_0100.h
 create mode 100644 keyboards/keychron/q1/rev_0100/rules.mk

diff --git a/keyboards/keychron/q1/config.h b/keyboards/keychron/q1/config.h
new file mode 100644
index 0000000000..fb6a70c869
--- /dev/null
+++ b/keyboards/keychron/q1/config.h
@@ -0,0 +1,51 @@
+/* Copyright 2021 @ Keychron(https://www.keychron.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID       0x3434
+#define MANUFACTURER    Keychron
+#define PRODUCT         Keychron Q1
+
+/* key matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 15
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION ROW2COL
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+/* RGB LED Matrix Configuration */
+#define DRIVER_COUNT 2
+#define DRIVER_ADDR_1 0b1010000
+#define DRIVER_ADDR_2 0b1011111
+
+#define DRIVER_1_LED_TOTAL 59
+#define DRIVER_2_LED_TOTAL 23
+#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
+
+/* DIP switch */
+#define DIP_SWITCH_MATRIX_GRID  { {0,1} }
+
+/* Disable DIP switch in matrix data */
+#define MATRIX_MASKED
+
+/* NKRO */
+#define FORCE_NKRO
diff --git a/keyboards/keychron/q1/q1.c b/keyboards/keychron/q1/q1.c
new file mode 100644
index 0000000000..943cf26cef
--- /dev/null
+++ b/keyboards/keychron/q1/q1.c
@@ -0,0 +1,159 @@
+/* Copyright 2021 @ Keychron (https://www.keychron.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "q1.h"
+
+const matrix_row_t matrix_mask[] = {
+    0b0111111111111101,
+    0b0111111111111111,
+    0b0111111111111111,
+    0b0111111111111111,
+    0b0111111111111111,
+    0b0111111111111111,
+};
+
+void dip_switch_update_kb(uint8_t index, bool active) { 
+    if (index == 0) {
+        default_layer_set(1UL << (active ? 2 : 0)); 
+    }
+    dip_switch_update_user(index, active);
+}
+
+const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+/* Refer to IS31 manual for these locations
+ *   driver
+ *   |  R location
+ *   |  |       G location
+ *   |  |       |       B location
+ *   |  |       |       | */
+
+    {0, A_1,    C_1,    B_1},
+    {0, A_3,    C_3,    B_3},
+    {0, A_4,    C_4,    B_4},
+    {0, A_5,    C_5,    B_5},
+    {0, A_6,    C_6,    B_6},
+    {0, A_7,    C_7,    B_7},
+    {0, A_8,    C_8,    B_8},
+    {0, A_9,    C_9,    B_9},   
+    {0, A_10,   C_10,   B_10},
+    {0, A_11,   C_11,   B_11},
+    {0, A_12,   C_12,   B_12},
+    {0, A_13,   C_13,   B_13},
+    {0, A_14,   C_14,   B_14},
+    {0, A_15,   C_15,   B_15},
+    {0, A_16,   C_16,   B_16},
+
+    {0, D_1,    F_1,    E_1},
+    {0, D_2,    F_2,    E_2},
+    {0, D_3,    F_3,    E_3}, 
+    {0, D_4,    F_4,    E_4},
+    {0, D_5,    F_5,    E_5},
+    {0, D_6,    F_6,    E_6},
+    {0, D_7,    F_7,    E_7},
+    {0, D_8,    F_8,    E_8},
+    {0, D_9,    F_9,    E_9},
+    {0, D_10,   F_10,   E_10},
+    {0, D_11,   F_11,   E_11},
+    {0, D_12,   F_12,   E_12},
+    {0, D_13,   F_13,   E_13},
+    {0, D_14,   F_14,   E_14},
+    {0, D_16,   F_16,   E_16},
+
+    {0, G_1,    I_1,    H_1},
+    {0, G_2,    I_2,    H_2},
+    {0, G_3,    I_3,    H_3},
+    {0, G_4,    I_4,    H_4},
+    {0, G_5,    I_5,    H_5},
+    {0, G_6,    I_6,    H_6},
+    {0, G_7,    I_7,    H_7},
+    {0, G_8,    I_8,    H_8},
+    {0, G_9,    I_9,    H_9},
+    {0, G_10,   I_10,   H_10},
+    {0, G_11,   I_11,   H_11},
+    {0, G_12,   I_12,   H_12},
+    {0, G_13,   I_13,   H_13},
+    {0, G_14,   I_14,   H_14},
+    {0, G_16,   I_16,   H_16}, 
+    
+    {0, J_1,    L_1,    K_1},
+    {0, J_2,    L_2,    K_2},
+    {0, J_3,    L_3,    K_3},
+    {0, J_4,    L_4,    K_4},
+    {0, J_5,    L_5,    K_5},
+    {0, J_6,    L_6,    K_6},
+    {0, J_7,    L_7,    K_7},
+    {0, J_8,    L_8,    K_8},
+    {0, J_9,    L_9,    K_9},
+    {0, J_10,   L_10,   K_10},
+    {0, J_11,   L_11,   K_11},
+    {0, J_12,   L_12,   K_12},
+    {0, J_14,   L_14,   K_14},
+    {0, J_16,   L_16,   K_16},
+    {1, A_1,    C_1,    B_1},
+
+    {1, A_3,    C_3,    B_3},
+    {1, A_4,    C_4,    B_4},
+    {1, A_5,    C_5,    B_5},
+    {1, A_6,    C_6,    B_6},
+    {1, A_7,    C_7,    B_7},
+    {1, A_8,    C_8,    B_8},
+    {1, A_9,    C_9,    B_9},
+    {1, A_10,   C_10,   B_10},
+    {1, A_11,   C_11,   B_11},
+    {1, A_12,   C_12,   B_12},
+    {1, A_14,   C_14,   B_14},
+    {1, A_15,   C_15,   B_15},
+                                   
+    {1, D_1,    F_1,    E_1},
+    {1, D_2,    F_2,    E_2},
+    {1, D_3,    F_3,    E_3},
+    {1, D_7,    F_7,    E_7},
+    {1, D_11,   F_11,   E_11},
+    {1, D_12,   F_12,   E_12},
+    {1, D_13,   F_13,   E_13}, 
+    {1, D_14,   F_14,   E_14}, 
+    {1, D_15,   F_15,   E_15},
+    {1, D_16,   F_16,   E_16}
+
+};
+
+led_config_t g_led_config = {
+	{
+		{   0,     NO_LED,  1,      2,      3,      4,     5,      6,      7,      8,      9,     10,     11,      12,     14   },
+		{  15,     16,     17,     18,     19,     20,    21,     22,     23,     24,     25,     26,     27,      28,     29   },
+		{  30,     31,     32,     33,     34,     35,    36,     37,     38,     39,     40,     41,     42,      43,     44   },
+		{  45,     46,     47,     48,     49,     50,    51,     52,     53,     54,     55,     56,     71,      57,     58   },
+		{  59,     NO_LED, 60,     61,     62,     63,    64,     65,     66,     67,     68,     69,     80,      70,     13   },
+		{  72,     73,     74,     NO_LED, NO_LED, NO_LED,75,     NO_LED, NO_LED, NO_LED, 76,     77,     78,      79,     81   }
+	},
+	{
+		{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},
+	    {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},
+	    {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},
+	    {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},
+	    {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}, 
+	    {0,64}, {15,64}, {30,64},                            {90,64},                               {150,64}, {165,64}, {180,64}, {195,64}, {210,64}, {224,64},
+	},
+	{
+		4,			4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,
+		4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,		  4,
+		4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,		  4,
+		4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,		  4,		  4,
+		4,			4,	  4,	4,	  4,	4,	  4,	4,	  4,	4,	  4,		  4,	4,	  
+		4,	  4,	4,						4,						4,	  4,	4,	  4,	4,	  4
+
+	}
+};
diff --git a/keyboards/keychron/q1/q1.h b/keyboards/keychron/q1/q1.h
new file mode 100644
index 0000000000..1e92a062ad
--- /dev/null
+++ b/keyboards/keychron/q1/q1.h
@@ -0,0 +1,23 @@
+/* Copyright 2021 @ Keychron (https://www.keychron.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "quantum.h"
+
+#if defined(KEYBOARD_keychron_q1_rev_0100)
+#    include "rev_0100.h"
+#endif
diff --git a/keyboards/keychron/q1/readme.md b/keyboards/keychron/q1/readme.md
new file mode 100644
index 0000000000..d7b6af3b37
--- /dev/null
+++ b/keyboards/keychron/q1/readme.md
@@ -0,0 +1,21 @@
+# Keychron Q1
+
+![Keychron Q1](https://cdn.shopify.com/s/files/1/0059/0630/1017/t/5/assets/pf-823ebdc7--1073.jpg)
+
+A customizable 75% keyboard.
+
+* Keyboard Maintainer: [Keychron](https://github.com/keychron)
+* Hardware Supported: Keychron Q1
+* Hardware Availability: [Keychron](https://www.keychron.com)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make keychron/q1/rev_0100:default
+
+Flashing example for this keyboard:
+
+    make keychron/q1/rev_0100:default:flash
+
+**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard.
+
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/keychron/q1/rev_0100/config.h b/keyboards/keychron/q1/rev_0100/config.h
new file mode 100644
index 0000000000..5b910f7381
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0100/config.h
@@ -0,0 +1,26 @@
+/* Copyright 2021 @ Keychron (https://www.keychron.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+
+/* USB Device descriptor parameter */
+#define PRODUCT_ID      0x0100
+#define DEVICE_VER      0x0001
+
+/* key matrix pins */
+#define MATRIX_ROW_PINS { D3, D2, B3, B2, B1, B0 }
+#define MATRIX_COL_PINS { D5, D4, D6, D7, B4, B5, B6, C6, C7, F7, F6, F5, F4, F1, F0 }
diff --git a/keyboards/keychron/q1/rev_0100/info.json b/keyboards/keychron/q1/rev_0100/info.json
new file mode 100644
index 0000000000..4d101eac70
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0100/info.json
@@ -0,0 +1,93 @@
+{
+    "keyboard_name": "Keychron Q1", 
+    "url": "https://github.com/Keychron", 
+    "maintainer": "lokher", 
+    "width": 16.25, 
+    "height": 6.25, 
+    "layouts": {
+        "LAYOUT_ansi_82": {
+            "layout": [{"label":"Esc", "x":0, "y":0}, 
+	    {"label":"F1", "x":1.25, "y":0}, 
+	    {"label":"F2", "x":2.25, "y":0}, 
+	    {"label":"F3", "x":3.25, "y":0},
+	    {"label":"F4", "x":4.25, "y":0},
+	    {"label":"F5", "x":5.5, "y":0}, 
+	    {"label":"F6", "x":6.5, "y":0},
+	    {"label":"F7", "x":7.5, "y":0},
+	    {"label":"F8", "x":8.5, "y":0},
+	    {"label":"F9", "x":9.75, "y":0},
+	    {"label":"F10", "x":10.75, "y":0}, 
+	    {"label":"F11", "x":11.75, "y":0}, 
+	    {"label":"F12", "x":12.75, "y":0}, 
+	    {"label":"Delete", "x":14, "y":0}, 
+	    {"label":"Insert", "x":15.25, "y":0}, 
+	    {"label":"~", "x":0, "y":1},
+	    {"label":"!", "x":1, "y":1}, 
+	    {"label":"@", "x":2, "y":1}, 
+	    {"label":"#", "x":3, "y":1}, 
+	    {"label":"$", "x":4, "y":1}, 
+	    {"label":"%", "x":5, "y":1}, 
+	    {"label":"^", "x":6, "y":1}, 
+	    {"label":"&", "x":7, "y":1}, 
+	    {"label":"*", "x":8, "y":1},
+	    {"label":"(", "x":9, "y":1}, 
+	    {"label":")", "x":10, "y":1},
+	    {"label":"_", "x":11, "y":1}, 
+	    {"label":"+", "x":12, "y":1}, 
+	    {"label":"Backspace", "x":13, "y":1, "w":2}, 
+	    {"label":"Page Up", "x":15.25, "y":1}, 
+	    {"label":"Tab", "x":0, "y":2, "w":1.5},
+	    {"label":"Q", "x":1.5, "y":2},
+	    {"label":"W", "x":2.5, "y":2}, 
+	    {"label":"E", "x":3.5, "y":2}, 
+	    {"label":"R", "x":4.5, "y":2}, 
+	    {"label":"T", "x":5.5, "y":2}, 
+	    {"label":"Y", "x":6.5, "y":2}, 
+	    {"label":"U", "x":7.5, "y":2}, 
+	    {"label":"I", "x":8.5, "y":2}, 
+	    {"label":"O", "x":9.5, "y":2}, 
+	    {"label":"P", "x":10.5, "y":2}, 
+	    {"label":"{", "x":11.5, "y":2}, 
+	    {"label":"}", "x":12.5, "y":2},
+	    {"label":"|", "x":13.5, "y":2, "w":1.5}, 
+	    {"label":"Page Down", "x":15.25, "y":2}, 
+	    {"label":"Caps Lock", "x":0, "y":3, "w":1.75}, 
+	    {"label":"A", "x":1.75, "y":3}, 
+	    {"label":"S", "x":2.75, "y":3},
+	    {"label":"D", "x":3.75, "y":3}, 
+	    {"label":"F", "x":4.75, "y":3}, 
+	    {"label":"G", "x":5.75, "y":3}, 
+	    {"label":"H", "x":6.75, "y":3}, 
+	    {"label":"J", "x":7.75, "y":3}, 
+	    {"label":"K", "x":8.75, "y":3}, 
+	    {"label":"L", "x":9.75, "y":3}, 
+	    {"label":":", "x":10.75, "y":3},
+	    {"label":"\"", "x":11.75, "y":3}, 
+	    {"label":"Enter", "x":12.75, "y":3, "w":2.25}, 
+	    {"label":"Home", "x":15.25, "y":3}, 
+	    {"label":"Shift", "x":0, "y":4, "w":2.25}, 
+	    {"label":"Z", "x":2.25, "y":4}, 
+	    {"label":"X", "x":3.25, "y":4}, 
+	    {"label":"C", "x":4.25, "y":4}, 
+	    {"label":"V", "x":5.25, "y":4}, 
+	    {"label":"B", "x":6.25, "y":4}, 
+	    {"label":"N", "x":7.25, "y":4}, 
+	    {"label":"M", "x":8.25, "y":4},
+	    {"label":"<", "x":9.25, "y":4}, 
+	    {"label":">", "x":10.25, "y":4}, 
+	    {"label":"?", "x":11.25, "y":4}, 
+	    {"label":"Shift", "x":12.25, "y":4, "w":1.75},
+	    {"label":"\u2191", "x":14.25, "y":4.25}, 
+	    {"label":"Ctrl", "x":0, "y":5, "w":1.25}, 
+	    {"label":"Win", "x":1.25, "y":5, "w":1.25},
+	    {"label":"Alt", "x":2.5, "y":5, "w":1.25}, 
+	    {"x":3.75, "y":5, "w":6.25}, 
+	    {"label":"Alt", "x":10, "y":5}, 
+	    {"label":"Fn", "x":11, "y":5}, 
+	    {"label":"Ctrl", "x":12, "y":5}, 
+	    {"label":"\u2190", "x":13.25, "y":5.25}, 
+	    {"label":"\u2193", "x":14.25, "y":5.25}, 
+	    {"label":"\u2192", "x":15.25, "y":5.25}]
+        }
+    }
+}
diff --git a/keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c b/keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c
new file mode 100644
index 0000000000..fa6f791759
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0100/keymaps/default/keymap.c
@@ -0,0 +1,66 @@
+/* Copyright 2021 @ Keychron (https://www.keychron.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include QMK_KEYBOARD_H
+
+
+enum layers{
+  MAC_BASE,
+  MAC_FN,
+  WIN_BASE,
+  WIN_FN
+};
+
+
+#define KC_TASK LGUI(KC_TAB)
+#define KC_FLXP LGUI(KC_E)
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+[MAC_BASE] = LAYOUT_ansi_82( 
+     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,
+     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,
+     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,
+     KC_CAPS,  KC_A,     KC_S,     KC_D,     KC_F,     KC_G,     KC_H,     KC_J,     KC_K,     KC_L,     KC_SCLN,  KC_QUOT,	           KC_ENT,             KC_HOME,
+     KC_LSFT,            KC_Z,     KC_X,     KC_C,     KC_V,     KC_B,     KC_N,     KC_M,     KC_COMM,  KC_DOT,   KC_SLSH,            KC_RSFT,  KC_UP,
+     KC_LCTL,  KC_LALT,  KC_LGUI,                                KC_SPC,                                 KC_RGUI, MO(MAC_FN),KC_RCTL,  KC_LEFT,  KC_DOWN,  KC_RGHT),
+
+[MAC_FN] = LAYOUT_ansi_82( 
+     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,
+     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,
+     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,
+     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,            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,                                KC_TRNS,                                KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS),
+
+[WIN_BASE] = LAYOUT_ansi_82( 
+     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,
+     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,
+     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,
+     KC_CAPS,  KC_A,     KC_S,     KC_D,     KC_F,     KC_G,     KC_H,     KC_J,     KC_K,     KC_L,     KC_SCLN,  KC_QUOT,            KC_ENT,             KC_HOME,
+     KC_LSFT,            KC_Z,     KC_X,     KC_C,     KC_V,     KC_B,     KC_N,     KC_M,     KC_COMM,  KC_DOT,   KC_SLSH,            KC_RSFT,  KC_UP,
+     KC_LCTL,  KC_LGUI,  KC_LALT,                                KC_SPC,                                 KC_RALT, MO(WIN_FN),KC_RCTL,  KC_LEFT,  KC_DOWN,  KC_RGHT),
+
+[WIN_FN] = LAYOUT_ansi_82( 
+     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,
+     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,
+     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,
+     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,            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,                                KC_TRNS,                                KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS)
+
+};
diff --git a/keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c b/keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c
new file mode 100644
index 0000000000..4108ade04f
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0100/keymaps/via/keymap.c
@@ -0,0 +1,66 @@
+/* Copyright 2021 @ Keychron (https://www.keychron.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include QMK_KEYBOARD_H
+
+
+enum layers{
+  MAC_BASE,
+  MAC_FN,
+  WIN_BASE,
+  WIN_FN
+};
+
+
+#define KC_TASK LGUI(KC_TAB)
+#define KC_FLXP LGUI(KC_E)
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+[MAC_BASE] = LAYOUT_ansi_82( 
+     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,
+     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,
+     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,
+     KC_CAPS,  KC_A,     KC_S,     KC_D,     KC_F,     KC_G,     KC_H,     KC_J,     KC_K,     KC_L,     KC_SCLN,  KC_QUOT,            KC_ENT,             KC_HOME,
+     KC_LSFT,            KC_Z,     KC_X,     KC_C,     KC_V,     KC_B,     KC_N,     KC_M,     KC_COMM,  KC_DOT,   KC_SLSH,            KC_RSFT,  KC_UP,
+     KC_LCTL,  KC_LALT,  KC_LGUI,                                KC_SPC,                                 KC_RGUI, MO(MAC_FN),KC_RCTL,  KC_LEFT,  KC_DOWN,  KC_RGHT),
+
+[MAC_FN] = LAYOUT_ansi_82( 
+     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,
+     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,
+     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,
+     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,            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,                                KC_TRNS,                                KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS),
+
+[WIN_BASE] = LAYOUT_ansi_82( 
+     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,
+     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,
+     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,
+     KC_CAPS,  KC_A,     KC_S,     KC_D,     KC_F,     KC_G,     KC_H,     KC_J,     KC_K,     KC_L,     KC_SCLN,  KC_QUOT,            KC_ENT,             KC_HOME,
+     KC_LSFT,            KC_Z,     KC_X,     KC_C,     KC_V,     KC_B,     KC_N,     KC_M,     KC_COMM,  KC_DOT,   KC_SLSH,            KC_RSFT,  KC_UP,
+     KC_LCTL,  KC_LGUI,  KC_LALT,                                KC_SPC,                                 KC_RALT, MO(WIN_FN),KC_RCTL,  KC_LEFT,  KC_DOWN,  KC_RGHT),
+
+[WIN_FN] = LAYOUT_ansi_82( 
+     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,
+     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,
+     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,
+     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,            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,                                KC_TRNS,                                KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS,  KC_TRNS)
+
+};
diff --git a/keyboards/keychron/q1/rev_0100/keymaps/via/rules.mk b/keyboards/keychron/q1/rev_0100/keymaps/via/rules.mk
new file mode 100644
index 0000000000..96d2d189b2
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0100/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+MOUSEKEY_ENABLE = no
diff --git a/keyboards/keychron/q1/rev_0100/readme.md b/keyboards/keychron/q1/rev_0100/readme.md
new file mode 100644
index 0000000000..0131794c18
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0100/readme.md
@@ -0,0 +1,21 @@
+# Keychron Q1
+
+![Keychron Q1](https://cdn.shopify.com/s/files/1/0059/0630/1017/t/5/assets/pf-823ebdc7--1073.jpg)
+
+A customizable 75% keyboard.
+
+* Keyboard Maintainer: [Keychron](https://github.com/keychron)
+* Hardware Supported: Keychron Q1, Atmega32u4
+* Hardware Availability: [Keychron](https://www.keychron.com)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make keychron/q1/rev_0100:default
+
+Flashing example for this keyboard:
+
+    make keychron/q1/rev_0100:default:flash
+
+**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard.
+
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/keychron/q1/rev_0100/rev_0100.h b/keyboards/keychron/q1/rev_0100/rev_0100.h
new file mode 100644
index 0000000000..2a1edac646
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0100/rev_0100.h
@@ -0,0 +1,37 @@
+/* Copyright 2021 @ Keychron (https://www.keychron.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "quantum.h"
+
+#define xxx KC_NO
+
+#define LAYOUT_ansi_82( \
+	K00,       K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
+	K10, K11,  K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D,      K1E, \
+	K20, K21,  K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D,      K2E, \
+	K30, K31,  K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,      K3D,      K3E, \
+	K40,       K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B,      K4D, K3C,      \
+	K50, K51,  K52,                K56,                K5A, K5B, K5C, K5D, K4C, K5E  \
+) { \
+	{ K00, xxx,  K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B,  K0C, K0D, K0E }, \
+	{ K10, K11,  K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B,  K1C, K1D, K1E }, \
+	{ K20, K21,  K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,  K2C, K2D, K2E }, \
+	{ K30, K31,  K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,  K3C, K3D, K3E }, \
+	{ K40, xxx,  K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B,  K4C, K4D, K4E }, \
+	{ K50, K51,  K52, xxx, xxx, xxx, K56, xxx, xxx, xxx, K5A, K5B,  K5C, K5D, K5E }  \
+}
diff --git a/keyboards/keychron/q1/rev_0100/rules.mk b/keyboards/keychron/q1/rev_0100/rules.mk
new file mode 100644
index 0000000000..5080a4638c
--- /dev/null
+++ b/keyboards/keychron/q1/rev_0100/rules.mk
@@ -0,0 +1,25 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-dfu
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = yes     # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = no       # Mouse keys
+EXTRAKEY_ENABLE = yes      # Audio control and System control
+CONSOLE_ENABLE = no        # Console for debug
+COMMAND_ENABLE = no        # Commands for debug and configuration
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = yes           # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
+DIP_SWITCH_ENABLE = yes
+RGB_MATRIX_ENABLE = yes
+RGB_MATRIX_DRIVER = IS31FL3733