diff options
-rw-r--r-- | keyboards/doio/kb03/config.h | 9 | ||||
-rw-r--r-- | keyboards/doio/kb03/halconf.h | 9 | ||||
-rw-r--r-- | keyboards/doio/kb03/kb03.c | 64 | ||||
-rw-r--r-- | keyboards/doio/kb03/keyboard.json | 96 | ||||
-rw-r--r-- | keyboards/doio/kb03/keymaps/default/keymap.c | 44 | ||||
-rw-r--r-- | keyboards/doio/kb03/keymaps/default/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/doio/kb03/mcuconf.h | 10 | ||||
-rw-r--r-- | keyboards/doio/kb03/readme.md | 27 | ||||
-rw-r--r-- | keyboards/doio/kb03/rules.mk | 2 |
9 files changed, 262 insertions, 0 deletions
diff --git a/keyboards/doio/kb03/config.h b/keyboards/doio/kb03/config.h new file mode 100644 index 0000000000..f0f974d940 --- /dev/null +++ b/keyboards/doio/kb03/config.h @@ -0,0 +1,9 @@ +// Copyright (C) 2025 DOIO +// Copyright (C) 2025 ClownFish (@clownfish-og) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define WS2812_PWM_CHANNEL 3 +#define WS2812_PWM_DRIVER PWMD1 +#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM5 diff --git a/keyboards/doio/kb03/halconf.h b/keyboards/doio/kb03/halconf.h new file mode 100644 index 0000000000..8c0968d792 --- /dev/null +++ b/keyboards/doio/kb03/halconf.h @@ -0,0 +1,9 @@ +// Copyright (C) 2025 DOIO +// Copyright (C) 2025 ClownFish (@clownfish-og) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define HAL_USE_PWM TRUE + +#include_next <halconf.h> diff --git a/keyboards/doio/kb03/kb03.c b/keyboards/doio/kb03/kb03.c new file mode 100644 index 0000000000..9368bc5d41 --- /dev/null +++ b/keyboards/doio/kb03/kb03.c @@ -0,0 +1,64 @@ +// Copyright (C) 2025 DOIO +// Copyright (C) 2025 ClownFish (@clownfish-og) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "quantum.h" + +#ifdef RGB_MATRIX_ENABLE + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { + case RM_TOGG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + } break; + } + } + if (!rgb_matrix_is_enabled()) { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable(); + } + return false; + } + return true; +} + +bool rgb_matrix_indicators_kb(void) { + if (!rgb_matrix_indicators_user()) { + return false; + } + + hsv_t hsv = {0, 255, 100}; + switch (get_highest_layer(layer_state)) { + case 0: + hsv = (hsv_t){HSV_RED}; + break; + case 1: + hsv = (hsv_t){HSV_GREEN}; + break; + case 2: + hsv = (hsv_t){HSV_BLUE}; + break; + case 3: + hsv = (hsv_t){HSV_WHITE}; + break; + default: + hsv = (hsv_t){HSV_YELLOW}; + break; + } + hsv.v = (rgb_matrix_get_val() * 70 / 200) + 30; //set indicator brightness range 30-100, vary based on RGB Matrix brightness + rgb_t rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(9, rgb.r, rgb.g, rgb.b); + return false; +} + +#endif diff --git a/keyboards/doio/kb03/keyboard.json b/keyboards/doio/kb03/keyboard.json new file mode 100644 index 0000000000..d2a214c92f --- /dev/null +++ b/keyboards/doio/kb03/keyboard.json @@ -0,0 +1,96 @@ +{ + "manufacturer": "DOIO", + "keyboard_name": "KB03-01", + "maintainer": "clownfish-og", + "bootloader": "stm32duino", + "diode_direction": "COL2ROW", + "encoder": { + "rotary": [ + {"pin_a": "B5", "pin_b": "B6", "resolution": 4}, + {"pin_a": "A2", "pin_b": "A1", "resolution": 2} + ] + }, + "features": { + "bootmagic": true, + "encoder": true, + "extrakey": true, + "mousekey": true, + "rgb_matrix": true + }, + "matrix_pins": { + "cols": ["B14", "B13", "B12", "B0", "A7"], + "rows": ["B3"] + }, + "processor": "STM32F103", + "rgb_matrix": { + "animations": { + "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, + "dual_beacon": true, + "gradient_left_right": true, + "gradient_up_down": true, + "hue_breathing": true, + "hue_wave": true, + "jellybean_raindrops": true, + "rainbow_beacon": true, + "rainbow_moving_chevron": true, + "rainbow_pinwheels": true, + "raindrops": true, + "solid_reactive": true, + "solid_reactive_cross": true, + "solid_reactive_nexus": true, + "solid_reactive_simple": true, + "solid_reactive_wide": true, + "solid_splash": true, + "splash": 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}, + {"x": 224, "y": 0, "flags": 2}, + {"x": 0, "y": 0, "flags": 2}, + {"x": 0, "y": 32, "flags": 2}, + {"x": 0, "y": 64, "flags": 2}, + {"x": 224, "y": 64, "flags": 2}, + {"x": 224, "y": 32, "flags": 2}, + {"x": 10, "y": 0, "flags": 8} + ], + "max_brightness": 200, + "sleep": true + }, + "url": "https://www.keebmonkey.com/products/megalodon-dual-layer-knob-macro-pad", + "usb": { + "device_version": "0.0.1", + "pid": "0x0301", + "vid": "0xD010" + }, + "ws2812": { + "pin": "A10", + "driver": "pwm" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"label": "Layers", "matrix": [0, 3], "x": 0.75, "y": 0, "h": 0.5}, + {"label": "1!", "matrix": [0, 0], "x": 0, "y": 0.75}, + {"label": "2@", "matrix": [0, 1], "x": 1, "y": 0.75}, + {"label": "3#", "matrix": [0, 2], "x": 2, "y": 0.75}, + {"label": "Encoder", "matrix": [0, 4], "x": 0.5, "y": 2, "w": 2, "h": 2} + ] + } + } +} diff --git a/keyboards/doio/kb03/keymaps/default/keymap.c b/keyboards/doio/kb03/keymaps/default/keymap.c new file mode 100644 index 0000000000..67e43faca4 --- /dev/null +++ b/keyboards/doio/kb03/keymaps/default/keymap.c @@ -0,0 +1,44 @@ +// Copyright 2025 DOIO +// Copyright 2025 ClownFish (@clownfish-og) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +enum my_layers { + _BASE, + _MOUSE, + _MEDIA, + _LIGHTS +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + TO(_MOUSE), + KC_1, KC_2, KC_3, + KC_ENT + ), + [_MOUSE] = LAYOUT( + TO(_MEDIA), + MS_BTN1, MS_BTN3, MS_BTN2, + KC_LCTL + ), + [_MEDIA] = LAYOUT( + TO(_LIGHTS), + KC_MRWD, KC_MPLY, KC_MFFD, + KC_MUTE + ), + [_LIGHTS] = LAYOUT( + TO(_BASE), + RM_VALD, RM_NEXT, RM_VALU, + RM_TOGG + ) +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [_BASE] = { ENCODER_CCW_CW(MS_WHLU, MS_WHLD), ENCODER_CCW_CW(MS_WHLL, MS_WHLR) }, + [_MOUSE] = { ENCODER_CCW_CW(MS_LEFT, MS_RGHT), ENCODER_CCW_CW(MS_UP, MS_DOWN) }, + [_MEDIA] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_MPRV, KC_MNXT) }, + [_LIGHTS] = { ENCODER_CCW_CW(RM_SATD, RM_SATU), ENCODER_CCW_CW(RM_HUED, RM_HUEU) } +}; +#endif diff --git a/keyboards/doio/kb03/keymaps/default/rules.mk b/keyboards/doio/kb03/keymaps/default/rules.mk new file mode 100644 index 0000000000..ee32568148 --- /dev/null +++ b/keyboards/doio/kb03/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/doio/kb03/mcuconf.h b/keyboards/doio/kb03/mcuconf.h new file mode 100644 index 0000000000..5869741c98 --- /dev/null +++ b/keyboards/doio/kb03/mcuconf.h @@ -0,0 +1,10 @@ +// Copyright (C) 2025 DOIO +// Copyright (C) 2025 ClownFish (@clownfish-og) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include_next <mcuconf.h> + +#undef STM32_PWM_USE_TIM1 +#define STM32_PWM_USE_TIM1 TRUE diff --git a/keyboards/doio/kb03/readme.md b/keyboards/doio/kb03/readme.md new file mode 100644 index 0000000000..873ab2f38d --- /dev/null +++ b/keyboards/doio/kb03/readme.md @@ -0,0 +1,27 @@ +# DOIO KB03-01 + + + +QMK for Megalodon DOIO Dual Layer Knob 3 Key macropad. + +* Keyboard Maintainer: [clownfish-og](https://github.com/clownfish-og) +* Hardware Supported: DOIO KB03-01 using APM32F103CBT6 (clone STM32F103CBT6) +* Hardware Availability: https://www.keebmonkey.com/products/megalodon-dual-layer-knob-macro-pad + +Make example for this keyboard (after setting up your build environment): + + make doio/kb03:default + +Flashing example for this keyboard: + + make doio/kb03: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 - 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/doio/kb03/rules.mk b/keyboards/doio/kb03/rules.mk new file mode 100644 index 0000000000..6f0a3736a7 --- /dev/null +++ b/keyboards/doio/kb03/rules.mk @@ -0,0 +1,2 @@ +# Configure for 128K flash +MCU_LDSCRIPT = STM32F103xB |