summaryrefslogtreecommitdiffstats
path: root/keyboards/rubi
diff options
context:
space:
mode:
authorXelus22 <17491233+Xelus22@users.noreply.github.com>2021-06-01 14:56:23 +1000
committerGitHub <noreply@github.com>2021-05-31 21:56:23 -0700
commit5a06813b105277998b80771f094059047916f4e4 (patch)
tree96794823b1e1a2396488a7d53a4c7f5919f73b38 /keyboards/rubi
parent6bafefa88602c8032f6f861844ba0ac886d312a0 (diff)
VIA compile fixes (#13054)
Diffstat (limited to 'keyboards/rubi')
-rw-r--r--keyboards/rubi/keymaps/default/keymap.c31
-rw-r--r--keyboards/rubi/keymaps/via/keymap.c31
-rw-r--r--keyboards/rubi/rubi.c35
3 files changed, 65 insertions, 32 deletions
diff --git a/keyboards/rubi/keymaps/default/keymap.c b/keyboards/rubi/keymaps/default/keymap.c
index 054e3ce232..e0e7290dfe 100644
--- a/keyboards/rubi/keymaps/default/keymap.c
+++ b/keyboards/rubi/keymaps/default/keymap.c
@@ -56,3 +56,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;
+}
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;
+}
diff --git a/keyboards/rubi/rubi.c b/keyboards/rubi/rubi.c
index 6cdf8302c1..50e5fcf782 100644
--- a/keyboards/rubi/rubi.c
+++ b/keyboards/rubi/rubi.c
@@ -73,36 +73,7 @@ bool led_update_kb(led_t led_state) {
return true;
}
-__attribute__ ((weak)) void 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);
- }
- }
- }
- }
-}
-
-void encoder_update_kb(uint8_t index, bool clockwise) {
- encoder_update_user(index, clockwise);
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+ if (!encoder_update_user(index, clockwise)) { return false; }
+ return true;
}