From 37aef4ebe17b04de07a17748e2452c2f1ebe77bd Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 1 Sep 2021 21:08:58 -0700 Subject: [PATCH] [Keymap] Fix Drashna Keymap issues missed before Develop merge (#14271) --- .../tractyl_manuform/5x6_right/f411/config.h | 6 +- .../tractyl_manuform/5x6_right/f411/f411.c | 1 - .../5x6_right/keymaps/drashna/keymap.c | 4 +- .../tractyl_manuform/tractyl_manuform.c | 8 +- .../tractyl_manuform/tractyl_manuform.h | 2 +- .../splitkb/kyria/keymaps/drashna/rules.mk | 7 +- users/drashna/config.h | 98 +----------------- users/drashna/oled_stuff.c | 21 ++-- users/drashna/post_config.h | 99 +++++++++++++++++++ 9 files changed, 132 insertions(+), 114 deletions(-) diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h index cc4efedb86..93ca121590 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h @@ -87,10 +87,12 @@ along with this program. If not, see . #define SPI_MISO_PAL_MODE 5 #define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 -// #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 +#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // #define EXTERNAL_EEPROM_BYTE_COUNT 8196 // #define EXTERNAL_EEPROM_PAGE_SIZE 32 // #define EXTERNAL_EEPROM_ADDRESS_SIZE 2 // #define DEBUG_EEPROM_OUTPUT -#define PMW3360_CS_PIN B0 +#define PMW3360_CS_PIN B0 +#define PMW3360_SPI_MODE 3 +#define PMW3360_SPI_DIVISOR 4 diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c index 1f6028c72a..240219f1d3 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c @@ -22,5 +22,4 @@ void matrix_scan_sub_kb(void) { if (!readPin(A0)) { reset_keyboard(); } - matrix_scan_user(); } diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c index aa93de75db..ac4999161b 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c @@ -71,7 +71,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN3, - KC_ACCEL, _______, _______, + _______, KC_ACCEL, _______, _______, _______, _______, _______ ), [_GAMEPAD] = LAYOUT_5x6_right( @@ -259,7 +259,7 @@ layer_state_t layer_state_set_keymap(layer_state_t state) { } #endif -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE // WPM-responsive animation stuff here # define SLEEP_FRAMES 2 # define SLEEP_SPEED 10 // below this wpm value your animation will idle diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c index 61a6740a2d..aafa343051 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c @@ -46,15 +46,15 @@ __attribute__((weak)) kb_pointer_data_t process_mouse(void) { kb_pointer_data_t temp_data = {.mouse_x = 0, .mouse_y = 0}; report_pmw_t data = pmw_read_burst(); - if (data.isOnSurface && data.isMotion) { // Reset timer if stopped moving if (!data.isMotion) { if (MotionStart != 0) MotionStart = 0; return temp_data; } + if (data.isOnSurface) { // Set timer if new motion - if ((MotionStart == 0) && data.isMotion) { + if (MotionStart == 0) { if (debug_mouse) dprintf("Starting motion.\n"); MotionStart = timer_read(); } @@ -197,3 +197,7 @@ void matrix_scan_kb(void) { matrix_scan_sub_kb(); matrix_scan_user(); } + +#ifdef POINTING_DEVICE_ENABLE +void matrix_power_up(void) { pointing_device_task(); } +#endif diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h index f49569310a..99f1481ad8 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h @@ -43,7 +43,7 @@ typedef struct { uint16_t device_cpi; } kb_config_data_t; -typedef struct { +__attribute__((aligned(16))) typedef struct { int8_t mouse_x; int8_t mouse_y; } kb_pointer_data_t; diff --git a/keyboards/splitkb/kyria/keymaps/drashna/rules.mk b/keyboards/splitkb/kyria/keymaps/drashna/rules.mk index ba273d7d3a..b51cc1b626 100644 --- a/keyboards/splitkb/kyria/keymaps/drashna/rules.mk +++ b/keyboards/splitkb/kyria/keymaps/drashna/rules.mk @@ -14,5 +14,10 @@ UNICODE_ENABLE = no # Unicode KEY_LOCK_ENABLE = no -BOOTLOADER = atmel-dfu +BOOTLOADER = hid +BOOTLOADER_SIZE = 512 +PROGRAM_CMD = $(HID_BOOTLOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex # TAP_DANCE_ENABLE = yes + +WPM_ENABLE = yes +SWAP_HANDS_ENABLE = yes diff --git a/users/drashna/config.h b/users/drashna/config.h index 75e1c11c6d..5e935827bf 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -30,7 +30,7 @@ # ifdef WPM_ENABLE # define SPLIT_WPM_ENABLE # endif -# ifdef OLED_DRIVER_ENABLE +# ifdef OLED_ENABLE # define SPLIT_OLED_ENABLE # endif # if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED) @@ -130,14 +130,6 @@ # define DISABLE_RGB_MATRIX_SOLID_SPLASH # define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH # endif // AVR -# ifndef RGB_MATRIX_REST_MODE -# if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander) -# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL -# else -# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN -# endif -# endif -# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE #endif // RGB_MATRIX_ENABLE #ifdef OLED_ENABLE @@ -171,11 +163,6 @@ # define ONESHOT_TIMEOUT 3000 #endif // !ONESHOT_TIMEOUT -#ifdef QMK_KEYS_PER_SCAN -# undef QMK_KEYS_PER_SCAN -#endif -#define QMK_KEYS_PER_SCAN 4 - // this makes it possible to do rolling combos (zx) with keys that // convert to other keys on hold (z becomes ctrl when you hold it, // and when this option isn't enabled, z rapidly followed by x @@ -213,13 +200,6 @@ # undef LOCKING_RESYNC_ENABLE #endif -#if !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_32BIT) -# define LAYER_STATE_16BIT -#endif -#ifndef DYNAMIC_KEYMAP_LAYER_COUNT -# define DYNAMIC_KEYMAP_LAYER_COUNT 11 -#endif - #ifdef CONVERT_TO_PROTON_C // pins that are available but not present on Pro Micro # define A3 PAL_LINE(GPIOA, 3) @@ -238,79 +218,3 @@ # define C14 PAL_LINE(GPIOC, 14) # define C15 PAL_LINE(GPIOC, 15) #endif - -#ifdef MOUSEKEY_ENABLE -// mouse movement config -# ifdef MK_3_SPEED -# undef MK_3_SPEED -# endif -# define MK_KINETIC_SPEED -# ifdef MK_KINETIC_SPEED -# ifndef MOUSEKEY_DELAY -# define MOUSEKEY_DELAY 8 -# endif -# ifndef MOUSEKEY_INTERVAL -# define MOUSEKEY_INTERVAL 20 -# endif -# ifdef MOUSEKEY_MOVE_DELTA -# define MOUSEKEY_MOVE_DELTA 25 -# endif -# else -# ifndef MOUSEKEY_DELAY -# define MOUSEKEY_DELAY 300 -# endif -# ifndef MOUSEKEY_INTERVAL -# define MOUSEKEY_INTERVAL 50 -# endif -# ifndef MOUSEKEY_MOVE_DELTA -# define MOUSEKEY_MOVE_DELTA 5 -# 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 -// mouse scroll kinetic config -# 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 // MOUSEKEY_ENABLE diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c index debcdcfbe0..0bdd0212be 100644 --- a/users/drashna/oled_stuff.c +++ b/users/drashna/oled_stuff.c @@ -50,11 +50,17 @@ static const char PROGMEM code_to_name[0xFF] = { }; // clang-format on -void add_keylog(uint16_t keycode) { +void add_keylog(uint16_t keycode, keyrecord_t *record) { if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) { - keycode = keycode & 0xFF; - } else if (keycode > 0xFF) { - keycode = 0; + if (((keycode & 0xFF) == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) { + memset(keylog_str, ' ', sizeof(keylog_str) - 1); + return; + } + if (record->tap.count) { + keycode = keycode & 0xFF; + } else if (keycode > 0xFF) { + return; + } } for (uint8_t i = 1; i < KEYLOGGER_LENGTH; i++) { @@ -72,7 +78,7 @@ bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { #ifdef OLED_ENABLE oled_timer = timer_read32(); - add_keylog(keycode); + add_keylog(keycode, record); #endif } return true; @@ -384,9 +390,8 @@ void render_status_main(void) { __attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return rotation; } oled_rotation_t oled_init_user(oled_rotation_t rotation) { - for (uint8_t i = 0; i < (KEYLOGGER_LENGTH - 1); i++) { - add_keylog(0); - } + memset(keylog_str, ' ', sizeof(keylog_str) - 1); + return oled_init_keymap(rotation); } diff --git a/users/drashna/post_config.h b/users/drashna/post_config.h index 7c214b66d0..b9d934c42b 100644 --- a/users/drashna/post_config.h +++ b/users/drashna/post_config.h @@ -38,3 +38,102 @@ # define RGBLIGHT_EFFECT_TWINKLE # endif #endif + +#ifdef RGB_MATRIX_ENABLE +# ifndef RGB_MATRIX_REST_MODE +# if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander) +# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL +# else +# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN +# endif +# endif +# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE +#endif + +#ifdef QMK_KEYS_PER_SCAN +# undef QMK_KEYS_PER_SCAN +#endif +#define QMK_KEYS_PER_SCAN 4 + +#ifdef MOUSEKEY_ENABLE +// mouse movement config +# ifdef MK_3_SPEED +# undef MK_3_SPEED +# endif +# define MK_KINETIC_SPEED +# ifdef MK_KINETIC_SPEED +# ifndef MOUSEKEY_DELAY +# define MOUSEKEY_DELAY 8 +# endif +# ifndef MOUSEKEY_INTERVAL +# define MOUSEKEY_INTERVAL 20 +# endif +# ifndef MOUSEKEY_MOVE_DELTA +# define MOUSEKEY_MOVE_DELTA 25 +# endif +# else +# ifndef MOUSEKEY_DELAY +# define MOUSEKEY_DELAY 300 +# endif +# ifndef MOUSEKEY_INTERVAL +# define MOUSEKEY_INTERVAL 50 +# endif +# ifndef MOUSEKEY_MOVE_DELTA +# define MOUSEKEY_MOVE_DELTA 5 +# 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 +// mouse scroll kinetic config +# 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 // MOUSEKEY_ENABLE + +#if !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_32BIT) +# define LAYER_STATE_16BIT +#endif +#ifndef DYNAMIC_KEYMAP_LAYER_COUNT +# define DYNAMIC_KEYMAP_LAYER_COUNT 11 +#endif