From 6374bad54060995eb43dc3bf2e6975d787aca53d Mon Sep 17 00:00:00 2001
From: DOIO2022 <116554792+DOIO2022@users.noreply.github.com>
Date: Thu, 3 Oct 2024 08:27:36 +0800
Subject: [PATCH] Add KB09-01 keyboard (#24044)

Co-authored-by: jack <jack@pngu.org>
---
 keyboards/doio/kb09/keyboard.json            | 123 +++++++++++++++++++
 keyboards/doio/kb09/keymaps/default/keymap.c |  58 +++++++++
 keyboards/doio/kb09/readme.md                |  26 ++++
 3 files changed, 207 insertions(+)
 create mode 100644 keyboards/doio/kb09/keyboard.json
 create mode 100644 keyboards/doio/kb09/keymaps/default/keymap.c
 create mode 100644 keyboards/doio/kb09/readme.md

diff --git a/keyboards/doio/kb09/keyboard.json b/keyboards/doio/kb09/keyboard.json
new file mode 100644
index 0000000000..e3012f510c
--- /dev/null
+++ b/keyboards/doio/kb09/keyboard.json
@@ -0,0 +1,123 @@
+{
+    "manufacturer": "DOIO",
+    "keyboard_name": "KB09-01",
+    "maintainer": "DOIO2022",
+    "bootloader": "stm32duino",
+    "diode_direction": "COL2ROW",
+    "encoder": {
+        "rotary": [
+            {"pin_a": "B5", "pin_b": "B6"},
+            {"pin_a": "A1", "pin_b": "A2"}
+        ]
+    },
+    "features": {
+        "bootmagic": true,
+        "command": false,
+        "console": false,
+        "encoder": true,
+        "extrakey": true,
+        "mousekey": true,
+        "nkro": true,
+        "rgb_matrix": true
+    },
+    "matrix_pins": {
+        "cols": ["B14", "B13", "B12", "B0", "A7"],
+        "rows": ["B3", "B4", "B9", "B8"]
+    },
+    "processor": "STM32F103",
+    "rgb_matrix": {
+        "animations": {
+            "alphas_mods": true,
+            "band_pinwheel_sat": true,
+            "band_pinwheel_val": true,
+            "band_sat": true,
+            "band_spiral_sat": true,
+            "band_spiral_val": true,
+            "band_val": true,
+            "breathing": true,
+            "cycle_all": true,
+            "cycle_left_right": true,
+            "cycle_out_in": true,
+            "cycle_out_in_dual": true,
+            "cycle_pinwheel": true,
+            "cycle_spiral": true,
+            "cycle_up_down": true,
+            "digital_rain": true,
+            "dual_beacon": true,
+            "gradient_left_right": true,
+            "gradient_up_down": true,
+            "hue_breathing": true,
+            "hue_pendulum": true,
+            "hue_wave": true,
+            "jellybean_raindrops": true,
+            "multisplash": true,
+            "pixel_fractal": true,
+            "pixel_rain": true,
+            "rainbow_beacon": true,
+            "rainbow_moving_chevron": true,
+            "rainbow_pinwheels": true,
+            "raindrops": true,
+            "solid_multisplash": true,
+            "solid_reactive": true,
+            "solid_reactive_cross": true,
+            "solid_reactive_multicross": true,
+            "solid_reactive_multinexus": true,
+            "solid_reactive_multiwide": true,
+            "solid_reactive_nexus": true,
+            "solid_reactive_simple": true,
+            "solid_reactive_wide": true,
+            "solid_splash": true,
+            "splash": true,
+            "typing_heatmap": true
+        },
+        "default": {
+            "animation": "cycle_up_down"
+        },
+        "driver": "ws2812",
+        "layout": [
+            {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4},
+            {"matrix": [0, 1], "x": 56, "y": 0, "flags": 4},
+            {"matrix": [0, 2], "x": 112, "y": 0, "flags": 4},
+            {"matrix": [1, 0], "x": 0, "y": 21, "flags": 4},
+            {"matrix": [1, 1], "x": 56, "y": 21, "flags": 4},
+            {"matrix": [1, 2], "x": 112, "y": 21, "flags": 4},
+            {"matrix": [2, 0], "x": 0, "y": 42, "flags": 4},
+            {"matrix": [2, 1], "x": 56, "y": 42, "flags": 4},
+            {"matrix": [2, 2], "x": 112, "y": 42, "flags": 4}
+        ],
+        "max_brightness": 200,
+        "sleep": true
+    },
+    "url": "",
+    "usb": {
+        "device_version": "0.0.1",
+        "pid": "0x0901",
+        "vid": "0xD010"
+    },
+    "ws2812": {
+        "pin": "A10"
+    },
+    "layouts": {
+        "LAYOUT": {
+            "layout": [
+                {"matrix": [1, 3], "x": 1, "y": 0},
+                {"matrix": [0, 0], "x": 4, "y": 0},
+                {"matrix": [0, 1], "x": 5, "y": 0},
+                {"matrix": [0, 2], "x": 6, "y": 0},
+                {"matrix": [0, 4], "x": 8, "y": 0},
+                {"matrix": [1, 4], "x": 9, "y": 0},
+                {"matrix": [0, 3], "x": 0, "y": 1},
+                {"matrix": [2, 3], "x": 2, "y": 1},
+                {"matrix": [1, 0], "x": 4, "y": 1},
+                {"matrix": [1, 1], "x": 5, "y": 1},
+                {"matrix": [1, 2], "x": 6, "y": 1},
+                {"matrix": [3, 0], "x": 1, "y": 2},
+                {"matrix": [2, 0], "x": 4, "y": 2},
+                {"matrix": [2, 1], "x": 5, "y": 2},
+                {"matrix": [2, 2], "x": 6, "y": 2},
+                {"matrix": [3, 1], "x": 3, "y": 3},
+                {"matrix": [3, 2], "x": 3, "y": 3}
+            ]
+        }
+    }
+}
\ No newline at end of file
diff --git a/keyboards/doio/kb09/keymaps/default/keymap.c b/keyboards/doio/kb09/keymaps/default/keymap.c
new file mode 100644
index 0000000000..657a6bc428
--- /dev/null
+++ b/keyboards/doio/kb09/keymaps/default/keymap.c
@@ -0,0 +1,58 @@
+/* Copyright 2022 DOIO
+ * Copyright 2022 DOIO2022 <https://github.com/DOIO2022>
+ *
+ * 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 layer_names {
+    _LAY0,
+    _LAY1,
+    _LAY2,
+    _LAY3
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    [_LAY0] = LAYOUT(
+                KC_UP,          KC_1,       KC_2,       KC_3,       KC_MPLY,    KC_MUTE,
+        KC_LEFT,    KC_RIGHT,   KC_4,       KC_5,       KC_6,
+                KC_DOWN,        KC_7,       KC_8,       KC_9,
+        TO(1),  LWIN(KC_D)),
+    [_LAY1] = LAYOUT(
+                KC_TRNS,        C(S(KC_S)), C(KC_H),    C(KC_G),    KC_TRNS,    KC_TRNS,
+        KC_TRNS,    KC_TRNS,    C(S(KC_A)), C(KC_J),    C(S(KC_G)),
+                KC_TRNS,        C(KC_Z),    KC_DEL,     C(A(S(KC_E))),
+        TO(2),  KC_TRNS),
+    [_LAY2] = LAYOUT(
+                KC_TRNS,        S(KC_I),    A(KC_EQL),  C(S(KC_M)), KC_TRNS,    KC_TRNS,
+        KC_TRNS,    KC_TRNS,    S(KC_O),    A(KC_MINS), S(KC_M),
+                KC_TRNS,        KC_C,       KC_V,       C(KC_M),
+        TO(3),  KC_TRNS),
+    [_LAY3] = LAYOUT(
+                KC_TRNS,        RGB_SPI,    RGB_SPD,    RGB_HUI,    KC_TRNS,    KC_TRNS,
+        KC_TRNS,    KC_TRNS,    RGB_SAI,    RGB_SAD,    RGB_HUD,
+                KC_TRNS,        RGB_MOD,    RGB_VAI,    RGB_VAD,
+        TO(0),  KC_TRNS)
+};
+
+#ifdef ENCODER_MAP_ENABLE
+const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
+    [_LAY0] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
+    [_LAY1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
+    [_LAY2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
+    [_LAY3] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
+};
+#endif
diff --git a/keyboards/doio/kb09/readme.md b/keyboards/doio/kb09/readme.md
new file mode 100644
index 0000000000..a7b23dc58d
--- /dev/null
+++ b/keyboards/doio/kb09/readme.md
@@ -0,0 +1,26 @@
+# doio/kb09
+
+![kb09-01](https://i.imgur.com/MVKeweC.png)
+
+QMK for DOIO GBA keypad .
+
+* Keyboard Maintainer: DOIO2022
+* Hardware Supported: DOIO GBA keypad
+
+Make example for this keyboard (after setting up your build environment):
+
+    make doio/kb09:default
+
+Flashing example for this keyboard:
+
+    make doio/kb09: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 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
+* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available