diff options
author | Drashna Jaelre <drashna@live.com> | 2021-05-21 23:17:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 23:17:32 -0700 |
commit | a0fed0ea176d1c986e40fc4981b900509c90d66e (patch) | |
tree | ee12f5943046015ea0dce8e2a30a68bc8eb99dbe /keyboards/splitkb | |
parent | 76c23b15abc824f867b48d8d5100dced2417d336 (diff) | |
download | qmk_firmware-a0fed0ea176d1c986e40fc4981b900509c90d66e.tar.gz qmk_firmware-a0fed0ea176d1c986e40fc4981b900509c90d66e.zip |
Convert Encoder callbacks to be boolean functions (#12805)
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'keyboards/splitkb')
-rw-r--r-- | keyboards/splitkb/zima/keymaps/drashna/keymap.c | 12 | ||||
-rw-r--r-- | keyboards/splitkb/zima/zima.c | 14 |
2 files changed, 10 insertions, 16 deletions
diff --git a/keyboards/splitkb/zima/keymaps/drashna/keymap.c b/keyboards/splitkb/zima/keymaps/drashna/keymap.c index 9d3919ee2..d9e1f44e2 100644 --- a/keyboards/splitkb/zima/keymaps/drashna/keymap.c +++ b/keyboards/splitkb/zima/keymaps/drashna/keymap.c | |||
@@ -122,19 +122,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) { | |||
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | void encoder_update_user(uint8_t index, bool clockwise) { | 125 | bool encoder_update_user(uint8_t index, bool clockwise) { |
126 | if (clockwise) { | 126 | if (clockwise) { |
127 | tap_code16(KC_VOLU); | 127 | tap_code16(KC_VOLU); |
128 | } else { | 128 | } else { |
129 | tap_code16(KC_VOLD); | 129 | tap_code16(KC_VOLD); |
130 | } | 130 | } |
131 | # ifdef OLED_DRIVER_ENABLE | 131 | return true; |
132 | oled_timer = timer_read32(); | ||
133 | # endif | ||
134 | # if defined(AUDIO_ENABLE) && defined(AUDIO_CLICKY) | ||
135 | if (is_audio_on() && is_clicky_on()) clicky_play(); | ||
136 | # endif | ||
137 | # ifdef HAPTIC_ENABLE | ||
138 | if (haptic_config.enable) haptic_play(); | ||
139 | # endif | ||
140 | } | 132 | } |
diff --git a/keyboards/splitkb/zima/zima.c b/keyboards/splitkb/zima/zima.c index 3989ebeb2..74f9c84a7 100644 --- a/keyboards/splitkb/zima/zima.c +++ b/keyboards/splitkb/zima/zima.c | |||
@@ -93,12 +93,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { | |||
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | #ifdef ENCODER_ENABLE | 95 | #ifdef ENCODER_ENABLE |
96 | __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) { | 96 | bool encoder_update_kb(uint8_t index, bool clockwise) { |
97 | if (clockwise) { | ||
98 | tap_code16(KC_VOLU); | ||
99 | } else { | ||
100 | tap_code16(KC_VOLD); | ||
101 | } | ||
102 | # ifdef OLED_DRIVER_ENABLE | 97 | # ifdef OLED_DRIVER_ENABLE |
103 | oled_timer = timer_read32(); | 98 | oled_timer = timer_read32(); |
104 | # endif | 99 | # endif |
@@ -108,5 +103,12 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) { | |||
108 | # ifdef HAPTIC_ENABLE | 103 | # ifdef HAPTIC_ENABLE |
109 | if (haptic_config.enable) haptic_play(); | 104 | if (haptic_config.enable) haptic_play(); |
110 | # endif | 105 | # endif |
106 | if (!encoder_update_user(index, clockwise)) return false; | ||
107 | if (clockwise) { | ||
108 | tap_code16(KC_VOLU); | ||
109 | } else { | ||
110 | tap_code16(KC_VOLD); | ||
111 | } | ||
112 | return true; | ||
111 | } | 113 | } |
112 | #endif | 114 | #endif |