From db0216ceacb8f01532c6ce37bcac64e9a112537d Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Tue, 31 Dec 2024 12:25:31 -0800 Subject: [PATCH] [TractylM] Add changes from PR --- .../tractyl_manuform/5x6_right/config.h | 2 - .../tractyl_manuform/5x6_right/f405/config.h | 4 +- .../tractyl_manuform/5x6_right/f405/f405.c | 4 +- .../5x6_right/f405/keyboard.json | 13 +- .../tractyl_manuform/5x6_right/f405/rules.mk | 2 - .../tractyl_manuform/5x6_right/f411/config.h | 2 +- .../tractyl_manuform/5x6_right/f411/rules.mk | 2 - .../tractyl_manuform/5x6_right/post_rules.mk | 1 + keyboards/handwired/tractyl_manuform/config.h | 12 -- .../handwired/tractyl_manuform/info.json | 6 +- .../handwired/tractyl_manuform/post_config.h | 112 ------------------ .../tractyl_manuform/tractyl_manuform.c | 46 ++++--- 12 files changed, 39 insertions(+), 167 deletions(-) delete mode 100644 keyboards/handwired/tractyl_manuform/5x6_right/f405/rules.mk delete mode 100644 keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk create mode 100644 keyboards/handwired/tractyl_manuform/5x6_right/post_rules.mk delete mode 100644 keyboards/handwired/tractyl_manuform/post_config.h diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h index df5aaa737dc4..686cb30fc213 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h @@ -21,6 +21,4 @@ along with this program. If not, see . #define ROTATIONAL_TRANSFORM_ANGLE -25 #define POINTING_DEVICE_INVERT_X -#define LAYER_STATE_16BIT - #define POINTING_DEVICE_RIGHT diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f405/config.h index f8196bdbd744..22ad519db0bd 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f405/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/config.h @@ -71,7 +71,7 @@ along with this program. If not, see . #define POINTING_DEVICE_CS_PIN B8 #define POINTING_DEVICE_ROTATION_270 #undef ROTATIONAL_TRANSFORM_ANGLE -#define PMW33XX_SPI_DIVISOR 8 +#define PMW33XX_SPI_DIVISOR 16 // lcd #define DISPLAY_RST_PIN NO_PIN @@ -82,5 +82,3 @@ along with this program. If not, see . #define DRV2605L_FB_ERM_LRA 0 #define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100 #define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_BUZZ_1_100 - -#define VIA_FIRMWARE_VERSION 0x00000001 diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/f405.c b/keyboards/handwired/tractyl_manuform/5x6_right/f405/f405.c index 4e971be8d5e2..8382c2d8bfd8 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f405/f405.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/f405.c @@ -40,7 +40,9 @@ bool check_user_button_state(void) { } void board_init(void) { - // unset improper SPI pins + // Board setup sets these pins as SPI, but we aren't using them as such. + // So to prevent them from misbehaving, we need to set them to a different, non-spi mode. + // This is a bit of a hack, but nothing else runs soon enough, without re-implementing spi_init(). gpio_set_pin_input(A5); gpio_set_pin_input(A6); gpio_set_pin_input(A7); diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/keyboard.json b/keyboards/handwired/tractyl_manuform/5x6_right/f405/keyboard.json index 74502b732590..714ad852b558 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f405/keyboard.json +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/keyboard.json @@ -20,6 +20,14 @@ {"pin_a": "A15", "pin_b": "C0"} ] }, + "eeprom": { + "driver": "wear_leveling", + "wear_leveling": { + "driver": "spi_flash", + "backing_size": 16384, + "logical_size": 4096 + } + }, "features": { "console": true, "haptic": true @@ -51,11 +59,6 @@ } } }, - "usb": { - "shared_endpoint": { - "keyboard": true - } - }, "ws2812": { "driver": "pwm", "pin": "C6" diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/f405/rules.mk deleted file mode 100644 index b796152a7173..000000000000 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f405/rules.mk +++ /dev/null @@ -1,2 +0,0 @@ -MOUSE_SHARED_EP = yes - diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h index 109fb7282e5c..bbbc16e3eaec 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h @@ -75,4 +75,4 @@ along with this program. If not, see . /* pmw3360 config */ #define PMW33XX_CS_PIN B0 -#define PMW33XX_SPI_DIVISOR 8 +#define PMW33XX_SPI_DIVISOR 8 diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk deleted file mode 100644 index 4aa582e7a226..000000000000 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk +++ /dev/null @@ -1,2 +0,0 @@ -KEYBOARD_SHARED_EP = yes -MOUSE_SHARED_EP = yes diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/post_rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/post_rules.mk new file mode 100644 index 000000000000..fab9162dc64d --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/post_rules.mk @@ -0,0 +1 @@ +POINTING_DEVICE_DRIVER = pmw3360 diff --git a/keyboards/handwired/tractyl_manuform/config.h b/keyboards/handwired/tractyl_manuform/config.h index 9f4dd8651baf..5a8091a098d5 100644 --- a/keyboards/handwired/tractyl_manuform/config.h +++ b/keyboards/handwired/tractyl_manuform/config.h @@ -18,18 +18,6 @@ along with this program. If not, see . #pragma once - -/* disable debug print */ -// #define NO_DEBUG - -/* disable print */ -// #define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT - #define SPLIT_POINTING_ENABLE #define POINTING_DEVICE_TASK_THROTTLE_MS 1 diff --git a/keyboards/handwired/tractyl_manuform/info.json b/keyboards/handwired/tractyl_manuform/info.json index c84d008e152e..fb50c8d3592d 100644 --- a/keyboards/handwired/tractyl_manuform/info.json +++ b/keyboards/handwired/tractyl_manuform/info.json @@ -2,6 +2,10 @@ "manufacturer": "QMK Community", "maintainer": "Drashna Jael're", "usb": { - "vid": "0x44DD" + "vid": "0x44DD", + "shared_endpoint": { + "keyboard": true, + "mouse": true + } } } diff --git a/keyboards/handwired/tractyl_manuform/post_config.h b/keyboards/handwired/tractyl_manuform/post_config.h deleted file mode 100644 index b5d67132b260..000000000000 --- a/keyboards/handwired/tractyl_manuform/post_config.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright 2012 Jun Wako -Copyright 2015 Jack Humbert - -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 - -// mouse config -#ifdef MOUSEKEY_ENABLE -# ifndef MOUSEKEY_MOVE_DELTA -# ifndef MK_KINETIC_SPEED -# define MOUSEKEY_MOVE_DELTA 5 -# else -# define MOUSEKEY_MOVE_DELTA 25 -# endif -# endif -# ifndef MOUSEKEY_DELAY -# ifndef MK_KINETIC_SPEED -# define MOUSEKEY_DELAY 300 -# else -# define MOUSEKEY_DELAY 8 -# endif -# endif -# ifndef MOUSEKEY_INTERVAL -# ifndef MK_KINETIC_SPEED -# define MOUSEKEY_INTERVAL 50 -# else -# define MOUSEKEY_INTERVAL 20 -# endif -# endif -# ifndef MOUSEKEY_MAX_SPEED -# define MOUSEKEY_MAX_SPEED 7 -# endif -# ifndef MOUSEKEY_TIME_TO_MAX -# define MOUSEKEY_TIME_TO_MAX 60 -# endif -# ifndef MOUSEKEY_INITIAL_SPEED -# define MOUSEKEY_INITIAL_SPEED 100 -# endif -# ifndef MOUSEKEY_BASE_SPEED -# define MOUSEKEY_BASE_SPEED 1000 -# endif -# ifndef MOUSEKEY_DECELERATED_SPEED -# define MOUSEKEY_DECELERATED_SPEED 400 -# endif -# ifndef MOUSEKEY_ACCELERATED_SPEED -# define MOUSEKEY_ACCELERATED_SPEED 3000 -# endif - -// mouse scroll config -# ifndef MOUSEKEY_WHEEL_DELAY -# define MOUSEKEY_WHEEL_DELAY 15 -# endif -# ifndef MOUSEKEY_WHEEL_DELTA -# define MOUSEKEY_WHEEL_DELTA 1 -# endif -# ifndef MOUSEKEY_WHEEL_INTERVAL -# define MOUSEKEY_WHEEL_INTERVAL 50 -# endif -# ifndef MOUSEKEY_WHEEL_MAX_SPEED -# define MOUSEKEY_WHEEL_MAX_SPEED 8 -# endif -# ifndef MOUSEKEY_WHEEL_TIME_TO_MAX -# define MOUSEKEY_WHEEL_TIME_TO_MAX 80 -# endif - -# ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS -# define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 8 -# endif -# ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS -# define MOUSEKEY_WHEEL_BASE_MOVEMENTS 48 -# endif -# ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS -# define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48 -# endif -# ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS -# define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8 -# endif -#endif - -#ifndef DEBOUNCE -# define DEBOUNCE 5 -#endif - -#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_LIMIT_VAL) -# if defined(OLED_ENABLE) -# define RGBLIGHT_LIMIT_VAL 100 -# else -# define RGBLIGHT_LIMIT_VAL 150 -# endif -#endif - -#if !defined(OLED_BRIGHTNESS) -# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) -# define OLED_BRIGHTNESS 80 -# else -# define OLED_BRIGHTNESS 150 -# endif -#endif diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c index fdf128ca5330..c37a67b15791 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c @@ -15,11 +15,9 @@ */ #include "tractyl_manuform.h" -#include "keyboard.h" #ifdef POINTING_DEVICE_ENABLE -#include "pointing_device.h" +# include "pointing_device.h" #endif -#include "quantum.h" #include "transactions.h" #include @@ -317,10 +315,6 @@ void eeconfig_init_kb(void) { eeconfig_init_user(); } -void matrix_init_kb(void) { - read_charybdis_config_from_eeprom(&g_charybdis_config); - matrix_init_user(); -} void matrix_power_up(void) { pointing_device_task(); } @@ -360,16 +354,21 @@ void keyboard_post_init_kb(void) { void keyboard_pre_init_kb(void) { user_button_init(); + read_charybdis_config_from_eeprom(&g_charybdis_config); keyboard_pre_init_user(); } +__attribute__((weak)) void execute_user_button_action(void) { + if (is_keyboard_master()) { + reset_keyboard(); + } else { + soft_reset_keyboard(); + } +} + void housekeeping_task_kb(void) { if (check_user_button_state()) { - if (is_keyboard_master()) { - reset_keyboard(); - } else { - soft_reset_keyboard(); - } + execute_user_button_action(); } #ifdef POINTING_DEVICE_ENABLE @@ -401,16 +400,14 @@ void housekeeping_task_kb(void) { } #ifdef USER_BUTTON_PIN -__attribute__((weak)) void bootmagic_scan(void) { - // We need multiple scans because debouncing can't be turned off. - matrix_scan(); -# if defined(DEBOUNCE) && DEBOUNCE > 0 - wait_ms(DEBOUNCE * 2); -# else - wait_ms(30); -# endif - matrix_scan(); - +/** + * @brief Replace and add upon the default bootmagic reset function. + * In this case, we also check the user button. + * + * @return true if the user button is pressed, or normal bootmagic key position. + * @return false if the user button is not pressed and normal bootmagic key position is not pressed. + */ +__attribute__((weak)) bool bootmagic_should_reset(void) { uint8_t row = BOOTMAGIC_ROW; uint8_t col = BOOTMAGIC_COLUMN; @@ -421,10 +418,7 @@ __attribute__((weak)) void bootmagic_scan(void) { } # endif - if (matrix_get_row(row) & (1 << col) || (is_keyboard_master() && check_user_button_state())) { - eeconfig_disable(); - bootloader_jump(); - } + return matrix_get_row(row) & (1 << col) || check_user_button_state(); } #endif // USER_BUTTON_PIN