X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=docs%2Ffeature_encoders.md;h=bb2d538e7ef027075ac2159d9fdf85bd87460e95;hb=6af77551c67c846b06c596cbd367d66c755f8051;hp=208d6db13cddcce222a18a7d1c459b214b20d962;hpb=47c91fc7f75ae0a477e55b687aa0fc30da0a283c;p=qmk_firmware.git diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index 208d6db13..bb2d538e7 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md @@ -6,7 +6,6 @@ Basic encoders are supported by adding this to your `rules.mk`: and this to your `config.h`: - #define NUMBER_OF_ENCODERS 1 #define ENCODERS_PAD_A { B12 } #define ENCODERS_PAD_B { B13 } @@ -32,15 +31,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 == 1) { /* Second encoder */ + if (clockwise) { + tap_code(KC_UP); + } else { + tap_code(KC_DOWN); + } + } } ## Hardware