From a0fed0ea176d1c986e40fc4981b900509c90d66e Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 21 May 2021 23:17:32 -0700 Subject: Convert Encoder callbacks to be boolean functions (#12805) Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> --- docs/feature_encoders.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index 4338c85e84..a56f093a39 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md @@ -53,15 +53,15 @@ If you are using different pinouts for the encoders on each half of a split keyb The callback functions can be inserted into your `.c`: ```c -void encoder_update_kb(uint8_t index, bool clockwise) { - encoder_update_user(index, clockwise); +bool encoder_update_kb(uint8_t index, bool clockwise) { + return encoder_update_user(index, clockwise); } ``` or `keymap.c`: ```c -void encoder_update_user(uint8_t index, bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* First encoder */ if (clockwise) { tap_code(KC_PGDN); @@ -75,9 +75,12 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_UP); } } + return true; } ``` +!> If you return `true`, this will allow the keyboard level code to run, as well. Returning `false` will override the keyboard level code. Depending on how the keyboard level function is set up. + ## Hardware The A an B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground. -- cgit v1.2.3