From 896f38c52cf720473df0c6687581852adf26d99f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20Chac=C3=B3n?= <alhenx@gmail.com>
Date: Wed, 29 Mar 2023 20:47:14 +0200
Subject: [PATCH] [Keyboard] Add alhenkb macropad (#20123)

---
 keyboards/alhenkb/macropad5x4/info.json       | 73 +++++++++++++++++++
 .../macropad5x4/keymaps/default/keymap.c      | 27 +++++++
 .../macropad5x4/keymaps/numpad/keymap.c       | 48 ++++++++++++
 .../alhenkb/macropad5x4/keymaps/via/keymap.c  | 27 +++++++
 .../alhenkb/macropad5x4/keymaps/via/rules.mk  |  1 +
 keyboards/alhenkb/macropad5x4/readme.md       | 41 +++++++++++
 keyboards/alhenkb/macropad5x4/rules.mk        |  1 +
 7 files changed, 218 insertions(+)
 create mode 100644 keyboards/alhenkb/macropad5x4/info.json
 create mode 100644 keyboards/alhenkb/macropad5x4/keymaps/default/keymap.c
 create mode 100644 keyboards/alhenkb/macropad5x4/keymaps/numpad/keymap.c
 create mode 100644 keyboards/alhenkb/macropad5x4/keymaps/via/keymap.c
 create mode 100644 keyboards/alhenkb/macropad5x4/keymaps/via/rules.mk
 create mode 100644 keyboards/alhenkb/macropad5x4/readme.md
 create mode 100644 keyboards/alhenkb/macropad5x4/rules.mk

diff --git a/keyboards/alhenkb/macropad5x4/info.json b/keyboards/alhenkb/macropad5x4/info.json
new file mode 100644
index 0000000000..787b19877e
--- /dev/null
+++ b/keyboards/alhenkb/macropad5x4/info.json
@@ -0,0 +1,73 @@
+{
+    "manufacturer": "AlhenKB",
+    "keyboard_name": "Macropad 5x4",
+    "maintainer": "alhenx",
+    "development_board": "promicro",
+    "diode_direction": "COL2ROW",
+    "features": {
+        "bootmagic": true,
+        "command": false,
+        "console": false,
+        "extrakey": true,
+        "mousekey": true,
+        "nkro": true
+    },
+    "matrix_pins": {
+        "rows": ["F5", "F7", "B3", "B6", "B5"],
+        "cols": ["F4", "F6", "B1", "B2"]
+    },
+    "url": "",
+    "usb": {
+        "device_version": "1.0.0",
+        "pid": "0x0001",
+        "vid": "0x6178"
+    },
+    "community_layouts": ["ortho_5x4", "numpad_5x4"],
+    "layouts": {
+        "LAYOUT_ortho_5x4": {
+            "layout": [
+                {"label": "K00 (F5,F4)", "matrix": [0, 0], "x": 0, "y": 0},
+                {"label": "K01 (F5,F6)", "matrix": [0, 1], "x": 1, "y": 0},
+                {"label": "K02 (F5,B1)", "matrix": [0, 2], "x": 2, "y": 0},
+                {"label": "K03 (F5,B2)", "matrix": [0, 3], "x": 3, "y": 0},
+                {"label": "K10 (F7,F4)", "matrix": [1, 0], "x": 0, "y": 1},
+                {"label": "K11 (F7,F6)", "matrix": [1, 1], "x": 1, "y": 1},
+                {"label": "K12 (F7,B1)", "matrix": [1, 2], "x": 2, "y": 1},
+                {"label": "K12 (F7,B2)", "matrix": [1, 3], "x": 3, "y": 1},
+                {"label": "K20 (B3,F4)", "matrix": [2, 0], "x": 0, "y": 2},
+                {"label": "K21 (B3,F6)", "matrix": [2, 1], "x": 1, "y": 2},
+                {"label": "K22 (B3,B1)", "matrix": [2, 2], "x": 2, "y": 2},
+                {"label": "K23 (B3,B2)", "matrix": [2, 3], "x": 3, "y": 1},
+                {"label": "K30 (B6,F4)", "matrix": [3, 0], "x": 0, "y": 3},
+                {"label": "K31 (B6,F6)", "matrix": [3, 1], "x": 1, "y": 3},
+                {"label": "K32 (B6,B1)", "matrix": [3, 2], "x": 2, "y": 3},
+                {"label": "K32 (B6,B2)", "matrix": [3, 3], "x": 3, "y": 3},
+                {"label": "K40 (B5,F4)", "matrix": [4, 0], "x": 0, "y": 4},
+                {"label": "K42 (B5,F6)", "matrix": [4, 1], "x": 1, "y": 4},
+                {"label": "K42 (B5,B1)", "matrix": [4, 2], "x": 2, "y": 4},
+                {"label": "K43 (B5,B2)", "matrix": [4, 3], "x": 3, "y": 3}                
+            ]
+        },
+        "LAYOUT_numpad_5x4": {
+            "layout": [
+                {"label": "K00 (F5,F4)", "matrix": [0, 0], "x": 0, "y": 0},
+                {"label": "K01 (F5,F6)", "matrix": [0, 1], "x": 1, "y": 0},
+                {"label": "K02 (F5,B1)", "matrix": [0, 2], "x": 2, "y": 0},
+                {"label": "K03 (F5,B2)", "matrix": [0, 3], "x": 3, "y": 0},
+                {"label": "K10 (F7,F4)", "matrix": [1, 0], "x": 0, "y": 1},
+                {"label": "K11 (F7,F6)", "matrix": [1, 1], "x": 1, "y": 1},
+                {"label": "K12 (F7,B1)", "matrix": [1, 2], "x": 2, "y": 1},
+                {"label": "K20 (B3,F4)", "matrix": [2, 0], "x": 0, "y": 2},
+                {"label": "K21 (B3,F6)", "matrix": [2, 1], "x": 1, "y": 2},
+                {"label": "K22 (B3,B1)", "matrix": [2, 2], "x": 2, "y": 2},
+                {"label": "K23 (B3,B2)", "matrix": [2, 3], "x": 3, "y": 1, "h": 2},
+                {"label": "K30 (B6,F4)", "matrix": [3, 0], "x": 0, "y": 3},
+                {"label": "K31 (B6,F6)", "matrix": [3, 1], "x": 1, "y": 3},
+                {"label": "K32 (B6,B1)", "matrix": [3, 2], "x": 2, "y": 3},
+                {"label": "K40 (B5,F4)", "matrix": [4, 0], "x": 0, "y": 4, "w": 2},
+                {"label": "K42 (B5,B1)", "matrix": [4, 2], "x": 2, "y": 4}
+                {"label": "K43 (B5,B2)", "matrix": [4, 3], "x": 3, "y": 3, "h": 2},
+            ]
+        }
+    }
+}
diff --git a/keyboards/alhenkb/macropad5x4/keymaps/default/keymap.c b/keyboards/alhenkb/macropad5x4/keymaps/default/keymap.c
new file mode 100644
index 0000000000..12a878346e
--- /dev/null
+++ b/keyboards/alhenkb/macropad5x4/keymaps/default/keymap.c
@@ -0,0 +1,27 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /*
+     * ┌───┬───┬───┬───┐
+     * │ 1 │ 2 │ 3 │ 4 │
+     * ├───┼───┼───┼───┤
+     * │ 5 │ 6 │ 7 │ 8 │
+     * ├───┼───┼───┼───┤
+     * │ Q │ W │ E │ R │
+     * ├───┼───┼───┼───┤
+     * │ A │ S │ D │ F │
+     * ├───┼───┼───┼───┤
+     * │ Z │ X │ C │ V │
+     * └───────┴───┴───┘
+     */
+    [0] = LAYOUT_ortho_5x4(
+        KC_P1,   KC_P2,   KC_P3,   KC_P4,
+        KC_P5,   KC_P6,   KC_P7,   KC_P8,
+        KC_Q,    KC_W,    KC_E,    KC_R,
+        KC_A,    KC_S,    KC_D,    KC_F,
+        KC_Z,    KC_X,    KC_C,    KC_V
+    ),
+};
diff --git a/keyboards/alhenkb/macropad5x4/keymaps/numpad/keymap.c b/keyboards/alhenkb/macropad5x4/keymaps/numpad/keymap.c
new file mode 100644
index 0000000000..7a1e287e38
--- /dev/null
+++ b/keyboards/alhenkb/macropad5x4/keymaps/numpad/keymap.c
@@ -0,0 +1,48 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /*
+     * ┌───┬───┬───┬───┐
+     * │TG1│ / │ * │ - │
+     * ├───┼───┼───┼───┤
+     * │ 7 │ 8 │ 9 │   │
+     * ├───┼───┼───┤ + │
+     * │ 4 │ 5 │ 6 │   │
+     * ├───┼───┼───┼───┤
+     * │ 1 │ 2 │ 3 │   │
+     * ├───┴───┼───┤Ent│
+     * │   0   │ . │   │
+     * └───────┴───┴───┘
+     */
+    [0] = LAYOUT_numpad_5x4(
+        TG(1),   KC_PSLS, KC_PAST, KC_PMNS,
+        KC_P7,   KC_P8,   KC_P9,   
+        KC_P4,   KC_P5,   KC_P6,   KC_PPLS,
+        KC_P1,   KC_P2,   KC_P3,   
+        KC_P0,     KC_PDOT,        KC_PENT
+    ),
+
+    /*
+     * ┌───┬───┬───┬───┐
+     * │TG1│ / │ * │ - │
+     * ┌───┬───┬───┐───┤
+     * │Hom│ ↑ │PgU│   │
+     * ├───┼───┼───┤ + │
+     * │ ← │   │ → │   │
+     * ├───┼───┼───┤───┤
+     * │End│ ↓ │PgD│   │
+     * ├───┴───┼───┤Ent│
+     * │Insert │Del│   │
+     * └───────┴───┘───┘
+     */
+    [1] = LAYOUT_numpad_5x4(
+        _______, _______, _______, _______,
+        KC_HOME, KC_UP,   KC_PGUP, 
+        KC_LEFT, XXXXXXX, KC_RGHT, _______,
+        KC_END,  KC_DOWN, KC_PGDN,  
+        KC_INS,           KC_DEL,  _______
+    )
+};
diff --git a/keyboards/alhenkb/macropad5x4/keymaps/via/keymap.c b/keyboards/alhenkb/macropad5x4/keymaps/via/keymap.c
new file mode 100644
index 0000000000..12a878346e
--- /dev/null
+++ b/keyboards/alhenkb/macropad5x4/keymaps/via/keymap.c
@@ -0,0 +1,27 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /*
+     * ┌───┬───┬───┬───┐
+     * │ 1 │ 2 │ 3 │ 4 │
+     * ├───┼───┼───┼───┤
+     * │ 5 │ 6 │ 7 │ 8 │
+     * ├───┼───┼───┼───┤
+     * │ Q │ W │ E │ R │
+     * ├───┼───┼───┼───┤
+     * │ A │ S │ D │ F │
+     * ├───┼───┼───┼───┤
+     * │ Z │ X │ C │ V │
+     * └───────┴───┴───┘
+     */
+    [0] = LAYOUT_ortho_5x4(
+        KC_P1,   KC_P2,   KC_P3,   KC_P4,
+        KC_P5,   KC_P6,   KC_P7,   KC_P8,
+        KC_Q,    KC_W,    KC_E,    KC_R,
+        KC_A,    KC_S,    KC_D,    KC_F,
+        KC_Z,    KC_X,    KC_C,    KC_V
+    ),
+};
diff --git a/keyboards/alhenkb/macropad5x4/keymaps/via/rules.mk b/keyboards/alhenkb/macropad5x4/keymaps/via/rules.mk
new file mode 100644
index 0000000000..036bd6d1c3
--- /dev/null
+++ b/keyboards/alhenkb/macropad5x4/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
\ No newline at end of file
diff --git a/keyboards/alhenkb/macropad5x4/readme.md b/keyboards/alhenkb/macropad5x4/readme.md
new file mode 100644
index 0000000000..f708550f8a
--- /dev/null
+++ b/keyboards/alhenkb/macropad5x4/readme.md
@@ -0,0 +1,41 @@
+# AlhenKB - Macropad 5x4 and Numpad
+
+![Imgur Image](https://imgur.com/t7Zi2w3h.jpg) 
+![Imgur Image](https://i.imgur.com/5xlKJlBh.jpg)
+
+
+A macropad 5x4 for MerryPCB.
+
+* Keyboard Maintainer: [Alhen](https://github.com/alhenx)
+* Hardware Supported: MerryPCB
+
+Make example for this keyboard (after setting up your build environment):
+
+Macropad:
+
+    make alhenkb/macropad5x4:default
+    
+Numpad:
+
+    make alhenkb/macropad5x4:numpad
+
+Flashing example for this keyboard:
+
+Macropad:
+
+    make alhenkb/macropad5x4:default:flash
+    
+
+Numpad:
+
+    make alhenkb/macropad5x4:numpad: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 3 ways:
+
+* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
+* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
+* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
diff --git a/keyboards/alhenkb/macropad5x4/rules.mk b/keyboards/alhenkb/macropad5x4/rules.mk
new file mode 100644
index 0000000000..6e7633bfe0
--- /dev/null
+++ b/keyboards/alhenkb/macropad5x4/rules.mk
@@ -0,0 +1 @@
+# This file intentionally left blank