summaryrefslogtreecommitdiff
path: root/keyboards/handwired/tractyl_manuform/5x6_right
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-08-07 21:40:48 -0700
committerGitHub <noreply@github.com>2021-08-07 21:40:48 -0700
commitb9dcd5ac38bc7cd3dc2fb97ac3842df03ee5f780 (patch)
tree8e7717785d6632f5f13ee769432133ee6726a0a1 /keyboards/handwired/tractyl_manuform/5x6_right
parent100333818f4868cee811854ccc44e4b9ea39a79d (diff)
[Keymap] Drashna split transport improvement (#13905)
* Fix up split stuff * Fix Split perf issues * Allow LTO to be disabled * Fixup WPM and encoders * Fixup qmk keys per scan * Add bootloader info * Change encoder pins * Fixup corne oled code * Expand transport sync * Improve user transport * Cleanup mouse processing at keymap level * Improve layer checking for mouse layering
Diffstat (limited to 'keyboards/handwired/tractyl_manuform/5x6_right')
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/config.h2
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c73
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk2
3 files changed, 45 insertions, 32 deletions
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h
index 915582c07e..260fa038e4 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/config.h
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h
@@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ENCODERS_PAD_A \
{ D5 }
#define ENCODERS_PAD_B \
- { D6 }
+ { D4 }
#define ENCODER_RESOLUTION 4
/* Set 0 if debouncing isn't needed */
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 a57da64d54..61f302f168 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
@@ -140,9 +140,9 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
#else
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
- tap_code_delay(clockwise ? KC_VOLU : KC_VOLD, 5);
+ tap_code_delay(clockwise ? KC_VOLD : KC_VOLU, 5);
} else if (index == 1) {
- tap_code_delay(clockwise ? KC_WH_U : KC_WH_D, 5);
+ tap_code_delay(clockwise ? KC_WH_D : KC_WH_U, 5);
}
return false;
}
@@ -155,26 +155,29 @@ static uint16_t mouse_debounce_timer = 0;
static uint8_t mouse_keycode_tracker = 0;
bool tap_toggling = false;
-void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
- if ((x || y) && timer_elapsed(mouse_timer) > 125) {
- mouse_timer = timer_read();
- if (!layer_state_is(_MOUSE) && !(layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO)) && timer_elapsed(mouse_debounce_timer) > 125) {
- layer_on(_MOUSE);
- }
- }
-
# ifdef TAPPING_TERM_PER_KEY
- if (timer_elapsed(mouse_debounce_timer) > get_tapping_term(KC_BTN1, NULL)
+# define TAP_CHECK get_tapping_term(KC_BTN1, NULL)
# else
- if (timer_elapsed(mouse_debounce_timer) > TAPPING_TERM
+# ifndef TAPPING_TERM
+# define TAPPING_TERM 200
+# endif
+# define TAP_CHECK TAPPING_TERM
# endif
- || (layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO))) {
- mouse_report->x = x;
- mouse_report->y = y;
- }
+
+void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
+ if (x != 0 && y != 0) {
+ mouse_timer = timer_read();
# ifdef OLED_DRIVER_ENABLE
- if (x || y) oled_timer = timer_read32();
+ oled_timer = timer_read32();
# endif
+ if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) {
+ mouse_report->x = x;
+ mouse_report->y = y;
+ if (!layer_state_is(_MOUSE)) {
+ layer_on(_MOUSE);
+ }
+ }
+ }
}
void matrix_scan_keymap(void) {
@@ -191,26 +194,29 @@ void matrix_scan_keymap(void) {
bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
switch (keycode) {
case TT(_MOUSE):
- {
- if (record->event.pressed) {
- mouse_keycode_tracker++;
- } else {
+ if (record->event.pressed) {
+ mouse_keycode_tracker++;
+ } else {
# if TAPPING_TOGGLE != 0
- if (record->tap.count == TAPPING_TOGGLE) {
- tap_toggling ^= 1;
+ if (record->tap.count == TAPPING_TOGGLE) {
+ tap_toggling ^= 1;
# if TAPPING_TOGGLE == 1
- if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1;
+ if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1;
# else
- if (!tap_toggling) mouse_keycode_tracker -= record->tap.count;
+ if (!tap_toggling) mouse_keycode_tracker -= record->tap.count;
# endif
- } else {
- mouse_keycode_tracker--;
- }
-# endif
+ } else {
+ mouse_keycode_tracker--;
}
- mouse_timer = timer_read();
- break;
+# 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:
@@ -219,6 +225,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
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);
}
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 b95b166d8d..585a2e9d8c 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk
@@ -10,3 +10,5 @@ WPM_ENABLE = yes
ENCODER_ENABLE = yes
ENCODER_MAP_ENABLE = yes
# DEBOUNCE_TYPE = sym_eager_pk
+
+LTO_SUPPORTED = no