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/feature_encoders.md | |
| 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/feature_encoders.md')
| -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 8ab5ca9c4..f301f7068 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md | |||
| @@ -70,15 +70,15 @@ or `keymap.c`: | |||
| 70 | bool encoder_update_user(uint8_t index, bool clockwise) { | 70 | bool encoder_update_user(uint8_t index, bool clockwise) { |
| 71 | if (index == 0) { /* First encoder */ | 71 | if (index == 0) { /* First encoder */ |
| 72 | if (clockwise) { | 72 | if (clockwise) { |
| 73 | tap_code(KC_PGDN); | 73 | tap_code_delay(KC_VOLU, 10); |
| 74 | } else { | 74 | } else { |
| 75 | tap_code(KC_PGUP); | 75 | tap_code_delay(KC_VOLD, 10); |
| 76 | } | 76 | } |
| 77 | } else if (index == 1) { /* Second encoder */ | 77 | } else if (index == 1) { /* Second encoder */ |
| 78 | if (clockwise) { | 78 | if (clockwise) { |
| 79 | tap_code(KC_DOWN); | 79 | rgb_matrix_increase_hue(); |
| 80 | } else { | 80 | } else { |
| 81 | tap_code(KC_UP); | 81 | rgb_matrix_decrease_hue(); |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | return false; | 84 | return false; |
| @@ -100,9 +100,9 @@ bool encoder_update_user(uint8_t index, bool clockwise) { | |||
| 100 | } | 100 | } |
| 101 | } else if (index == 1) { | 101 | } else if (index == 1) { |
| 102 | if (clockwise) { | 102 | if (clockwise) { |
| 103 | tap_code(KC_VOLU); | 103 | tap_code_delay(KC_VOLU, 10); |
| 104 | } else { | 104 | } else { |
| 105 | tap_code(KC_VOLD); | 105 | tap_code_delay(KC_VOLD, 10); |
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | } else { /* Layer 0 */ | 108 | } else { /* Layer 0 */ |
| @@ -114,9 +114,9 @@ bool encoder_update_user(uint8_t index, bool clockwise) { | |||
| 114 | } | 114 | } |
| 115 | } else if (index == 1) { | 115 | } else if (index == 1) { |
| 116 | if (clockwise) { | 116 | if (clockwise) { |
| 117 | tap_code(KC_DOWN); | 117 | rgb_matrix_increase_speed(); |
| 118 | } else { | 118 | } else { |
| 119 | tap_code(KC_UP); | 119 | rgb_matrix_decrease_speed(); |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| @@ -124,6 +124,8 @@ bool encoder_update_user(uint8_t index, bool clockwise) { | |||
| 124 | } | 124 | } |
| 125 | ``` | 125 | ``` |
| 126 | 126 | ||
| 127 | ?> 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. | ||
| 128 | |||
| 127 | ## Hardware | 129 | ## Hardware |
| 128 | 130 | ||
| 129 | 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. | 131 | 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. |
