diff options
author | Drashna Jaelre <drashna@live.com> | 2022-03-06 22:12:17 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 22:12:17 -0800 |
commit | ff6c70415c536e6435023627197550889ffa1501 (patch) | |
tree | 79fd0a25632f7ed2483542b8ab0731b5b2709bbd /keyboards/handwired/tractyl_manuform | |
parent | d8971d707eddea5d16ef5fa3dad807b494aed39f (diff) |
[Keymap] Drashna Mouse keys and oled updates (#16556)
Diffstat (limited to 'keyboards/handwired/tractyl_manuform')
9 files changed, 72 insertions, 46 deletions
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h index d868eae48e..05b5776ac3 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h @@ -21,8 +21,8 @@ #undef STM32_I2C_USE_I2C1 #define STM32_I2C_USE_I2C1 TRUE -#undef STM32_I2C_I2C1_RX_DMA_STREAM -#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) +// #undef STM32_I2C_I2C1_RX_DMA_STREAM +// #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) #undef STM32_I2C_I2C1_TX_DMA_STREAM #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) @@ -35,19 +35,9 @@ #undef STM32_SPI_USE_SPI1 #define STM32_SPI_USE_SPI1 TRUE -#undef STM32_SPI_SPI1_RX_DMA_STREAM -#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) -#undef STM32_SPI_SPI1_TX_DMA_STREAM -#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) - #undef STM32_SERIAL_USE_USART2 #define STM32_SERIAL_USE_USART2 TRUE -#undef STM32_UART_USART2_RX_DMA_STREAM -#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#undef STM32_UART_USART2_TX_DMA_STREAM -#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) - #undef STM32_GPT_USE_TIM4 #define STM32_GPT_USE_TIM4 TRUE diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/info.json b/keyboards/handwired/tractyl_manuform/5x6_right/info.json index 51eb009aa5..81a308fd21 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/info.json +++ b/keyboards/handwired/tractyl_manuform/5x6_right/info.json @@ -1,7 +1,6 @@ { "keyboard_name": "Tractyl Manuform 5x6", "url": "", - "maintainer": "drashna", "layouts": { "LAYOUT_5x6_right": { "layout": [ diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h index c3a30d2bc8..2a7a18f01b 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h @@ -22,3 +22,8 @@ #ifdef OLED_DRIVER_SH1107 # undef OLED_DISPLAY_128X64 #endif + +# define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200 +# define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 200 +# define CHARYBDIS_MINIMUM_SNIPING_DPI 400 +# define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 200 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 570760cf66..82fd4cbea3 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c @@ -60,13 +60,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_MOUSE] = LAYOUT_5x6_right( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, KC_WH_U, DPI_MOD, DPI_RMOD,S_D_MOD, S_D_RMOD,DRGSCRL, + _______, _______, _______, _______, _______, _______, DRGSCRL, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, SNP_TOG, + _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, SNIPING, _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN3, - _______, KC_ACCEL, _______, + _______, _______, _______, _______, _______, _______, _______ ), [_GAMEPAD] = LAYOUT_5x6_right( @@ -104,30 +104,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _________________LOWER_L1__________________, _________________LOWER_R1__________________, _______, _______, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, - _______, _______, _______, _______, - _______, _______, _______, - _______, _______, _______, - _______, _______, _______, _______ + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______ ), [_RAISE] = LAYOUT_5x6_right_wrapper( - KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, - KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, - _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, - _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, - _______, _______, _______, _______, - _______, _______, _______, - _______, _______, _______, - _______, _______, _______, _______ + KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, + KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______ ), [_ADJUST] = LAYOUT_5x6_right_wrapper( - KC_MAKE, KC_WIDE,KC_AUSSIE,KC_SCRIPT,KC_ZALGO,KC_NOMODE, KC_NOMODE,KC_BLOCKS,KC_REGIONAL,_______,_______, KC_RST, - VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST, - KEYLOCK, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS, - UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, - TG(_DIABLOII), AUTO_CTN, TG_GAME, TG_DBLO, - _______, REBOOT, KC_NUKE, - _______, _______, _______, - _______, _______, KC_NUKE, _______ + KC_MAKE, KC_WIDE,KC_AUSSIE,KC_SCRIPT,KC_ZALGO,KC_NOMODE, KC_NOMODE,KC_BLOCKS,KC_REGIONAL,_______,_______, KC_RST, + VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST, + KEYLOCK, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS, + UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, + TG(_DIABLOII), AUTO_CTN, TG_GAME, TG_DBLO, + _______, REBOOT, KC_NUKE, + _______, _______, _______, + _______, _______, KC_NUKE, _______ ), }; @@ -149,6 +149,16 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { }; // clang-format on #else + +deferred_token encoder_token = INVALID_DEFERRED_TOKEN; +static int8_t last_direction = -1; + +static uint32_t encoder_callback(uint32_t trigger_time, void *cb_arg) { + unregister_code(last_direction ? KC_WH_D : KC_WH_U); + last_direction = -1; + return 0; +} + bool encoder_update_user(uint8_t index, bool clockwise) { # ifdef SWAP_HANDS_ENABLE if (swap_hands) { @@ -158,7 +168,20 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { tap_code_delay(clockwise ? KC_VOLD : KC_VOLU, 5); } else if (index == 1) { - tap_code_delay(clockwise ? KC_WH_D : KC_WH_U, 5); + if (last_direction != clockwise || encoder_token == INVALID_DEFERRED_TOKEN) { + uint8_t keycode = clockwise ? KC_WH_D : KC_WH_U; + last_direction = clockwise; + if (encoder_token != INVALID_DEFERRED_TOKEN) { + if (cancel_deferred_exec(encoder_token)) { + encoder_token = INVALID_DEFERRED_TOKEN; + } + unregister_code(clockwise ? KC_WH_U : KC_WH_D); + } + register_code(keycode); + encoder_token = defer_exec(MOUSEKEY_WHEEL_DELAY + MOUSEKEY_WHEEL_INTERVAL, encoder_callback, NULL); + } else { + extend_deferred_exec(encoder_token, MOUSEKEY_WHEEL_INTERVAL); + } } return false; } @@ -167,7 +190,9 @@ bool encoder_update_user(uint8_t index, bool clockwise) { #ifdef OLED_ENABLE extern uint16_t typing_mode; -oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_180; } +oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { + return OLED_ROTATION_180; +} void oled_render_large_display(void) { if (is_keyboard_left()) { @@ -176,13 +201,16 @@ void oled_render_large_display(void) { oled_advance_page(true); oled_advance_page(true); + // clang-format off static const char PROGMEM logo[] = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 }; + // clang-format on oled_write_P(logo, false); +# ifdef CUSTOM_UNICODE_ENABLE oled_set_cursor(1, 14); oled_write_ln_P(PSTR("Unicode:"), false); switch (typing_mode) { @@ -204,10 +232,14 @@ void oled_render_large_display(void) { case KC_ZALGO: oled_write_P(PSTR(" Zalgo"), false); break; - default: + case KC_NOMODE: oled_write_P(PSTR(" Normal"), false); break; + default: + oled_write_P(PSTR(" Unknown"), false); + break; } +# endif } } #endif diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk index 9ef58ab5ec..4cad07ef66 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk @@ -10,6 +10,7 @@ ENCODER_ENABLE = yes ENCODER_MAP_ENABLE = yes AUTOCORRECTION_ENABLE = yes CAPS_WORD_ENABLE = yes +DEFERRED_EXEC_ENABLE = yes ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/elite_c) RGBLIGHT_ENABLE = no diff --git a/keyboards/handwired/tractyl_manuform/config.h b/keyboards/handwired/tractyl_manuform/config.h index f9160ea148..821f9be9b6 100644 --- a/keyboards/handwired/tractyl_manuform/config.h +++ b/keyboards/handwired/tractyl_manuform/config.h @@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* USB Device descriptor parameter */ #define VENDOR_ID 0x44DD -#define MANUFACTURER Drashna /* disable debug print */ // #define NO_DEBUG diff --git a/keyboards/handwired/tractyl_manuform/info.json b/keyboards/handwired/tractyl_manuform/info.json new file mode 100644 index 0000000000..7214e6773b --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/info.json @@ -0,0 +1,4 @@ +{ + "manufacturer": "QMK Community", + "maintainer": "Drashna Jael're" +} diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c index 033146134d..0ae49b6397 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c @@ -247,7 +247,7 @@ static bool has_shift_mod(void) { * - default DPI: internal table index/actual DPI * - sniping DPI: internal table index/actual DPI */ -static void debug_charybdis_config_to_console(charybdis_config_t* config) { +__attribute__((unused)) static void debug_charybdis_config_to_console(charybdis_config_t* config) { # ifdef CONSOLE_ENABLE dprintf("(charybdis) process_record_kb: config = {\n" "\traw = 0x%04X,\n" @@ -264,7 +264,6 @@ static void debug_charybdis_config_to_console(charybdis_config_t* config) { bool process_record_kb(uint16_t keycode, keyrecord_t* record) { if (!process_record_user(keycode, record)) { - debug_charybdis_config_to_console(&g_charybdis_config); return false; } # ifndef NO_CHARYBDIS_KEYCODES @@ -321,7 +320,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { pointing_device_send(); } # endif // !MOUSEKEY_ENABLE - debug_charybdis_config_to_console(&g_charybdis_config); return true; } diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h index 197aee985e..b62b6f7553 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h @@ -24,8 +24,6 @@ # include "4x6_right.h" #endif -#ifdef POINTING_DEVICE_ENABLE -# ifndef NO_CHARYBDIS_KEYCODES enum charybdis_keycodes { # ifdef VIA_ENABLE POINTER_DEFAULT_DPI_FORWARD = USER00, @@ -50,8 +48,8 @@ enum charybdis_keycodes { # define SNP_TOG SNIPING_MODE_TOGGLE # define DRGSCRL DRAGSCROLL_MODE # define DRG_TOG DRAGSCROLL_MODE_TOGGLE -# endif // !NO_CHARYBDIS_KEYCODES +#ifdef POINTING_DEVICE_ENABLE /** \brief Return the current DPI value for the pointer's default mode. */ uint16_t charybdis_get_pointer_default_dpi(void); |