From 9c2b3087307acf43f8cebece2424c6593b5974b9 Mon Sep 17 00:00:00 2001 From: clownfish-og Date: Tue, 14 Jan 2025 10:04:00 -0500 Subject: [PATCH 1/2] add keyboard doio/kb03 --- keyboards/doio/kb03/kb03.c | 77 ++++++++++++++ keyboards/doio/kb03/keyboard.json | 102 +++++++++++++++++++ keyboards/doio/kb03/keymaps/default/keymap.c | 21 ++++ keyboards/doio/kb03/keymaps/default/rules.mk | 1 + keyboards/doio/kb03/readme.md | 27 +++++ keyboards/doio/kb03/rules.mk | 2 + 6 files changed, 230 insertions(+) create mode 100644 keyboards/doio/kb03/kb03.c create mode 100644 keyboards/doio/kb03/keyboard.json create mode 100644 keyboards/doio/kb03/keymaps/default/keymap.c create mode 100644 keyboards/doio/kb03/keymaps/default/rules.mk create mode 100644 keyboards/doio/kb03/readme.md create mode 100644 keyboards/doio/kb03/rules.mk diff --git a/keyboards/doio/kb03/kb03.c b/keyboards/doio/kb03/kb03.c new file mode 100644 index 000000000000..c36270160dd4 --- /dev/null +++ b/keyboards/doio/kb03/kb03.c @@ -0,0 +1,77 @@ +/* Copyright (C) 2025 DOIO + * Copyright (C) 2025 ClownFish (@clownfish-og) + * + * 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 . + */ + +#include QMK_KEYBOARD_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_advanced_kb(uint8_t led_min, uint8_t led_max) { + if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { + 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 000000000000..28afd9761aea --- /dev/null +++ b/keyboards/doio/kb03/keyboard.json @@ -0,0 +1,102 @@ +{ + "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, + "nkro": false, + "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_pendulum": 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 + }, + "center_point": [32, 32], + "default": { + "animation": "dual_beacon" + }, + "driver": "ws2812", + "hue_step": 16, + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, + {"matrix": [0, 1], "x": 32, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 64, "y": 0, "flags": 4}, + {"x": 64, "y": 0, "flags": 2}, + {"x": 0, "y": 0, "flags": 2}, + {"x": 0, "y": 32, "flags": 2}, + {"x": 0, "y": 64, "flags": 2}, + {"x": 64, "y": 64, "flags": 2}, + {"x": 64, "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" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"label": "Layers", "matrix": [0, 3], "x": 0.75, "y": 0}, + {"label": "1!", "matrix": [0, 0], "x": 0, "y": 1.5}, + {"label": "2@", "matrix": [0, 1], "x": 1, "y": 1.5}, + {"label": "3#", "matrix": [0, 2], "x": 2, "y": 1.5}, + {"label": "Encoder", "matrix": [0, 4], "x": 0.5, "y": 2.75, "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 000000000000..122c897e8d9b --- /dev/null +++ b/keyboards/doio/kb03/keymaps/default/keymap.c @@ -0,0 +1,21 @@ +// Copyright 2025 DOIO +// Copyright 2025 ClownFish (@clownfish-og) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + TO(1), KC_1, KC_2, KC_3, KC_MUTE + ), + [1] = LAYOUT( + TO(0), RM_VALD, RM_NEXT, RM_VALU, RM_TOGG + ) +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(MS_WHLU, MS_WHLD), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { 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 000000000000..a40474b4d5c7 --- /dev/null +++ b/keyboards/doio/kb03/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes \ No newline at end of file diff --git a/keyboards/doio/kb03/readme.md b/keyboards/doio/kb03/readme.md new file mode 100644 index 000000000000..873ab2f38dab --- /dev/null +++ b/keyboards/doio/kb03/readme.md @@ -0,0 +1,27 @@ +# DOIO KB03-01 + +![KB03-01](https://i.imgur.com/bnlDpkY.png) + +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 000000000000..ef4364b06ac2 --- /dev/null +++ b/keyboards/doio/kb03/rules.mk @@ -0,0 +1,2 @@ +# Configure for 128K flash +MCU_LDSCRIPT = STM32F103xB \ No newline at end of file From 5a891bab175fe74f3c0f60460f770b884927319c Mon Sep 17 00:00:00 2001 From: ClownFish Date: Wed, 15 Jan 2025 15:04:49 -0500 Subject: [PATCH 2/2] Clean up trailing whitespace in .mk files and simlify GPL header in kb03.c Co-authored-by: Drashna Jaelre --- keyboards/doio/kb03/kb03.c | 19 +++---------------- keyboards/doio/kb03/keymaps/default/rules.mk | 2 +- keyboards/doio/kb03/rules.mk | 2 +- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/keyboards/doio/kb03/kb03.c b/keyboards/doio/kb03/kb03.c index c36270160dd4..31e68261012a 100644 --- a/keyboards/doio/kb03/kb03.c +++ b/keyboards/doio/kb03/kb03.c @@ -1,19 +1,6 @@ -/* Copyright (C) 2025 DOIO - * Copyright (C) 2025 ClownFish (@clownfish-og) - * - * 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 . - */ +// Copyright (C) 2025 DOIO +// Copyright (C) 2025 ClownFish (@clownfish-og) +// SPDX-License-Identifier: GPL-2.0-or-later #include QMK_KEYBOARD_H diff --git a/keyboards/doio/kb03/keymaps/default/rules.mk b/keyboards/doio/kb03/keymaps/default/rules.mk index a40474b4d5c7..ee325681483f 100644 --- a/keyboards/doio/kb03/keymaps/default/rules.mk +++ b/keyboards/doio/kb03/keymaps/default/rules.mk @@ -1 +1 @@ -ENCODER_MAP_ENABLE = yes \ No newline at end of file +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/doio/kb03/rules.mk b/keyboards/doio/kb03/rules.mk index ef4364b06ac2..6f0a3736a73c 100644 --- a/keyboards/doio/kb03/rules.mk +++ b/keyboards/doio/kb03/rules.mk @@ -1,2 +1,2 @@ # Configure for 128K flash -MCU_LDSCRIPT = STM32F103xB \ No newline at end of file +MCU_LDSCRIPT = STM32F103xB