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 /quantum | |
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 'quantum')
-rw-r--r-- | quantum/encoder.c | 10 | ||||
-rw-r--r-- | quantum/encoder.h | 4 | ||||
-rw-r--r-- | quantum/quantum.h | 4 |
3 files changed, 11 insertions, 7 deletions
diff --git a/quantum/encoder.c b/quantum/encoder.c index 2ed64c1e30..c30bf01cb2 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c @@ -59,9 +59,9 @@ static uint8_t thisHand, thatHand; static uint8_t encoder_value[NUMBER_OF_ENCODERS] = {0}; #endif -__attribute__((weak)) void encoder_update_user(int8_t index, bool clockwise) {} +__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return true; } -__attribute__((weak)) void encoder_update_kb(int8_t index, bool clockwise) { encoder_update_user(index, clockwise); } +__attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) { return encoder_update_user(index, clockwise); } void encoder_init(void) { #if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT) @@ -94,14 +94,14 @@ void encoder_init(void) { #endif } -static bool encoder_update(int8_t index, uint8_t state) { +static bool encoder_update(uint8_t index, uint8_t state) { bool changed = false; uint8_t i = index; #ifdef ENCODER_RESOLUTIONS - int8_t resolution = encoder_resolutions[i]; + uint8_t resolution = encoder_resolutions[i]; #else - int8_t resolution = ENCODER_RESOLUTION; + uint8_t resolution = ENCODER_RESOLUTION; #endif #ifdef SPLIT_KEYBOARD diff --git a/quantum/encoder.h b/quantum/encoder.h index db6f220da4..25dc77721d 100644 --- a/quantum/encoder.h +++ b/quantum/encoder.h @@ -22,8 +22,8 @@ void encoder_init(void); bool encoder_read(void); -void encoder_update_kb(int8_t index, bool clockwise); -void encoder_update_user(int8_t index, bool clockwise); +bool encoder_update_kb(uint8_t index, bool clockwise); +bool encoder_update_user(uint8_t index, bool clockwise); #ifdef SPLIT_KEYBOARD void encoder_state_raw(uint8_t* slave_state); diff --git a/quantum/quantum.h b/quantum/quantum.h index fe6bf310aa..e4a7c5723c 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -200,6 +200,10 @@ extern layer_state_t layer_state; # include "usbpd.h" #endif +#ifdef ENCODER_ENABLE +# include "encoder.h" +#endif + // For tri-layer void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3); |