diff options
author | Albert Y <76888457+filterpaper@users.noreply.github.com> | 2022-01-02 16:07:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 00:07:22 -0800 |
commit | 6f043c549715b572cb77015369d07b382887daba (patch) | |
tree | 67fb5446476512a2db6633a7cf15edd55ed3b525 /docs | |
parent | f3c080b4b47ba1150f4c44766b6fa8a685970b31 (diff) | |
download | qmk_firmware-6f043c549715b572cb77015369d07b382887daba.tar.gz qmk_firmware-6f043c549715b572cb77015369d07b382887daba.zip |
Volume as default encoder documentation example (#15678)
Co-authored-by: filterpaper <filterpaper@localhost>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/feature_encoders.md | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index 8ab5ca9c46..f301f7068d 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md @@ -70,15 +70,15 @@ or `keymap.c`: bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* First encoder */ if (clockwise) { - tap_code(KC_PGDN); + tap_code_delay(KC_VOLU, 10); } else { - tap_code(KC_PGUP); + tap_code_delay(KC_VOLD, 10); } } else if (index == 1) { /* Second encoder */ if (clockwise) { - tap_code(KC_DOWN); + rgb_matrix_increase_hue(); } else { - tap_code(KC_UP); + rgb_matrix_decrease_hue(); } } return false; @@ -100,9 +100,9 @@ bool encoder_update_user(uint8_t index, bool clockwise) { } } else if (index == 1) { if (clockwise) { - tap_code(KC_VOLU); + tap_code_delay(KC_VOLU, 10); } else { - tap_code(KC_VOLD); + tap_code_delay(KC_VOLD, 10); } } } else { /* Layer 0 */ @@ -114,9 +114,9 @@ bool encoder_update_user(uint8_t index, bool clockwise) { } } else if (index == 1) { if (clockwise) { - tap_code(KC_DOWN); + rgb_matrix_increase_speed(); } else { - tap_code(KC_UP); + rgb_matrix_decrease_speed(); } } } @@ -124,6 +124,8 @@ bool encoder_update_user(uint8_t index, bool clockwise) { } ``` +?> Media and mouse countrol keycodes such as `KC_VOLU` and `KC_WH_D` requires `EXTRAKEY_ENABLE = yes` and `MOUSEKEY_ENABLE = yes` respectively in user's `rules.mk` if they are not enabled as default on keyboard level configuration. + ## 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. |