Ver Fonte

add dropout keyboard (#25645)

Enoch há 9 meses atrás
pai
commit
911232abfc

+ 33 - 0
keyboards/enochchau/dropout/dropout.c

@@ -0,0 +1,33 @@
+// Copyright 2025 Enoch Chau <enoch965@gmail.com>
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "quantum.h"
+
+// Mimic handle_backlight_caps_lock to use num lock indicator for backlight
+void handle_backlight_num_lock(led_t led_state) {
+    // Use backlight as num_lock indicator
+    uint8_t bl_toggle_lvl     = 0;
+    bool    backlight_enabled = is_backlight_enabled();
+
+    if (led_state.num_lock && !backlight_enabled) {
+        // Turning num_lock ON and backlight is disabled in config
+        // Toggling backlight to the brightest level
+        bl_toggle_lvl = BACKLIGHT_LEVELS;
+    } else if (!led_state.num_lock && backlight_enabled) {
+        // Turning num_lock OFF and backlight is enabled in config
+        // Toggling backlight and restoring config level
+        bl_toggle_lvl = get_backlight_level();
+    }
+
+    backlight_set(bl_toggle_lvl);
+}
+
+bool led_update_kb(led_t led_state) {
+    bool res = led_update_user(led_state);
+    if (res) {
+#ifdef BACKLIGHT_ENABLE
+        handle_backlight_num_lock(led_state);
+#endif
+    }
+    return res;
+}

+ 60 - 0
keyboards/enochchau/dropout/keyboard.json

@@ -0,0 +1,60 @@
+{
+    "manufacturer": "enochchau",
+    "keyboard_name": "dropout",
+    "maintainer": "enochchau",
+    "backlight": {
+        "levels": 6,
+        "on_state": 0,
+        "pin": "B6"
+    },
+    "development_board": "promicro",
+    "diode_direction": "COL2ROW",
+    "encoder": {
+        "rotary": [
+            {"pin_a": "D0", "pin_b": "D4"}
+        ]
+    },
+    "features": {
+        "backlight": true,
+        "bootmagic": true,
+        "encoder": true,
+        "extrakey": true,
+        "mousekey": true,
+        "nkro": true
+    },
+    "matrix_pins": {
+        "cols": ["B3", "B1", "D7", "C6"],
+        "rows": ["D1", "B2", "E6", "B4", "B5"]
+    },
+    "tags": ["numpad"],
+    "url": "https://github.com/enochchau/dropout-numpad",
+    "usb": {
+        "device_version": "0.0.1",
+        "pid": "0x2800",
+        "vid": "0x9650"
+    },
+    "layouts": {
+        "LAYOUT": {
+            "layout": [
+                {"label": "Num Lock", "matrix": [0, 0], "x": 0, "y": 0},
+                {"label": "/", "matrix": [0, 1], "x": 1, "y": 0},
+                {"label": "*", "matrix": [0, 2], "x": 2, "y": 0},
+                {"label": "Play", "matrix": [0, 3], "x": 3, "y": 0, "encoder": 0},
+                {"label": "7", "matrix": [1, 0], "x": 0, "y": 1},
+                {"label": "8", "matrix": [1, 1], "x": 1, "y": 1},
+                {"label": "9", "matrix": [1, 2], "x": 2, "y": 1},
+                {"label": "-", "matrix": [1, 3], "x": 3, "y": 1},
+                {"label": "4", "matrix": [2, 0], "x": 0, "y": 2},
+                {"label": "5", "matrix": [2, 1], "x": 1, "y": 2},
+                {"label": "6", "matrix": [2, 2], "x": 2, "y": 2},
+                {"label": "+", "matrix": [2, 3], "x": 3, "y": 2},
+                {"label": "1", "matrix": [3, 0], "x": 0, "y": 3},
+                {"label": "2", "matrix": [3, 1], "x": 1, "y": 3},
+                {"label": "3", "matrix": [3, 2], "x": 2, "y": 3},
+                {"label": "Enter", "matrix": [3, 3], "x": 3, "y": 3, "h": 2},
+                {"label": "0", "matrix": [4, 0], "x": 0, "y": 4, "w": 2},
+                {"label": ".", "matrix": [4, 2], "x": 2, "y": 4}
+            ]
+        }
+    }
+}

+ 35 - 0
keyboards/enochchau/dropout/keymaps/default/keymap.c

@@ -0,0 +1,35 @@
+// Copyright 2025 Enoch Chau <enoch965@gmail.com>
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+enum layer_names {
+    _BASE,
+    _LIGHT
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+    [_BASE] = LAYOUT(
+        LT(1, KC_NUM), KC_PSLS, KC_PAST, KC_MPLY,
+        KC_P7, KC_P8, KC_P9, KC_PMNS,
+        KC_P4, KC_P5, KC_P6, KC_PPLS,
+        KC_P1, KC_P2, KC_P3, KC_PENT,
+        KC_P0, KC_PDOT
+    ),
+
+    [_LIGHT] = LAYOUT(
+        _______, _______, _______, _______,
+        _______, BL_UP, BL_DOWN, BL_TOGG,
+        _______, _______, _______, _______,
+        _______, _______, _______, QK_BOOT,
+        _______, _______
+    )
+};
+
+#if defined(ENCODER_MAP_ENABLE)
+const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
+    [_BASE]  = {ENCODER_CCW_CW(KC_VOLU, KC_VOLD)},
+    [_LIGHT] = {ENCODER_CCW_CW(_______, _______)}
+};
+#endif

+ 1 - 0
keyboards/enochchau/dropout/keymaps/default/rules.mk

@@ -0,0 +1 @@
+ENCODER_MAP_ENABLE = yes

+ 27 - 0
keyboards/enochchau/dropout/readme.md

@@ -0,0 +1,27 @@
+# dropout
+
+![dropout](https://i.imgur.com/VTjdJ4e.jpeg)
+
+A numpad with a rotary encoder.
+
+* Keyboard Maintainer: [Enoch Chau](https://github.com/enochchau)
+* Hardware Supported: PCB w/ Pro Micro compatible development board
+* Hardware Availability: [Github](https://github.com/enochchau/dropout-numpad)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make enochchau/dropout:default
+
+Flashing example for this keyboard:
+
+    make enochchau/dropout: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 micro-controller
+* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available