Danny 1 год назад
Родитель
Сommit
40d0de39b7

+ 0 - 5
keyboards/keebio/bdn9/keymaps/default/config.h

@@ -1,5 +0,0 @@
-#pragma once
-
-#ifdef RGB_MATRIX_ENABLE
-#    define RGB_MATRIX_KEYPRESSES
-#endif

+ 14 - 0
keyboards/keebio/bdn9/rev3/config.h

@@ -0,0 +1,14 @@
+// Copyright 2025 Danny Nguyen (@nooges)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+/* Defines for the RGB matrix */
+#ifdef RGB_MATRIX_ENABLE
+#   define WS2812_PWM_DRIVER PWMD15
+#   define WS2812_PWM_CHANNEL 2
+#   define WS2812_PWM_PAL_MODE 1
+#   define WS2812_DMA_STREAM STM32_DMA1_STREAM2
+#   define WS2812_DMA_CHANNEL 2
+#   define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM15_UP
+#endif

+ 8 - 0
keyboards/keebio/bdn9/rev3/halconf.h

@@ -0,0 +1,8 @@
+// Copyright 2025 Danny Nguyen (@nooges)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#define HAL_USE_PWM TRUE
+
+#include_next <halconf.h>

+ 97 - 0
keyboards/keebio/bdn9/rev3/keyboard.json

@@ -0,0 +1,97 @@
+{
+    "keyboard_name": "BDN9 Rev. 3",
+    "bootloader": "stm32-dfu",
+    "encoder": {
+        "rotary": [
+            {"pin_a": "A8", "pin_b": "A4"},
+            {"pin_a": "B3", "pin_b": "A15"},
+            {"pin_a": "A10", "pin_b": "A9"}
+        ]
+    },
+    "features": {
+        "bootmagic": true,
+        "command": true,
+        "console": true,
+        "encoder": true,
+        "extrakey": true,
+        "mousekey": true,
+        "rgb_matrix": true
+    },
+    "matrix_pins": {
+        "direct": [
+            ["B12", "B5", "B6"],
+            ["B14", "B4", "B7"],
+            ["A3", "F1", "F0"]
+        ]
+    },
+    "processor": "STM32G431",
+    "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_flow": 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
+        },
+        "driver": "ws2812",
+        "layout": [
+            {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4},
+            {"matrix": [0, 1], "x": 112, "y": 0, "flags": 4},
+            {"matrix": [0, 2], "x": 224, "y": 0, "flags": 4},
+            {"matrix": [1, 0], "x": 0, "y": 32, "flags": 4},
+            {"matrix": [1, 1], "x": 112, "y": 32, "flags": 4},
+            {"matrix": [1, 2], "x": 224, "y": 32, "flags": 4},
+            {"matrix": [2, 0], "x": 0, "y": 64, "flags": 4},
+            {"matrix": [2, 1], "x": 112, "y": 64, "flags": 4},
+            {"matrix": [2, 2], "x": 224, "y": 64, "flags": 4},
+            {"x": 56, "y": 64, "flags": 2},
+            {"x": 168, "y": 64, "flags": 2}
+        ]
+    },
+    "usb": {
+        "device_version": "3.0.0",
+        "pid": "0x3133"
+    },
+    "ws2812": {
+        "driver": "pwm",
+        "pin": "B15"
+    }
+}

+ 10 - 0
keyboards/keebio/bdn9/rev3/mcuconf.h

@@ -0,0 +1,10 @@
+// Copyright 2025 Danny Nguyen (@nooges)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include_next <mcuconf.h>
+
+/* enable TIM15, used for RGB LED PWM driver */
+#undef STM32_PWM_USE_TIM15
+#define STM32_PWM_USE_TIM15 TRUE

+ 36 - 0
keyboards/keebio/bdn9/rev3/rev3.c

@@ -0,0 +1,36 @@
+// Copyright 2025 Danny Nguyen (@nooges)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "quantum.h"
+
+void keyboard_pre_init_kb(void) {
+    // Disable the PD peripheral in pre-init because its pins (B4, B6) are being used in the matrix:
+    PWR->CR3 |= PWR_CR3_UCPD_DBDIS;
+    // Call the corresponding _user() function (see https://docs.qmk.fm/#/custom_quantum_functions)
+    keyboard_pre_init_user();
+}
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+    if (!encoder_update_user(index, clockwise)) { return false; }
+    if (index == 0) {
+        if (clockwise) {
+            tap_code(KC_VOLU);
+        } else {
+            tap_code(KC_VOLD);
+        }
+    }
+    else if (index == 1) {
+        if (clockwise) {
+            tap_code(KC_DOWN);
+        } else {
+            tap_code(KC_UP);
+        }
+    }
+    else if (index == 2) {
+        if (clockwise) {
+            tap_code(KC_PGDN);
+        } else {
+            tap_code(KC_PGUP);
+        }
+    }
+    return false;
+}