summaryrefslogtreecommitdiff
path: root/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-12-14 20:53:36 -0800
committerGitHub <noreply@github.com>2021-12-14 20:53:36 -0800
commit3fa592a4024a24a636fa0c562e6761667a94f565 (patch)
tree4ce826128e29e36dfe606fa2b5a3d25b3bd0afcc /keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
parentc10bc9f91e737dd3675b2e4492daa09092655af9 (diff)
[Keymap] Unicode and Pointing Device and Autocorect for drashna keymaps (#15415)
Diffstat (limited to 'keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c')
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c121
1 files changed, 3 insertions, 118 deletions
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 f893a8cc41..958f694172 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
@@ -16,11 +16,6 @@
#include "drashna.h"
-enum tractyl_keycodes {
- KC_ACCEL = NEW_SAFE_RANGE,
-};
-
-bool enable_acceleration = false;
// clang-format off
#define LAYOUT_5x6_right_wrapper(...) LAYOUT_5x6_right(__VA_ARGS__)
#define LAYOUT_5x6_right_base( \
@@ -129,10 +124,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST,
KEYLOCK, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS,
UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
- HPT_DWLI, HPT_DWLD, TG_GAME, TG_DBLO,
- HPT_TOG, HPT_BUZ, KC_NUKE,
+ TG(_DIABLOII), AUTO_CTN, TG_GAME, TG_DBLO,
+ _______, _______, KC_NUKE,
_______, _______, _______,
- _______, TG(_DIABLOII),KC_NUKE, _______
+ _______, _______, KC_NUKE, _______
),
};
@@ -169,116 +164,6 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
}
#endif
-#ifdef POINTING_DEVICE_ENABLE
-static uint16_t mouse_timer = 0;
-static uint16_t mouse_debounce_timer = 0;
-static uint8_t mouse_keycode_tracker = 0;
-bool tap_toggling = false;
-
-# ifdef TAPPING_TERM_PER_KEY
-# define TAP_CHECK get_tapping_term(KC_BTN1, NULL)
-# else
-# ifndef TAPPING_TERM
-# define TAPPING_TERM 200
-# endif
-# define TAP_CHECK TAPPING_TERM
-# endif
-
-report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
- int8_t x = mouse_report.x, y = mouse_report.y;
- mouse_report.x = 0;
- mouse_report.y = 0;
-
- if (x != 0 && y != 0) {
- mouse_timer = timer_read();
-# ifdef OLED_ENABLE
- oled_timer = timer_read32();
-# endif
- if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) {
- if (enable_acceleration) {
- x = (x > 0 ? x * x / 16 + x : -x * x / 16 + x);
- y = (y > 0 ? y * y / 16 + y : -y * y / 16 + y);
- }
- mouse_report.x = x;
- mouse_report.y = y;
- if (!layer_state_is(_MOUSE)) {
- layer_on(_MOUSE);
- }
- }
- }
- return mouse_report;
-}
-
-void matrix_scan_keymap(void) {
- if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) {
- layer_off(_MOUSE);
- }
- if (tap_toggling) {
- if (!layer_state_is(_MOUSE)) {
- layer_on(_MOUSE);
- }
- }
-}
-
-bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
- switch (keycode) {
- case TT(_MOUSE):
- if (record->event.pressed) {
- mouse_keycode_tracker++;
- } else {
-# if TAPPING_TOGGLE != 0
- if (record->tap.count == TAPPING_TOGGLE) {
- tap_toggling ^= 1;
-# if TAPPING_TOGGLE == 1
- if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1;
-# else
- if (!tap_toggling) mouse_keycode_tracker -= record->tap.count;
-# endif
- } else {
- mouse_keycode_tracker--;
- }
-# endif
- }
- mouse_timer = timer_read();
- break;
- case TG(_MOUSE):
- if (record->event.pressed) {
- tap_toggling ^= 1;
- }
- break;
- case MO(_MOUSE):
- case DPI_CONFIG:
- case KC_MS_UP ... KC_MS_WH_RIGHT:
- record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
- mouse_timer = timer_read();
- case KC_ACCEL:
- enable_acceleration = record->event.pressed;
- break;
- default:
- if (IS_NOEVENT(record->event)) break;
- if ((keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) && (((keycode >> 0x8) & 0xF) == _MOUSE)) {
- record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
- mouse_timer = timer_read();
- break;
- }
- if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) {
- layer_off(_MOUSE);
- }
- mouse_keycode_tracker = 0;
- mouse_debounce_timer = timer_read();
- break;
- }
- return true;
-}
-
-layer_state_t layer_state_set_keymap(layer_state_t state) {
- if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO)) {
- state |= ((layer_state_t)1 << _MOUSE);
- }
- return state;
-}
-#endif
-
#ifdef OLED_ENABLE
// WPM-responsive animation stuff here
# define SLEEP_FRAMES 2