diff options
Diffstat (limited to 'keyboards/rubi/keymaps/via/keymap.c')
-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 3003db888..1e8cb70c7 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] = { | |||
51 | KC_TRNS, KC_TRNS | 51 | KC_TRNS, KC_TRNS |
52 | ), | 52 | ), |
53 | }; | 53 | }; |
54 | |||
55 | bool encoder_update_user(uint8_t index, bool clockwise) { | ||
56 | if (index == 0) { | ||
57 | if (get_highest_layer(layer_state) == 0) { | ||
58 | uint16_t mapped_code = 0; | ||
59 | if (clockwise) { | ||
60 | mapped_code = handle_encoder_cw(); | ||
61 | } else { | ||
62 | mapped_code = handle_encoder_ccw(); | ||
63 | } | ||
64 | if (mapped_code != 0) { | ||
65 | tap_code16(mapped_code); | ||
66 | } | ||
67 | } else { | ||
68 | if (clockwise) { | ||
69 | if (oled_mode == OLED_MODE_CALC) { | ||
70 | handle_encoder_cw(); | ||
71 | } else if (oled_mode == OLED_MODE_DEFAULT) { | ||
72 | change_encoder_mode(false); | ||
73 | } | ||
74 | } else { | ||
75 | if (oled_mode == OLED_MODE_CALC) { | ||
76 | handle_encoder_ccw(); | ||
77 | } else if (oled_mode == OLED_MODE_DEFAULT) { | ||
78 | change_encoder_mode(true); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | return true; | ||
84 | } | ||