diff options
author | QMK Bot <hello@qmk.fm> | 2021-06-01 04:56:53 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-06-01 04:56:53 +0000 |
commit | d64a853b552885ed8d154793fc2506f727a670a7 (patch) | |
tree | 53a8fdf69cf462c8bbdef973a58e5471fc84633c /keyboards/rubi/keymaps/via | |
parent | 554c36a0555998c57b78a5e66074b8292b0e9577 (diff) | |
parent | 5a06813b105277998b80771f094059047916f4e4 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/rubi/keymaps/via')
-rw-r--r-- | keyboards/rubi/keymaps/via/keymap.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/keyboards/rubi/keymaps/via/keymap.c b/keyboards/rubi/keymaps/via/keymap.c index 3003db8886..1e8cb70c7c 100644 --- a/keyboards/rubi/keymaps/via/keymap.c +++ b/keyboards/rubi/keymaps/via/keymap.c @@ -51,3 +51,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS ), }; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (get_highest_layer(layer_state) == 0) { + uint16_t mapped_code = 0; + if (clockwise) { + mapped_code = handle_encoder_cw(); + } else { + mapped_code = handle_encoder_ccw(); + } + if (mapped_code != 0) { + tap_code16(mapped_code); + } + } else { + if (clockwise) { + if (oled_mode == OLED_MODE_CALC) { + handle_encoder_cw(); + } else if (oled_mode == OLED_MODE_DEFAULT) { + change_encoder_mode(false); + } + } else { + if (oled_mode == OLED_MODE_CALC) { + handle_encoder_ccw(); + } else if (oled_mode == OLED_MODE_DEFAULT) { + change_encoder_mode(true); + } + } + } + } + return true; +} |