From 71d6c9eafd454b38ed28a4f77f3d162019a84bbd Mon Sep 17 00:00:00 2001 From: htx_studio Date: Tue, 13 May 2025 17:54:19 +0800 Subject: [PATCH] one_handed_keyboard --- keyboards/htx_studio/.vscode/settings.json | 5 ++ .../config.h | 2 - .../halconf.h | 0 .../htx_studio/one_handed_keyboard/info.json | 25 ++++++++ .../mcuconf.h | 0 .../ml}/keyboard.json | 25 -------- .../ml}/keymaps/default/keymap.c | 58 +++--------------- .../ml}/keymaps/default/rules.mk | 0 .../halconf.h => one_handed_keyboard/ml/ml.c} | 20 +++--- .../ml}/readme.md | 4 +- .../mr}/keyboard.json | 25 -------- .../mr}/keymaps/default/keymap.c | 58 +++--------------- .../mr}/keymaps/default/rules.mk | 0 .../htx_studio/one_handed_keyboard/mr/mr.c | 27 ++++++++ .../mr}/readme.md | 4 +- .../one_handed_keyboard/one_handed_keyboard.c | 61 +++++++++++++++++++ .../one_handed_keyboard.h} | 20 +++--- .../sl}/keyboard.json | 27 -------- .../sl}/keymaps/default/keymap.c | 48 +++------------ .../sl}/keymaps/default/rules.mk | 0 .../sl}/readme.md | 4 +- .../one_handed_keyboard_mr/config.h | 42 ------------- .../one_handed_keyboard_mr/mcuconf.h | 27 -------- .../one_handed_keyboard_sl/halconf.h | 24 -------- .../one_handed_keyboard_sl/mcuconf.h | 23 ------- 25 files changed, 169 insertions(+), 360 deletions(-) create mode 100644 keyboards/htx_studio/.vscode/settings.json rename keyboards/htx_studio/{one_handed_keyboard_ml => one_handed_keyboard}/config.h (97%) rename keyboards/htx_studio/{one_handed_keyboard_ml => one_handed_keyboard}/halconf.h (100%) create mode 100644 keyboards/htx_studio/one_handed_keyboard/info.json rename keyboards/htx_studio/{one_handed_keyboard_ml => one_handed_keyboard}/mcuconf.h (100%) rename keyboards/htx_studio/{one_handed_keyboard_ml => one_handed_keyboard/ml}/keyboard.json (92%) rename keyboards/htx_studio/{one_handed_keyboard_ml => one_handed_keyboard/ml}/keymaps/default/keymap.c (85%) rename keyboards/htx_studio/{one_handed_keyboard_ml => one_handed_keyboard/ml}/keymaps/default/rules.mk (100%) rename keyboards/htx_studio/{one_handed_keyboard_mr/halconf.h => one_handed_keyboard/ml/ml.c} (61%) rename keyboards/htx_studio/{one_handed_keyboard_ml => one_handed_keyboard/ml}/readme.md (91%) rename keyboards/htx_studio/{one_handed_keyboard_mr => one_handed_keyboard/mr}/keyboard.json (92%) rename keyboards/htx_studio/{one_handed_keyboard_mr => one_handed_keyboard/mr}/keymaps/default/keymap.c (85%) rename keyboards/htx_studio/{one_handed_keyboard_mr => one_handed_keyboard/mr}/keymaps/default/rules.mk (100%) create mode 100644 keyboards/htx_studio/one_handed_keyboard/mr/mr.c rename keyboards/htx_studio/{one_handed_keyboard_mr => one_handed_keyboard/mr}/readme.md (91%) create mode 100644 keyboards/htx_studio/one_handed_keyboard/one_handed_keyboard.c rename keyboards/htx_studio/{one_handed_keyboard_sl/config.h => one_handed_keyboard/one_handed_keyboard.h} (71%) rename keyboards/htx_studio/{one_handed_keyboard_sl => one_handed_keyboard/sl}/keyboard.json (83%) rename keyboards/htx_studio/{one_handed_keyboard_sl => one_handed_keyboard/sl}/keymaps/default/keymap.c (81%) rename keyboards/htx_studio/{one_handed_keyboard_sl => one_handed_keyboard/sl}/keymaps/default/rules.mk (100%) rename keyboards/htx_studio/{one_handed_keyboard_sl => one_handed_keyboard/sl}/readme.md (91%) delete mode 100644 keyboards/htx_studio/one_handed_keyboard_mr/config.h delete mode 100644 keyboards/htx_studio/one_handed_keyboard_mr/mcuconf.h delete mode 100644 keyboards/htx_studio/one_handed_keyboard_sl/halconf.h delete mode 100644 keyboards/htx_studio/one_handed_keyboard_sl/mcuconf.h diff --git a/keyboards/htx_studio/.vscode/settings.json b/keyboards/htx_studio/.vscode/settings.json new file mode 100644 index 00000000000..aad33c3e489 --- /dev/null +++ b/keyboards/htx_studio/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "one_handed_keyboard.h": "c" + } +} \ No newline at end of file diff --git a/keyboards/htx_studio/one_handed_keyboard_ml/config.h b/keyboards/htx_studio/one_handed_keyboard/config.h similarity index 97% rename from keyboards/htx_studio/one_handed_keyboard_ml/config.h rename to keyboards/htx_studio/one_handed_keyboard/config.h index 32de009d5c3..3aae0ddf059 100644 --- a/keyboards/htx_studio/one_handed_keyboard_ml/config.h +++ b/keyboards/htx_studio/one_handed_keyboard/config.h @@ -30,7 +30,6 @@ #ifdef RGB_MATRIX_ENABLE -#define WS2812_BITBANG_NOP_FUDGE 0 #define WS2812_PWM_DRIVER PWMD3 #define WS2812_PWM_CHANNEL 1 #define WS2812_DMA_STREAM STM32_DMA1_STREAM1 @@ -38,4 +37,3 @@ #define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM3_UP #endif - diff --git a/keyboards/htx_studio/one_handed_keyboard_ml/halconf.h b/keyboards/htx_studio/one_handed_keyboard/halconf.h similarity index 100% rename from keyboards/htx_studio/one_handed_keyboard_ml/halconf.h rename to keyboards/htx_studio/one_handed_keyboard/halconf.h diff --git a/keyboards/htx_studio/one_handed_keyboard/info.json b/keyboards/htx_studio/one_handed_keyboard/info.json new file mode 100644 index 00000000000..cc1e79ca309 --- /dev/null +++ b/keyboards/htx_studio/one_handed_keyboard/info.json @@ -0,0 +1,25 @@ +{ + "manufacturer": "HTXStudio", + "maintainer": "HTXStudio", + "bootloader": "stm32-dfu", + "diode_direction": "ROW2COL", + "encoder": { + "rotary": [ + {"pin_a": "A9", "pin_b": "A10"} + ] + }, + "features": { + "bootmagic": true, + "encoder": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "pointing_device": true + }, + "matrix_pins": { + "cols": ["A0", "A1", "A2", "C4", "B0", "B1", "B2", "B7", "B5", "B3", "B10", "C11", "C10", "A15"], + "rows": ["B12", "B15", "C6", "B13", "B14", "A8"] + }, + "processor": "STM32G431", + "url": "https://github.com/htx-studio" +} diff --git a/keyboards/htx_studio/one_handed_keyboard_ml/mcuconf.h b/keyboards/htx_studio/one_handed_keyboard/mcuconf.h similarity index 100% rename from keyboards/htx_studio/one_handed_keyboard_ml/mcuconf.h rename to keyboards/htx_studio/one_handed_keyboard/mcuconf.h diff --git a/keyboards/htx_studio/one_handed_keyboard_ml/keyboard.json b/keyboards/htx_studio/one_handed_keyboard/ml/keyboard.json similarity index 92% rename from keyboards/htx_studio/one_handed_keyboard_ml/keyboard.json rename to keyboards/htx_studio/one_handed_keyboard/ml/keyboard.json index 4ddede69186..5c50ad6f8a2 100644 --- a/keyboards/htx_studio/one_handed_keyboard_ml/keyboard.json +++ b/keyboards/htx_studio/one_handed_keyboard/ml/keyboard.json @@ -1,32 +1,8 @@ { - "manufacturer": "HTXStudio", "keyboard_name": "One-Handed_Keyboard_ML", - "maintainer": "HTXStudio", - "bootloader": "stm32-dfu", - "diode_direction": "ROW2COL", - "encoder": { - "rotary": [ - {"pin_a": "A9", "pin_b": "A10"} - ] - }, "features": { - "bootmagic": true, - "encoder": true, - "extrakey": true, - "mousekey": true, - "nkro": true, - "pointing_device": true, "rgb_matrix": true }, - "matrix": { - "cols": 14, - "rows": 6 - }, - "matrix_pins": { - "cols": ["A0", "A1", "A2", "C4", "B0", "B1", "B2", "B7", "B5", "B3", "B10", "C11", "C10", "A15"], - "rows": ["B12", "B15", "C6", "B13", "B14", "A8"] - }, - "processor": "STM32G431", "rgb_matrix": { "animations": { "alphas_mods": true, @@ -138,7 +114,6 @@ "max_brightness": 110, "sleep": true }, - "url": "https://github.com/htx-studio", "usb": { "device_version": "3.1.0", "pid": "0x03AF", diff --git a/keyboards/htx_studio/one_handed_keyboard_ml/keymaps/default/keymap.c b/keyboards/htx_studio/one_handed_keyboard/ml/keymaps/default/keymap.c similarity index 85% rename from keyboards/htx_studio/one_handed_keyboard_ml/keymaps/default/keymap.c rename to keyboards/htx_studio/one_handed_keyboard/ml/keymaps/default/keymap.c index df7b93f1fff..dcf2cb1b0fa 100644 --- a/keyboards/htx_studio/one_handed_keyboard_ml/keymaps/default/keymap.c +++ b/keyboards/htx_studio/one_handed_keyboard/ml/keymaps/default/keymap.c @@ -15,23 +15,13 @@ */ #include QMK_KEYBOARD_H - -#define TRACKBALL_DPI_MIN 1000 -#define TRACKBALL_DPI_MAX 8000 -#define TRACKBALL_DPI_DEFAULT 3000 -#define TRACKBALL_DPI_STEP 1000 +#include "one_handed_keyboard.h" enum my_keycodes { DPI_UP = SAFE_RANGE, DPI_DOWN }; -typedef union { - uint16_t TrackballDPI; -} user_config_t; -user_config_t user_config; - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ┏━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓ @@ -93,58 +83,26 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif -void pointing_device_init_kb(void) { - wait_ms(10); - user_config.TrackballDPI = eeconfig_read_user(); - wait_ms(10); - adns9800_init(); - wait_ms(10); - pointing_device_set_cpi(user_config.TrackballDPI); -} - // ADNS9800. The CPI range is 800-8200, in increments of 200. bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case DPI_UP: { if (record->event.pressed) { - user_config.TrackballDPI += TRACKBALL_DPI_STEP; - if(user_config.TrackballDPI > TRACKBALL_DPI_MAX) { - user_config.TrackballDPI = TRACKBALL_DPI_MAX; - } - eeconfig_update_user(user_config.TrackballDPI); - pointing_device_set_cpi(user_config.TrackballDPI); - return false; + pointing_adns9800_cpi_up(); } + break; } case DPI_DOWN: { if (record->event.pressed) { - user_config.TrackballDPI -= TRACKBALL_DPI_STEP; - if(user_config.TrackballDPI < TRACKBALL_DPI_MIN) { - user_config.TrackballDPI = TRACKBALL_DPI_MIN; - } - eeconfig_update_user(user_config.TrackballDPI); - pointing_device_set_cpi(user_config.TrackballDPI); - return false; + pointing_adns9800_cpi_down(); } + break; + } + default: break; } - default: return true; - - } } void eeconfig_init_user(void) { - user_config.TrackballDPI = TRACKBALL_DPI_DEFAULT; - wait_ms(10); - pointing_device_set_cpi(user_config.TrackballDPI); - eeconfig_update_user(user_config.TrackballDPI); -} - -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(28, 255, 255, 255); // assuming caps lock is at led #5 - } else { - RGB_MATRIX_INDICATOR_SET_COLOR(28, 0, 0, 0); - } - return false; + pointing_adns9800_reset(); } diff --git a/keyboards/htx_studio/one_handed_keyboard_ml/keymaps/default/rules.mk b/keyboards/htx_studio/one_handed_keyboard/ml/keymaps/default/rules.mk similarity index 100% rename from keyboards/htx_studio/one_handed_keyboard_ml/keymaps/default/rules.mk rename to keyboards/htx_studio/one_handed_keyboard/ml/keymaps/default/rules.mk diff --git a/keyboards/htx_studio/one_handed_keyboard_mr/halconf.h b/keyboards/htx_studio/one_handed_keyboard/ml/ml.c similarity index 61% rename from keyboards/htx_studio/one_handed_keyboard_mr/halconf.h rename to keyboards/htx_studio/one_handed_keyboard/ml/ml.c index 111ec84f282..6deb797a4ab 100644 --- a/keyboards/htx_studio/one_handed_keyboard_mr/halconf.h +++ b/keyboards/htx_studio/one_handed_keyboard/ml/ml.c @@ -1,4 +1,4 @@ -/* Copyright 2020 QMK +/* Copyright 2025 htx-studio (@https://github.com/htx-studio) * * 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 @@ -14,12 +14,14 @@ * along with this program. If not, see . */ - #pragma once +#include "rgb_matrix.h" +#include "host.h" - #define HAL_USE_PWM TRUE - #define HAL_USE_SPI TRUE - #define SPI_USE_WAIT TRUE - #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD - - #include_next - \ No newline at end of file +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (host_keyboard_led_state().caps_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(28, 255, 255, 255); // assuming caps lock is at led #5 + } else { + RGB_MATRIX_INDICATOR_SET_COLOR(28, 0, 0, 0); + } + return false; +} diff --git a/keyboards/htx_studio/one_handed_keyboard_ml/readme.md b/keyboards/htx_studio/one_handed_keyboard/ml/readme.md similarity index 91% rename from keyboards/htx_studio/one_handed_keyboard_ml/readme.md rename to keyboards/htx_studio/one_handed_keyboard/ml/readme.md index 1933b96610a..dd49d41133a 100644 --- a/keyboards/htx_studio/one_handed_keyboard_ml/readme.md +++ b/keyboards/htx_studio/one_handed_keyboard/ml/readme.md @@ -12,11 +12,11 @@ This is a keyboard with a fan-shaped layout and 59 keys.The commonly used button Make example for this keyboard (after setting up your build environment): - `make htx_studio/one_handed_keyboard_ml:default` + `make htx_studio/one_handed_keyboard/ml:default` Flashing example for this keyboard: - `make htx_studio/one_handed_keyboard_ml:default:flash` + `make htx_studio/one_handed_keyboard/ml: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). diff --git a/keyboards/htx_studio/one_handed_keyboard_mr/keyboard.json b/keyboards/htx_studio/one_handed_keyboard/mr/keyboard.json similarity index 92% rename from keyboards/htx_studio/one_handed_keyboard_mr/keyboard.json rename to keyboards/htx_studio/one_handed_keyboard/mr/keyboard.json index 9408f198087..c543b1643b1 100644 --- a/keyboards/htx_studio/one_handed_keyboard_mr/keyboard.json +++ b/keyboards/htx_studio/one_handed_keyboard/mr/keyboard.json @@ -1,32 +1,8 @@ { - "manufacturer": "HTXStudio", "keyboard_name": "One-Handed_Keyboard_MR", - "maintainer": "HTXStudio", - "bootloader": "stm32-dfu", - "diode_direction": "ROW2COL", - "encoder": { - "rotary": [ - {"pin_a": "A9", "pin_b": "A10"} - ] - }, "features": { - "bootmagic": true, - "encoder": true, - "extrakey": true, - "mousekey": true, - "nkro": true, - "pointing_device": true, "rgb_matrix": true }, - "matrix": { - "cols": 14, - "rows": 6 - }, - "matrix_pins": { - "cols": ["A0", "A1", "A2", "C4", "B0", "B1", "B2", "B7", "B5", "B3", "B10", "C11", "C10", "A15"], - "rows": ["B12", "B15", "C6", "B13", "B14", "A8"] - }, - "processor": "STM32G431", "rgb_matrix": { "animations": { "alphas_mods": true, @@ -138,7 +114,6 @@ "max_brightness": 110, "sleep": true }, - "url": "https://github.com/htx-studio", "usb": { "device_version": "3.1.0", "pid": "0x03BF", diff --git a/keyboards/htx_studio/one_handed_keyboard_mr/keymaps/default/keymap.c b/keyboards/htx_studio/one_handed_keyboard/mr/keymaps/default/keymap.c similarity index 85% rename from keyboards/htx_studio/one_handed_keyboard_mr/keymaps/default/keymap.c rename to keyboards/htx_studio/one_handed_keyboard/mr/keymaps/default/keymap.c index e3dc303db5b..de1ac56bd74 100644 --- a/keyboards/htx_studio/one_handed_keyboard_mr/keymaps/default/keymap.c +++ b/keyboards/htx_studio/one_handed_keyboard/mr/keymaps/default/keymap.c @@ -15,22 +15,13 @@ */ #include QMK_KEYBOARD_H - -#define TRACKBALL_DPI_MIN 1000 -#define TRACKBALL_DPI_MAX 8000 -#define TRACKBALL_DPI_DEFAULT 3000 -#define TRACKBALL_DPI_STEP 1000 +#include "one_handed_keyboard.h" enum my_keycodes { DPI_UP = SAFE_RANGE, DPI_DOWN }; -typedef union { - uint16_t TrackballDPI; -} user_config_t; -user_config_t user_config; - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ┏━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓ @@ -89,59 +80,26 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif -void pointing_device_init_kb(void) { - wait_ms(10); - user_config.TrackballDPI = eeconfig_read_user(); - wait_ms(10); - adns9800_init(); - wait_ms(10); - pointing_device_set_cpi(user_config.TrackballDPI); -} - // ADNS9800. The CPI range is 800-8200, in increments of 200. bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case DPI_UP: { if (record->event.pressed) { - user_config.TrackballDPI += TRACKBALL_DPI_STEP; - if(user_config.TrackballDPI > TRACKBALL_DPI_MAX) { - user_config.TrackballDPI = TRACKBALL_DPI_MAX; - } - eeconfig_update_user(user_config.TrackballDPI); - pointing_device_set_cpi(user_config.TrackballDPI); - return false; + pointing_adns9800_cpi_up(); } + break; } case DPI_DOWN: { if (record->event.pressed) { - user_config.TrackballDPI -= TRACKBALL_DPI_STEP; - if(user_config.TrackballDPI < TRACKBALL_DPI_MIN) { - user_config.TrackballDPI = TRACKBALL_DPI_MIN; - } - eeconfig_update_user(user_config.TrackballDPI); - pointing_device_set_cpi(user_config.TrackballDPI); - return false; + pointing_adns9800_cpi_down(); } + break; + } + default: break; } - default: return true; - - } } void eeconfig_init_user(void) { - user_config.TrackballDPI = TRACKBALL_DPI_DEFAULT; - wait_ms(10); - pointing_device_set_cpi(user_config.TrackballDPI); - eeconfig_update_user(user_config.TrackballDPI); + pointing_adns9800_reset(); } - -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(28, 255, 255, 255); // assuming caps lock is at led #5 - } else { - RGB_MATRIX_INDICATOR_SET_COLOR(28, 0, 0, 0); - } - return false; -} - diff --git a/keyboards/htx_studio/one_handed_keyboard_mr/keymaps/default/rules.mk b/keyboards/htx_studio/one_handed_keyboard/mr/keymaps/default/rules.mk similarity index 100% rename from keyboards/htx_studio/one_handed_keyboard_mr/keymaps/default/rules.mk rename to keyboards/htx_studio/one_handed_keyboard/mr/keymaps/default/rules.mk diff --git a/keyboards/htx_studio/one_handed_keyboard/mr/mr.c b/keyboards/htx_studio/one_handed_keyboard/mr/mr.c new file mode 100644 index 00000000000..6deb797a4ab --- /dev/null +++ b/keyboards/htx_studio/one_handed_keyboard/mr/mr.c @@ -0,0 +1,27 @@ +/* Copyright 2025 htx-studio (@https://github.com/htx-studio) + * + * 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 "rgb_matrix.h" +#include "host.h" + +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (host_keyboard_led_state().caps_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(28, 255, 255, 255); // assuming caps lock is at led #5 + } else { + RGB_MATRIX_INDICATOR_SET_COLOR(28, 0, 0, 0); + } + return false; +} diff --git a/keyboards/htx_studio/one_handed_keyboard_mr/readme.md b/keyboards/htx_studio/one_handed_keyboard/mr/readme.md similarity index 91% rename from keyboards/htx_studio/one_handed_keyboard_mr/readme.md rename to keyboards/htx_studio/one_handed_keyboard/mr/readme.md index 5c7cb56993e..19c85dcc9de 100644 --- a/keyboards/htx_studio/one_handed_keyboard_mr/readme.md +++ b/keyboards/htx_studio/one_handed_keyboard/mr/readme.md @@ -12,11 +12,11 @@ This is a keyboard with a fan-shaped layout and 59 keys.The commonly used button Make example for this keyboard (after setting up your build environment): - `make htx_studio/one_handed_keyboard_mr:default` + `make htx_studio/one_handed_keyboard/mr:default` Flashing example for this keyboard: - `make htx_studio/one_handed_keyboard_mr:default:flash` + `make htx_studio/one_handed_keyboard/mr: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). diff --git a/keyboards/htx_studio/one_handed_keyboard/one_handed_keyboard.c b/keyboards/htx_studio/one_handed_keyboard/one_handed_keyboard.c new file mode 100644 index 00000000000..83ab44968ad --- /dev/null +++ b/keyboards/htx_studio/one_handed_keyboard/one_handed_keyboard.c @@ -0,0 +1,61 @@ +/* Copyright 2025 htx-studio (@https://github.com/htx-studio) + * + * 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 "wait.h" +#include "eeconfig.h" +#include "pointing_device.h" +#include "one_handed_keyboard.h" + +#define TRACKBALL_DPI_MIN 1000 +#define TRACKBALL_DPI_MAX 8000 +#define TRACKBALL_DPI_DEFAULT 3000 +#define TRACKBALL_DPI_STEP 1000 + +user_config_t user_config; + +void pointing_device_init_kb(void) { + wait_ms(10); + user_config.TrackballDPI = eeconfig_read_user(); + wait_ms(10); + adns9800_init(); + wait_ms(10); + pointing_device_set_cpi(user_config.TrackballDPI); +} + +void pointing_adns9800_cpi_up(void) { + user_config.TrackballDPI += TRACKBALL_DPI_STEP; + if(user_config.TrackballDPI > TRACKBALL_DPI_MAX) { + user_config.TrackballDPI = TRACKBALL_DPI_MAX; + } + eeconfig_update_user(user_config.TrackballDPI); + pointing_device_set_cpi(user_config.TrackballDPI); +} + +void pointing_adns9800_cpi_down(void) { + user_config.TrackballDPI -= TRACKBALL_DPI_STEP; + if(user_config.TrackballDPI < TRACKBALL_DPI_MIN) { + user_config.TrackballDPI = TRACKBALL_DPI_MIN; + } + eeconfig_update_user(user_config.TrackballDPI); + pointing_device_set_cpi(user_config.TrackballDPI); +} + +void pointing_adns9800_reset(void) { + user_config.TrackballDPI = TRACKBALL_DPI_DEFAULT; + wait_ms(10); + eeconfig_update_user(user_config.TrackballDPI); + pointing_device_set_cpi(user_config.TrackballDPI); +} diff --git a/keyboards/htx_studio/one_handed_keyboard_sl/config.h b/keyboards/htx_studio/one_handed_keyboard/one_handed_keyboard.h similarity index 71% rename from keyboards/htx_studio/one_handed_keyboard_sl/config.h rename to keyboards/htx_studio/one_handed_keyboard/one_handed_keyboard.h index c264940916a..8acc36782a3 100644 --- a/keyboards/htx_studio/one_handed_keyboard_sl/config.h +++ b/keyboards/htx_studio/one_handed_keyboard/one_handed_keyboard.h @@ -14,17 +14,17 @@ * along with this program. If not, see . */ -#pragma once +#ifndef ONE_HANDED_KEYBOARD_H +#define ONE_HANDED_KEYBOARD_H -#define SPI_DRIVER SPID1 -#define SPI_SCK_PIN A5 -#define SPI_MISO_PIN A6 -#define SPI_MOSI_PIN A7 +#include "quantum.h" -#define POINTING_DEVICE_CS_PIN A4 -#define POINTING_DEVICE_MOTION_PIN A3 -#define POINTING_DEVICE_TASK_THROTTLE_MS 1 -#define POINTING_DEVICE_INVERT_X 1 +typedef union { + uint16_t TrackballDPI; +} user_config_t; -#define ENCODER_RESOLUTION 2 +void pointing_adns9800_cpi_up(void); +void pointing_adns9800_cpi_down(void); +void pointing_adns9800_reset(void); +#endif // ONE_HANDED_KEYBOARD_H diff --git a/keyboards/htx_studio/one_handed_keyboard_sl/keyboard.json b/keyboards/htx_studio/one_handed_keyboard/sl/keyboard.json similarity index 83% rename from keyboards/htx_studio/one_handed_keyboard_sl/keyboard.json rename to keyboards/htx_studio/one_handed_keyboard/sl/keyboard.json index e26444299c3..1cec49bf020 100644 --- a/keyboards/htx_studio/one_handed_keyboard_sl/keyboard.json +++ b/keyboards/htx_studio/one_handed_keyboard/sl/keyboard.json @@ -1,32 +1,5 @@ { - "manufacturer": "HTXStudio", "keyboard_name": "One-Handed_Keyboard_SL", - "maintainer": "HTXStudio", - "bootloader": "stm32-dfu", - "diode_direction": "ROW2COL", - "encoder": { - "rotary": [ - {"pin_a": "A9", "pin_b": "A10"} - ] - }, - "features": { - "bootmagic": true, - "encoder": true, - "extrakey": true, - "mousekey": true, - "nkro": true, - "pointing_device": true - }, - "matrix": { - "cols": 14, - "rows": 6 - }, - "matrix_pins": { - "cols": ["A0", "A1", "A2", "C4", "B0", "B1", "B2", "B7", "B5", "B3", "B10", "C11", "C10", "A15"], - "rows": ["B12", "B15", "C6", "B13", "B14", "A8"] - }, - "processor": "STM32G431", - "url": "https://github.com/htx-studio", "usb": { "device_version": "3.1.0", "pid": "0x03BE", diff --git a/keyboards/htx_studio/one_handed_keyboard_sl/keymaps/default/keymap.c b/keyboards/htx_studio/one_handed_keyboard/sl/keymaps/default/keymap.c similarity index 81% rename from keyboards/htx_studio/one_handed_keyboard_sl/keymaps/default/keymap.c rename to keyboards/htx_studio/one_handed_keyboard/sl/keymaps/default/keymap.c index 4628a681f62..e47400517ec 100644 --- a/keyboards/htx_studio/one_handed_keyboard_sl/keymaps/default/keymap.c +++ b/keyboards/htx_studio/one_handed_keyboard/sl/keymaps/default/keymap.c @@ -15,22 +15,13 @@ */ #include QMK_KEYBOARD_H - -#define TRACKBALL_DPI_MIN 1000 -#define TRACKBALL_DPI_MAX 8000 -#define TRACKBALL_DPI_DEFAULT 3000 -#define TRACKBALL_DPI_STEP 1000 +#include "one_handed_keyboard.h" enum my_keycodes { DPI_UP = SAFE_RANGE, DPI_DOWN }; -typedef union { - uint16_t TrackballDPI; -} user_config_t; -user_config_t user_config; - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -72,49 +63,26 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif -void pointing_device_init_kb(void) { - wait_ms(10); - user_config.TrackballDPI = eeconfig_read_user(); - wait_ms(10); - adns9800_init(); - wait_ms(10); - pointing_device_set_cpi(user_config.TrackballDPI); -} - // ADNS9800. The CPI range is 800-8200, in increments of 200. bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case DPI_UP: { if (record->event.pressed) { - user_config.TrackballDPI += TRACKBALL_DPI_STEP; - if(user_config.TrackballDPI > TRACKBALL_DPI_MAX) { - user_config.TrackballDPI = TRACKBALL_DPI_MAX; - } - eeconfig_update_user(user_config.TrackballDPI); - pointing_device_set_cpi(user_config.TrackballDPI); - return false; + pointing_adns9800_cpi_up(); } + break; } case DPI_DOWN: { if (record->event.pressed) { - user_config.TrackballDPI -= TRACKBALL_DPI_STEP; - if(user_config.TrackballDPI < TRACKBALL_DPI_MIN) { - user_config.TrackballDPI = TRACKBALL_DPI_MIN; - } - eeconfig_update_user(user_config.TrackballDPI); - pointing_device_set_cpi(user_config.TrackballDPI); - return false; + pointing_adns9800_cpi_down(); } + break; + } + default: break; } - default: return true; - - } } void eeconfig_init_user(void) { - user_config.TrackballDPI = TRACKBALL_DPI_DEFAULT; - wait_ms(10); - pointing_device_set_cpi(user_config.TrackballDPI); - eeconfig_update_user(user_config.TrackballDPI); + pointing_adns9800_reset(); } diff --git a/keyboards/htx_studio/one_handed_keyboard_sl/keymaps/default/rules.mk b/keyboards/htx_studio/one_handed_keyboard/sl/keymaps/default/rules.mk similarity index 100% rename from keyboards/htx_studio/one_handed_keyboard_sl/keymaps/default/rules.mk rename to keyboards/htx_studio/one_handed_keyboard/sl/keymaps/default/rules.mk diff --git a/keyboards/htx_studio/one_handed_keyboard_sl/readme.md b/keyboards/htx_studio/one_handed_keyboard/sl/readme.md similarity index 91% rename from keyboards/htx_studio/one_handed_keyboard_sl/readme.md rename to keyboards/htx_studio/one_handed_keyboard/sl/readme.md index 3bbd7137094..b27b4adb954 100644 --- a/keyboards/htx_studio/one_handed_keyboard_sl/readme.md +++ b/keyboards/htx_studio/one_handed_keyboard/sl/readme.md @@ -12,11 +12,11 @@ This is a keyboard with a fan-shaped layout and 59 keys.The commonly used button Make example for this keyboard (after setting up your build environment): - `make htx_studio/one_handed_keyboard_sl:default` + `make htx_studio/one_handed_keyboard/sl:default` Flashing example for this keyboard: - `make htx_studio/one_handed_keyboard_sl:default:flash` + `make htx_studio/one_handed_keyboard/sl: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). diff --git a/keyboards/htx_studio/one_handed_keyboard_mr/config.h b/keyboards/htx_studio/one_handed_keyboard_mr/config.h deleted file mode 100644 index b5c60197c4d..00000000000 --- a/keyboards/htx_studio/one_handed_keyboard_mr/config.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2025 htx-studio (@https://github.com/htx-studio) - * - * 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 . - */ - -#pragma once - -#define SPI_DRIVER SPID1 -#define SPI_SCK_PIN A5 -#define SPI_MISO_PIN A6 -#define SPI_MOSI_PIN A7 - -#define POINTING_DEVICE_CS_PIN A4 -#define POINTING_DEVICE_MOTION_PIN A3 -#define POINTING_DEVICE_TASK_THROTTLE_MS 1 -#define POINTING_DEVICE_INVERT_X 1 - -#define ENCODER_RESOLUTION 2 - -#ifdef RGB_MATRIX_ENABLE - -#define WS2812_BITBANG_NOP_FUDGE 0 -#define WS2812_PWM_DRIVER PWMD3 -#define WS2812_PWM_CHANNEL 1 -#define WS2812_DMA_STREAM STM32_DMA1_STREAM1 -#define WS2812_DMA_CHANNEL 1 -#define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM3_UP - -#endif - - diff --git a/keyboards/htx_studio/one_handed_keyboard_mr/mcuconf.h b/keyboards/htx_studio/one_handed_keyboard_mr/mcuconf.h deleted file mode 100644 index 348aebd3014..00000000000 --- a/keyboards/htx_studio/one_handed_keyboard_mr/mcuconf.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2020 QMK - * - * 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 . - */ - - #pragma once - - #include_next - -#undef STM32_SPI_USE_SPI1 -#define STM32_SPI_USE_SPI1 TRUE - -/* enable TIM3, used for RGB LED PWM driver */ -#undef STM32_PWM_USE_TIM3 -#define STM32_PWM_USE_TIM3 TRUE - diff --git a/keyboards/htx_studio/one_handed_keyboard_sl/halconf.h b/keyboards/htx_studio/one_handed_keyboard_sl/halconf.h deleted file mode 100644 index 493d3687da7..00000000000 --- a/keyboards/htx_studio/one_handed_keyboard_sl/halconf.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright 2020 QMK - * - * 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 . - */ - - #pragma once - - #define HAL_USE_SPI TRUE - #define SPI_USE_WAIT TRUE - #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD - - #include_next - \ No newline at end of file diff --git a/keyboards/htx_studio/one_handed_keyboard_sl/mcuconf.h b/keyboards/htx_studio/one_handed_keyboard_sl/mcuconf.h deleted file mode 100644 index 0ee034d9740..00000000000 --- a/keyboards/htx_studio/one_handed_keyboard_sl/mcuconf.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2020 QMK - * - * 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 . - */ - - #pragma once - - #include_next - -#undef STM32_SPI_USE_SPI1 -#define STM32_SPI_USE_SPI1 TRUE -