From 38de991fda2bdb813b2acd067762a22c59607207 Mon Sep 17 00:00:00 2001
From: Simon Hengel <sol@typeful.net>
Date: Mon, 29 Aug 2022 11:39:45 +0700
Subject: [PATCH] [Keyboard] Add chord/zero (#18190)

---
 keyboards/chord/zero/config.h                 |  4 ++
 keyboards/chord/zero/info.json                | 65 +++++++++++++++++++
 keyboards/chord/zero/keymaps/default/keymap.c | 25 +++++++
 keyboards/chord/zero/keymaps/default/rules.mk |  1 +
 keyboards/chord/zero/readme.md                | 37 +++++++++++
 keyboards/chord/zero/rules.mk                 |  1 +
 6 files changed, 133 insertions(+)
 create mode 100644 keyboards/chord/zero/config.h
 create mode 100644 keyboards/chord/zero/info.json
 create mode 100644 keyboards/chord/zero/keymaps/default/keymap.c
 create mode 100644 keyboards/chord/zero/keymaps/default/rules.mk
 create mode 100644 keyboards/chord/zero/readme.md
 create mode 100644 keyboards/chord/zero/rules.mk

diff --git a/keyboards/chord/zero/config.h b/keyboards/chord/zero/config.h
new file mode 100644
index 0000000000..9d552d5af4
--- /dev/null
+++ b/keyboards/chord/zero/config.h
@@ -0,0 +1,4 @@
+// Copyright (c) 2022 Simon Hengel <sol@typeful.net>
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
diff --git a/keyboards/chord/zero/info.json b/keyboards/chord/zero/info.json
new file mode 100644
index 0000000000..c49a8a3c2f
--- /dev/null
+++ b/keyboards/chord/zero/info.json
@@ -0,0 +1,65 @@
+{
+    "manufacturer": "Simon Hengel",
+    "keyboard_name": "CHORD ZERO",
+    "usb": {
+        "device_version": "1.0.0",
+        "vid": "0x1D50",
+        "pid": "0x617C"
+    },
+    "url": "https://github.com/sol/chord-zero#readme",
+    "maintainer": "sol",
+    "features": {
+        "bootmagic": true,
+        "command": false,
+        "console": false,
+        "extrakey": true,
+        "mousekey": true,
+        "nkro": true,
+        "steno": true
+    },
+    "processor": "RP2040",
+    "bootloader": "rp2040",
+    "diode_direction": "COL2ROW",
+    "matrix_pins": {
+        "cols": ["GP22", "GP9", "GP21", "GP11", "GP19", "GP12"],
+        "rows": ["GP26", "GP20", "GP18", "GP17", "GP7", "GP10", "GP13", "GP14"]
+    },
+    "layouts": {
+        "LAYOUT_zero": {
+            "layout": [
+                { "matrix": [0, 0], "y": 0, "x": 0 },
+                { "matrix": [0, 1], "y": 0, "x": 1 },
+                { "matrix": [0, 2], "y": 0, "x": 2 },
+                { "matrix": [0, 3], "y": 0, "x": 3 },
+                { "matrix": [0, 4], "y": 0, "x": 4 },
+                { "matrix": [0, 5], "y": 0, "x": 5 },
+                { "matrix": [4, 5], "y": 0, "x": 8 },
+                { "matrix": [4, 4], "y": 0, "x": 9 },
+                { "matrix": [4, 3], "y": 0, "x": 10 },
+                { "matrix": [4, 2], "y": 0, "x": 11 },
+                { "matrix": [4, 1], "y": 0, "x": 12 },
+                { "matrix": [4, 0], "y": 0, "x": 13 },
+
+                { "matrix": [1, 0], "y": 1, "x": 0 },
+                { "matrix": [1, 1], "y": 1, "x": 1 },
+                { "matrix": [1, 2], "y": 1, "x": 2 },
+                { "matrix": [1, 3], "y": 1, "x": 3 },
+                { "matrix": [1, 4], "y": 1, "x": 4 },
+                { "matrix": [1, 5], "y": 1, "x": 5 },
+                { "matrix": [5, 5], "y": 1, "x": 8 },
+                { "matrix": [5, 4], "y": 1, "x": 9 },
+                { "matrix": [5, 3], "y": 1, "x": 10 },
+                { "matrix": [5, 2], "y": 1, "x": 11 },
+                { "matrix": [5, 1], "y": 1, "x": 12 },
+                { "matrix": [5, 0], "y": 1, "x": 13 },
+
+                { "matrix": [3, 3], "y": 3, "x": 3 },
+                { "matrix": [3, 4], "y": 3, "x": 4 },
+                { "matrix": [3, 5], "y": 3, "x": 5 },
+                { "matrix": [7, 5], "y": 3, "x": 8 },
+                { "matrix": [7, 4], "y": 3, "x": 9 },
+                { "matrix": [7, 3], "y": 3, "x": 10 }
+            ]
+        }
+    }
+}
diff --git a/keyboards/chord/zero/keymaps/default/keymap.c b/keyboards/chord/zero/keymaps/default/keymap.c
new file mode 100644
index 0000000000..a394893e1b
--- /dev/null
+++ b/keyboards/chord/zero/keymaps/default/keymap.c
@@ -0,0 +1,25 @@
+// Copyright (c) 2022 Simon Hengel <sol@typeful.net>
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+#include "keymap_steno.h"
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    [0] = LAYOUT_zero(
+        STN_FN,  STN_S1,  STN_TL,  STN_PL,  STN_HL,  STN_ST1,          STN_ST3, STN_FR,  STN_PR,  STN_LR,  STN_TR,  STN_DR,
+        STN_PWR, STN_S2,  STN_KL,  STN_WL,  STN_RL,  STN_ST2,          STN_ST4, STN_RR,  STN_BR,  STN_GR,  STN_SR,  STN_ZR,
+                                   STN_N1,  STN_A,   STN_O,            STN_E,   STN_U,   STN_N7
+    )
+};
+
+const uint16_t PROGMEM bootloader_combo[] = {
+    keymaps[0][0][0],           keymaps[0][4][0],
+    keymaps[0][1][0],           keymaps[0][5][0],
+        keymaps[0][3][3],   keymaps[0][7][3]
+, COMBO_END };
+
+combo_t key_combos[] = {
+    COMBO(bootloader_combo, QK_BOOTLOADER),
+};
+
+uint16_t COMBO_LEN = sizeof(key_combos) / sizeof(key_combos[0]);
diff --git a/keyboards/chord/zero/keymaps/default/rules.mk b/keyboards/chord/zero/keymaps/default/rules.mk
new file mode 100644
index 0000000000..ab1e438182
--- /dev/null
+++ b/keyboards/chord/zero/keymaps/default/rules.mk
@@ -0,0 +1 @@
+COMBO_ENABLE = yes
diff --git a/keyboards/chord/zero/readme.md b/keyboards/chord/zero/readme.md
new file mode 100644
index 0000000000..51e3f2ce10
--- /dev/null
+++ b/keyboards/chord/zero/readme.md
@@ -0,0 +1,37 @@
+# CHORD ZERO Stenographic Keyboard
+
+![CHORD ZERO](https://i.imgur.com/aS2MPQ2h.jpg)
+
+CHORD ZERO is a stenographic keyboard that can be used with
+[Plover](https://www.openstenoproject.org/plover/) or any other application
+that supports the [TX
+Bolt](https://docs.qmk.fm/#/feature_stenography?id=tx-bolt) or
+[GeminiPR](https://docs.qmk.fm/#/feature_stenography?id=geminipr) protocol.
+
+* Keyboard Maintainer: [Simon Hengel](https://github.com/sol)
+* Hardware Supported: REV 0, REV 1
+* Hardware Availability: https://github.com/sol/chord-zero#readme
+
+Make example for this keyboard (after setting up your build environment):
+
+    make chord/zero:default
+
+or
+
+    qmk compile -kb chord/zero -km default
+
+This will generate `chord_zero_default.uf2`.
+
+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).
+
+## Bootloader
+
+Enter the bootloader in 3 ways:
+
+* **Reset key combo**: Press the six keys at the outer columns on each side of the keyboard simultaneously while it is plugged in 
+* **Bootmagic reset**: Hold down the top left key and plug in the keyboard
+* **Physical reset button**: Press the button on the back of the PCB and plug in the keyboard
+
+Once the keyboard is in bootloader mode you can mount it as a USB mass storage
+device and copy the firmware (the file `chord_zero_default.uf2`) onto it.  Once
+copying is completed the keyboard will reboot automatically.
diff --git a/keyboards/chord/zero/rules.mk b/keyboards/chord/zero/rules.mk
new file mode 100644
index 0000000000..6e7633bfe0
--- /dev/null
+++ b/keyboards/chord/zero/rules.mk
@@ -0,0 +1 @@
+# This file intentionally left blank