From 172c3496756fb5468c778c2536b4334f25eb883b Mon Sep 17 00:00:00 2001
From: Philip <68480429+iliorik@users.noreply.github.com>
Date: Thu, 2 Jan 2025 14:50:43 +0300
Subject: [PATCH] [Keyboard] Add handwired/dactyl_manuform/5x8 (#24726)

* add handwired/dactyl_manuform/5x8 config

* add keymap scheme

* Update keymap.c

* Update keyboard.json

* Update keyboard.json

* fix and compile worked configs

* Update readme.md

* Update readme.md

* Update readme.md

* add dynamic macros support

* change key sets on first workday/add right2left layer

* Update keyboard.json

* Update keymap.c

* move license header to top keymap.c

* Update keyboard.json

* I rewrote the layout so that the halves are not stacked.

* I rewrote the layout so that the halves are not stacked (keymap.c)

* change "serial pin" syntactic

change
"soft_serial_pin": "D0"
to
"serial": {
            "pin": "D0"
        }

* fix KC_BSPC and KC_SPC on right keyboard

* Update readme.md

* Update keymap.c

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Update keymap.c

Co-authored-by: Drashna Jaelre <drashna@live.com>

---------

Co-authored-by: skandiPC <slinkinfs@yandex.ru>
Co-authored-by: iliorik-ph <140731596+iliorik-ph@users.noreply.github.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
---
 .../dactyl_manuform/5x8/keyboard.json         | 137 ++++++++++++++++++
 .../5x8/keymaps/default/keymap.c              |  84 +++++++++++
 .../5x8/keymaps/default/rules.mk              |   1 +
 .../handwired/dactyl_manuform/5x8/readme.md   |  25 ++++
 4 files changed, 247 insertions(+)
 create mode 100644 keyboards/handwired/dactyl_manuform/5x8/keyboard.json
 create mode 100644 keyboards/handwired/dactyl_manuform/5x8/keymaps/default/keymap.c
 create mode 100644 keyboards/handwired/dactyl_manuform/5x8/keymaps/default/rules.mk
 create mode 100644 keyboards/handwired/dactyl_manuform/5x8/readme.md

diff --git a/keyboards/handwired/dactyl_manuform/5x8/keyboard.json b/keyboards/handwired/dactyl_manuform/5x8/keyboard.json
new file mode 100644
index 0000000000..24ac4924ac
--- /dev/null
+++ b/keyboards/handwired/dactyl_manuform/5x8/keyboard.json
@@ -0,0 +1,137 @@
+{
+    "keyboard_name": "Dactyl-Manuform (5x8)",
+    "manufacturer": "tshort",
+    "url": "",
+    "maintainer": "qmk",
+    "usb": {
+        "vid": "0x444D",
+        "pid": "0x3537",
+        "device_version": "0.0.1"
+    },
+    "features": {
+        "bootmagic": true,
+        "extrakey": true,
+        "mousekey": true,
+    },
+    "qmk": {
+        "locking": {
+            "enabled": true,
+            "resync": true
+        }
+    },
+    "matrix_pins": {
+        "cols": ["B6", "B2", "B3", "B1", "F7", "F6", "F5", "F4"],
+        "rows": ["D4", "C6", "D7", "E6", "B4", "B5"]
+    },
+    "diode_direction": "COL2ROW",
+    "split": {
+        "enabled": true,
+        "serial": {
+            "pin": "D0"
+        }
+    },
+    "development_board": "promicro",
+    "layouts": {
+        "LAYOUT_5x8": {
+            "layout": [
+                {"matrix": [0, 0], "x": 0, "y": 0.5},
+                {"matrix": [0, 1], "x": 1, "y": 0.5},
+                {"matrix": [0, 2], "x": 2, "y": 0.5},
+                {"matrix": [0, 3], "x": 3, "y": 0},
+                {"matrix": [0, 4], "x": 4, "y": 0},
+                {"matrix": [0, 5], "x": 5, "y": 0},
+                {"matrix": [0, 6], "x": 6, "y": 0},
+                {"matrix": [0, 7], "x": 7, "y": 0},
+
+                {"matrix": [6, 7], "x": 17, "y": 0.5},
+                {"matrix": [6, 6], "x": 16, "y": 0.5},
+                {"matrix": [6, 5], "x": 15, "y": 0.5},
+                {"matrix": [6, 4], "x": 14, "y": 0},
+                {"matrix": [6, 3], "x": 13, "y": 0},
+                {"matrix": [6, 2], "x": 12, "y": 0},
+                {"matrix": [6, 1], "x": 11, "y": 0},
+                {"matrix": [6, 0], "x": 10, "y": 0},
+
+                {"matrix": [1, 0], "x": 0, "y": 1.5},
+                {"matrix": [1, 1], "x": 1, "y": 1.5},
+                {"matrix": [1, 2], "x": 2, "y": 1.5},
+                {"matrix": [1, 3], "x": 3, "y": 1},
+                {"matrix": [1, 4], "x": 4, "y": 1},
+                {"matrix": [1, 5], "x": 5, "y": 1},
+                {"matrix": [1, 6], "x": 6, "y": 1},
+                {"matrix": [1, 7], "x": 7, "y": 1},
+
+                {"matrix": [7, 7], "x": 17, "y": 1.5},
+                {"matrix": [7, 6], "x": 16, "y": 1.5},
+                {"matrix": [7, 5], "x": 15, "y": 1.5},
+                {"matrix": [7, 4], "x": 14, "y": 1},
+                {"matrix": [7, 3], "x": 13, "y": 1},
+                {"matrix": [7, 2], "x": 12, "y": 1},
+                {"matrix": [7, 1], "x": 11, "y": 1},
+                {"matrix": [7, 0], "x": 10, "y": 1},
+
+                {"matrix": [2, 0], "x": 0, "y": 2.5},
+                {"matrix": [2, 1], "x": 1, "y": 2.5},
+                {"matrix": [2, 2], "x": 2, "y": 2.5},
+                {"matrix": [2, 3], "x": 3, "y": 2},
+                {"matrix": [2, 4], "x": 4, "y": 2},
+                {"matrix": [2, 5], "x": 5, "y": 2},
+                {"matrix": [2, 6], "x": 6, "y": 2},
+                {"matrix": [2, 7], "x": 7, "y": 2},
+
+                {"matrix": [8, 7], "x": 17, "y": 2.5},
+                {"matrix": [8, 6], "x": 16, "y": 2.5},
+                {"matrix": [8, 5], "x": 15, "y": 2.5},
+                {"matrix": [8, 4], "x": 14, "y": 2},
+                {"matrix": [8, 3], "x": 13, "y": 2},
+                {"matrix": [8, 2], "x": 12, "y": 2},
+                {"matrix": [8, 1], "x": 11, "y": 2},
+                {"matrix": [8, 0], "x": 10, "y": 2},
+
+                {"matrix": [3, 0], "x": 0, "y": 3.5},
+                {"matrix": [3, 1], "x": 1, "y": 3.5},
+                {"matrix": [3, 2], "x": 2, "y": 3.5},
+                {"matrix": [3, 3], "x": 3, "y": 3},
+                {"matrix": [3, 4], "x": 4, "y": 3},
+                {"matrix": [3, 5], "x": 5, "y": 3},
+                {"matrix": [3, 6], "x": 6, "y": 3},
+
+                {"matrix": [9, 6], "x": 17, "y": 3.5},
+                {"matrix": [9, 5], "x": 16, "y": 3.5},
+                {"matrix": [9, 4], "x": 15, "y": 3.5},
+                {"matrix": [9, 3], "x": 14, "y": 3},
+                {"matrix": [9, 2], "x": 13, "y": 3},
+                {"matrix": [9, 1], "x": 12, "y": 3},
+                {"matrix": [9, 0], "x": 11, "y": 3},
+
+                {"matrix": [4, 1], "x": 1, "y": 4.5},
+                {"matrix": [4, 2], "x": 2, "y": 4.5},
+                {"matrix": [4, 3], "x": 3, "y": 4},
+                {"matrix": [4, 4], "x": 4, "y": 4},
+
+                {"matrix": [10, 4], "x": 14, "y": 4},
+                {"matrix": [10, 3], "x": 13, "y": 4},
+                {"matrix": [10, 2], "x": 12, "y": 5},
+                {"matrix": [10, 1], "x": 11, "y": 5},
+
+                {"matrix": [4, 5], "x": 4.5, "y": 5},
+                {"matrix": [4, 6], "x": 5.5, "y": 5},
+
+                {"matrix": [10, 6], "x": 14.5, "y": 4.5},
+                {"matrix": [10, 5], "x": 15.5, "y": 4.5},
+
+                {"matrix": [5, 5], "x": 5, "y": 6},
+                {"matrix": [5, 6], "x": 6, "y": 6},
+
+                {"matrix": [11, 6], "x": 12, "y": 6},
+                {"matrix": [11, 5], "x": 11, "y": 6},
+
+                {"matrix": [5, 3], "x": 5, "y": 7},
+                {"matrix": [5, 4], "x": 6, "y": 7},
+
+                {"matrix": [11, 4], "x": 12, "y": 7},
+                {"matrix": [11, 3], "x": 11, "y": 7}
+            ]
+        }
+    }
+}
diff --git a/keyboards/handwired/dactyl_manuform/5x8/keymaps/default/keymap.c b/keyboards/handwired/dactyl_manuform/5x8/keymaps/default/keymap.c
new file mode 100644
index 0000000000..d038173db0
--- /dev/null
+++ b/keyboards/handwired/dactyl_manuform/5x8/keymaps/default/keymap.c
@@ -0,0 +1,84 @@
+/* Copyright 2024 Philip Slinkin (s.philya@gmail.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 {
+    _QWERTY,
+    _RIGHT2LEFT
+};
+
+/* Base (qwerty)
+     * ,-------------------------------------------------------,   ,-------------------------------------------------------,
+     * |  Esc |   `  |   1  |   2  |   3  |   4  |   5  |   6  |   |   7  |   8  |   9  |   0  |   -  |   =  |   \  |  BS  |
+     * |------+------+------+------+------+------+------+------|   |------+------+------+------+------+------+------+------|
+     * |M_RSTP|  Tab |   q  |   w  |   e  |   r  |   t  |QKBOOT|   |  F8  |   y  |   u  |   i  |   o  |   p  |   [  |   ]  |
+     * |------+------+------+------+------+------+------+------|   |------+------+------+------+------+------+------+------|
+     * |M_REC1| Caps |   a  |   s  |   d  |   f  |   g  |  F7  |   |  F9  |   h  |   j  |   k  |   l  |   ;  |   "  |ENTER |
+     * |------+------+------+------+------+------+------+------'   '------+------+------+------+------+------+------+------|
+     * |M_REC2| Shift|   z  |   x  |   c  |   v  |   b  |                 |   n  |   m  |   ,  |   .  |   /  |Shift | Ctrl |
+     * '------+------+------+------+------+------+------'                 '------+------+------+------+------+------+------'
+     *        | Ctrl | Wint |  Alt | INS  |                                             |  Up  | Down | Left | Right|
+     *        '------+------+------+------+------,                               ,------+------+------+------+------'
+     *                             | TT(1)|SPACE |                               | SPACE|  BS  |
+     *                             '------+------+------'                 ,------+------+------'
+     *                                    | ESC  |ENTER |                 | HOME | END  |
+     *                                    '------+------'                 '------+------'
+     *                                    |  DEL |  F2  |                 | PGUP | PGDN |
+     *                                    '------+------'                 '------+------'
+     */
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    [_QWERTY] = LAYOUT_5x8(
+        KC_ESC,    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_BSLS,   KC_BSPC,
+        DM_RSTP,   KC_TAB,  KC_Q,    KC_W,    KC_E,   KC_R,   KC_T,   QK_BOOT,       KC_F8,   KC_Y,    KC_U,    KC_I,     KC_O,     KC_P,     KC_LBRC,   KC_RBRC,
+        DM_REC1,   KC_CAPS, KC_A,    KC_S,    KC_D,   KC_F,   KC_G,   KC_F7,         KC_F9,   KC_H,    KC_J,    KC_K,     KC_L,     KC_SCLN,  KC_QUOT,   KC_ENT,
+        DM_REC2,   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_RCTL,
+                   KC_LCTL, KC_LGUI, KC_LALT, KC_INS,                                                  KC_UP,    KC_DOWN, KC_LEFT,  KC_RGHT,
+                                              TT(1), KC_SPC,                                  KC_SPC,  KC_BSPC,
+                                                     KC_ESC, KC_ENT,                 KC_HOME, KC_END,
+                                                     KC_DEL, KC_F2,                  KC_PGUP, KC_PGDN
+    ),
+/* Base (right to left on hold button)
+     * ,-------------------------------------------------------,   ,-------------------------------------------------------,
+     * |  BS  |   \  |   =  |   -  |   0  |   9  |   8  |   7  |   |      |      |      |      |      |      |      |      |
+     * |------+------+------+------+------+------+------+------|   |------+------+------+------+------+------+------+------|
+     * |   [  |   ]  |   p  |   o  |   i  |   u  |   y  |QKBOOT|   |      |      |      |      |      |      |      |      |
+     * |------+------+------+------+------+------+------+------|   |------+------+------+------+------+------+------+------|
+     * |M_PLY1|   "  |   ;  |   l  |   k  |   j  |   h  |PRSCRN|   |      |      | Left | Down |  Up  | Right|      |ENTER |
+     * |------+------+------+------+------+------+------+------'   '------+------+------+------+------+------+------+------|
+     * |M_PLY2|MShift|   /  |   .  |   ,  |   m  |   n  |                 |      |      |      |      |      |      |      |
+     * |------+------+------+------+------+------+------'                 '------+------+------+------+------+------+------'
+     *        |MCtrl | MAlt |  DEL |  BS  |                                             |      |      |      |      |
+     *        '------+------+------+------+------,                               ,------+------+------+------+------'
+     *                             |      |SPACE |                               | SPACE|  BS  |
+     *                             '------+------+------'                 ,------+------+------'
+     *                                    | END  |ENTER |                 | HOME | END  |
+     *                                    '------+------'                 '------+------'
+     *                                    | PGDN | PGUP |                 | PGUP | PGDN |
+     *                                    '------+------'                 '------+------'
+     */
+
+    [_RIGHT2LEFT] = LAYOUT_5x8(
+        KC_BSPC,   KC_BSLS,  KC_EQL,    KC_MINS, KC_0,   KC_9,   KC_8,   KC_7,         KC_NO,    KC_NO,    KC_NO,    KC_NO,   KC_NO,      KC_NO,   KC_NO,   KC_BSPC,
+        KC_RBRC,   KC_LBRC,  KC_P,      KC_O,    KC_I,   KC_U,   KC_Y,   QK_BOOT,      KC_NO,    KC_NO,    KC_NO,    KC_NO,   KC_NO,      KC_NO,   KC_NO,   KC_NO,
+        DM_PLY1,   KC_QUOT,  KC_SCLN,   KC_L,    KC_K,   KC_J,   KC_H,   KC_PSCR,      KC_NO,    KC_LEFT,  KC_DOWN,  KC_UP,   KC_RIGHT,   KC_SCLN, KC_NO,   KC_ENT,
+        DM_PLY2,  OSM(MOD_LSFT), KC_SLSH, KC_DOT, KC_COMM, KC_M, KC_N,                 KC_NO,    KC_NO,    KC_NO,    KC_NO,   KC_NO,      KC_NO,   KC_NO,
+                   OSM(MOD_LCTL), OSM(MOD_LALT), KC_DEL, KC_BSPC,                                          KC_NO,    KC_NO,   KC_NO,      KC_NO,
+                                                         KC_NO,  KC_SPC,                         KC_SPC,  KC_BSPC,
+                                                                 KC_ESC, KC_ENT,       KC_HOME,  KC_END,
+                                                                 KC_DEL, KC_F2,        KC_PGUP,  KC_PGDN
+    ),
+};
diff --git a/keyboards/handwired/dactyl_manuform/5x8/keymaps/default/rules.mk b/keyboards/handwired/dactyl_manuform/5x8/keymaps/default/rules.mk
new file mode 100644
index 0000000000..9e6797ed30
--- /dev/null
+++ b/keyboards/handwired/dactyl_manuform/5x8/keymaps/default/rules.mk
@@ -0,0 +1 @@
+DYNAMIC_MACRO_ENABLE = yes
diff --git a/keyboards/handwired/dactyl_manuform/5x8/readme.md b/keyboards/handwired/dactyl_manuform/5x8/readme.md
new file mode 100644
index 0000000000..0ada7e92b6
--- /dev/null
+++ b/keyboards/handwired/dactyl_manuform/5x8/readme.md
@@ -0,0 +1,25 @@
+# handwired/dactyl_manuform/5x8
+
+![Dactyl_manuform 5x8](https://i.imgur.com/DtawD9r.jpeg)
+
+* Keyboard Maintainer: [iliorik](https://github.com/iliorik)
+
+I made this keyboard so that the buttons on the right side of the right half would replicate the standard keyboard.
+I put macros on the left buttons of the left side keyboard for rec and play keypresses
+
+Make example for this keyboard (after setting up your build environment):
+
+    make handwired/dactyl_manuform/5x8:default
+
+Flashing example for this keyboard:
+
+    make handwired/dactyl_manuform/5x8:default:flash
+
+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 2 ways:
+
+* **Keycode in layout**: Press the key mapped to `QK_BOOT`
+* **Reset pro micro**: Connect RST and GND pins on plate