From e592a7da0017a57a476debee2355f8dbb5d81349 Mon Sep 17 00:00:00 2001
From: Nibell <Nibell91@gmail.com>
Date: Mon, 2 Dec 2024 16:00:29 +0100
Subject: [PATCH]  [Keyboard] Added nibell micropad4x4 (#24662)

* feat: added nibell micropad4x4

* chore: updated readme

* chore: updated keymap

* feat: added layers

* chore: added bootloader doc

* Added layers

* changed RSHIFT and RCTRL

* Update keyboards/nibell/micropad4x4/keyboard.json

Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>

* Update keyboards/nibell/micropad4x4/readme.md

---------

Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
Co-authored-by: jack <jack@pngu.org>
---
 keyboards/nibell/micropad4x4/keyboard.json    | 50 +++++++++++
 .../micropad4x4/keymaps/default/keymap.c      | 90 +++++++++++++++++++
 keyboards/nibell/micropad4x4/readme.md        | 26 ++++++
 3 files changed, 166 insertions(+)
 create mode 100644 keyboards/nibell/micropad4x4/keyboard.json
 create mode 100644 keyboards/nibell/micropad4x4/keymaps/default/keymap.c
 create mode 100644 keyboards/nibell/micropad4x4/readme.md

diff --git a/keyboards/nibell/micropad4x4/keyboard.json b/keyboards/nibell/micropad4x4/keyboard.json
new file mode 100644
index 0000000000..b992f501cf
--- /dev/null
+++ b/keyboards/nibell/micropad4x4/keyboard.json
@@ -0,0 +1,50 @@
+{
+    "manufacturer": "nibell",
+    "keyboard_name": "nibell/micropad4x4",
+    "maintainer": "Linus Nibell",
+    "bootloader": "rp2040",
+    "diode_direction": "COL2ROW",
+    "features": {
+        "bootmagic": true,
+        "extrakey": true,
+        "mousekey": true,
+        "nkro": true
+    },
+    "matrix_pins": {
+        "cols": ["GP2", "GP3", "GP4", "GP5"],
+        "rows": ["GP10", "GP11", "GP12", "GP13"]
+    },
+    "processor": "RP2040",
+    "url": "",
+    "usb": {
+        "device_version": "1.0.0",
+        "pid": "0xFEED",
+        "vid": "0x4C4E"
+    },
+    "community_layouts": ["ortho_4x4"],
+    "layouts": {
+        "LAYOUT_ortho_4x4": {
+            "layout": [
+                {"matrix": [0, 0], "x": 0, "y": 0},
+                {"matrix": [0, 1], "x": 1, "y": 0},
+                {"matrix": [0, 2], "x": 2, "y": 0},
+                {"matrix": [0, 3], "x": 3, "y": 0},
+
+                {"matrix": [1, 0], "x": 0, "y": 1},
+                {"matrix": [1, 1], "x": 1, "y": 1},
+                {"matrix": [1, 2], "x": 2, "y": 1},
+                {"matrix": [1, 3], "x": 3, "y": 1},
+
+                {"matrix": [2, 0], "x": 0, "y": 2},
+                {"matrix": [2, 1], "x": 1, "y": 2},
+                {"matrix": [2, 2], "x": 2, "y": 2},
+                {"matrix": [2, 3], "x": 3, "y": 2},
+
+                {"matrix": [3, 0], "x": 0, "y": 3},
+                {"matrix": [3, 1], "x": 1, "y": 3},
+                {"matrix": [3, 2], "x": 2, "y": 3},
+                {"matrix": [3, 3], "x": 3, "y": 3}
+            ]
+        }
+    }
+}
diff --git a/keyboards/nibell/micropad4x4/keymaps/default/keymap.c b/keyboards/nibell/micropad4x4/keymaps/default/keymap.c
new file mode 100644
index 0000000000..1da79514ed
--- /dev/null
+++ b/keyboards/nibell/micropad4x4/keymaps/default/keymap.c
@@ -0,0 +1,90 @@
+/*
+ * 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
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /* Base
+    * ┌──────┬─────┬──────┬───────┐
+    * │NUMLK │     │      │QK_BOOT│
+    * ├──────┼─────├──────┼───────┤
+    * │NUMPAD│MINI │  FN  │       │
+    * ├──────┼─────┼──────┼───────┤
+    * │   1  │  2  │  3   │   4   │
+    * ├──────┼─────┼──────┼───────┤
+    * │      │     │RSHIFT│ RCTRL │
+    * └──────┴─────┴──────┴───────┘
+     */
+    [0] = LAYOUT_ortho_4x4(
+        KC_NUM, KC_NO,  KC_NO,      QK_BOOT,
+        TO(1),  TO(2),  TO(3),      KC_NO,
+        KC_1,   KC_2,   KC_3,       KC_4,
+        KC_NO,  KC_NO,  KC_RSFT,    KC_RCTL
+    ),
+
+    /* Numpad
+    * ┌─────┬─────┬─────┬─────┐
+    * │  7  │  8  │  9  │  *  │
+    * ├─────┼─────├─────┼─────┤
+    * │  4  │  5  │  6  │  -  │
+    * ├─────┼─────┼─────┼─────┤
+    * │  1  │  2  │  3  │  +  │
+    * ├─────┼─────┼─────┼─────┤
+    * │  0  │  .  │  /  │  =  │
+    * └─────┴─────┴─────┴─────┘
+     */
+    [1] = LAYOUT_ortho_4x4(
+        KC_P7, KC_P8,   KC_P9,   KC_PAST,
+        KC_P4, KC_P5,   KC_P6,   KC_PMNS,
+        KC_P1, KC_P2,   KC_P3,   KC_PPLS,
+        KC_P0, KC_PDOT, KC_PSLS, LT(3, KC_PENT)
+    ),
+
+    /* Mini KeyBoard
+    * ┌─────┬─────┬─────┬─────┐
+    * │ ESC │  1  │  2  │  3  │
+    * ├─────┼─────┼─────┼─────┤
+    * │ TAB │  Q  │  W  │  E  │
+    * ├─────┼─────┼─────┼─────┤
+    * │SHIFT│  A  │  S  │  D  │
+    * ├─────┼─────┼─────┼─────┤
+    * │CTRL │  C  │  R  │SPACE│
+    * └─────┴─────┴─────┴─────┘
+     */
+    [2] = LAYOUT_ortho_4x4(
+        LT(3, KC_ESC), KC_1, KC_2, KC_3,
+        KC_TAB,        KC_Q, KC_W, KC_E,
+        KC_LSFT,       KC_A, KC_S, KC_D,
+        KC_LCTL,       KC_C, KC_R, KC_SPC
+    ),
+
+    /* FN Keyboard
+    * ┌─────┬─────┬─────┬─────┐
+    * │ F1  │ F2  │ F3  │ F4  │
+    * ├─────┼─────┼─────┼─────┤
+    * │ F5  │ F6  │ F7  │ F8  │
+    * ├─────┼─────┼─────┼─────┤
+    * │ F9  │ F10 │ F11 │ F12 │
+    * ├─────┼─────┼─────┼─────┤
+    * │BASE │     │     │     │
+    * └─────┴─────┴─────┴─────┘
+     */
+    [3] = LAYOUT_ortho_4x4(
+        KC_F1,  KC_F2,  KC_F3,  KC_F4,
+        KC_F5,  KC_F6,  KC_F7,  KC_F8,
+        KC_F9,  KC_F10, KC_F11, KC_F12,
+        TO(0),  KC_NO,  KC_NO, KC_NO
+    ),
+};
diff --git a/keyboards/nibell/micropad4x4/readme.md b/keyboards/nibell/micropad4x4/readme.md
new file mode 100644
index 0000000000..6fec293b65
--- /dev/null
+++ b/keyboards/nibell/micropad4x4/readme.md
@@ -0,0 +1,26 @@
+# Micropad 4x4
+
+![Micropad 4x4](https://imgur.com/ugfJLXJ.jpg)
+
+A budget-friendly 4x4 Macropad
+
+* Keyboard Maintainer: [nibell](https://github.com/Nibell)
+* Hardware Supported: Raspberry Pi Pico 
+* Hardware Availability: [GitHub](https://github.com/Nibell/Keyboards/tree/main/micropad4x4)
+
+## Bootloader
+
+Enter the bootloader in 2 ways:
+
+* **Physical reset button**: Hold the button down on the raspberry pi pico while plugging it in. There is no reset button on the pcb.
+* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
+
+Make example for this keyboard (after setting up your build environment):
+
+    make nibell/micropad4x4:default
+
+Flashing example for this keyboard:
+
+    make nibell/macropad4x4:default
+
+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).