summaryrefslogtreecommitdiff
path: root/keyboards/keebio
diff options
context:
space:
mode:
authorjonavin <71780717+Jonavin@users.noreply.github.com>2021-09-28 15:24:12 -0400
committerGitHub <noreply@github.com>2021-09-28 12:24:12 -0700
commit705cd433c22aad00b12183eaa3bada50d90fd97b (patch)
treed529e7d14aca455a8ed494f00ebe4707dac40af6 /keyboards/keebio
parent724ee240751fdfedf33d75fee10d2b97d9f9e3da (diff)
[Keymap] fix NKRO - switch to get_mods() and refactor encoder action code (#14278)
Co-authored-by: Jonavin <=>
Diffstat (limited to 'keyboards/keebio')
-rw-r--r--keyboards/keebio/quefrency/keymaps/jonavin/keymap.c55
1 files changed, 20 insertions, 35 deletions
diff --git a/keyboards/keebio/quefrency/keymaps/jonavin/keymap.c b/keyboards/keebio/quefrency/keymaps/jonavin/keymap.c
index 721148f4dc..415f554e26 100644
--- a/keyboards/keebio/quefrency/keymaps/jonavin/keymap.c
+++ b/keyboards/keebio/quefrency/keymaps/jonavin/keymap.c
@@ -57,46 +57,31 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
};
#ifdef ENCODER_ENABLE // Encoder Functionality
-bool encoder_update_user(uint8_t index, bool clockwise) {
- switch (index)
- {
- case 0: // first encoder (Left Macro set)
- if (clockwise) {
- tap_code(KC_PGDN);
- } else {
- tap_code(KC_PGUP);
- }
+ bool encoder_update_user(uint8_t index, bool clockwise) {
+ uint8_t mods_state = get_mods();
+ switch (index) {
+ case 0: // first encoder (Left Macro set)
+ encoder_action_navpage(clockwise);
+ break;
- default: // other encoder (Top right)
- if ( clockwise ) {
- if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, Page up
- unregister_mods(MOD_BIT(KC_LSFT));
- register_code(KC_PGDN);
- register_mods(MOD_BIT(KC_LSFT));
- } else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next word
- tap_code16(LCTL(KC_RGHT));
- } else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next track
- tap_code(KC_MEDIA_NEXT_TRACK);
+ default: // other encoder (Top right)
+ if (mods_state & MOD_BIT(KC_LSFT) ) { // If you are holding Left shift, change layers
+ encoder_action_layerchange(clockwise);
+ } else if (mods_state & MOD_BIT(KC_RSFT) ) { // If you are holding Right shift, Page up
+ unregister_mods(MOD_BIT(KC_RSFT));
+ encoder_action_navpage(clockwise);
+ register_mods(MOD_BIT(KC_RSFT));
+ } else if (mods_state & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next/prev word
+ encoder_action_navword(clockwise);
+ } else if (mods_state & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next/prev track
+ encoder_action_mediatrack(clockwise);
} else {
- tap_code(KC_VOLU); // Otherwise it just changes volume
- }
- } else {
- if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) {
- unregister_mods(MOD_BIT(KC_LSFT));
- register_code(KC_PGUP);
- register_mods(MOD_BIT(KC_LSFT));
- } else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate previous word
- tap_code16(LCTL(KC_LEFT));
- } else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media previous track
- tap_code(KC_MEDIA_PREV_TRACK);
- } else {
- tap_code(KC_VOLD);
+ encoder_action_volume(clockwise); // Otherwise it just changes volume
}
+ break;
}
- break;
+ return true;
}
- return true;
-}
#endif
#ifdef RGBLIGHT_ENABLE