From 52f1206712348a97b8de5700b5fc3eabe424096b Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 18 Jan 2019 07:33:43 -0800 Subject: Fix Encoder documentation (#4861) --- docs/feature_encoders.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'docs/feature_encoders.md') diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index 208d6db13..6eab402ef 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md @@ -32,15 +32,19 @@ The callback functions can be inserted into your `.c`: or `keymap.c`: void encoder_update_user(uint8_t index, bool clockwise) { - if (index == 0) { - if (clockwise) { - register_code(KC_PGDN); - unregister_code(KC_PGDN); - } else { - register_code(KC_PGUP); - unregister_code(KC_PGUP); - } + if (index == 0) { /* First encoder */ + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); } + } else if (index == 2) { + if (clockwise) { + tap_code(KC_UP); + } else { + tap_code(KC_DOWN); + } + } } ## Hardware -- cgit v1.2.3-24-g4f1b