diff options
-rw-r--r-- | docs/ChangeLog/20210529.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/ChangeLog/20210529.md b/docs/ChangeLog/20210529.md index d005aeed3..2feeed643 100644 --- a/docs/ChangeLog/20210529.md +++ b/docs/ChangeLog/20210529.md | |||
@@ -82,6 +82,22 @@ Example code before change: | |||
82 | void encoder_update_kb(uint8_t index, bool clockwise) { | 82 | void encoder_update_kb(uint8_t index, bool clockwise) { |
83 | encoder_update_user(index, clockwise); | 83 | encoder_update_user(index, clockwise); |
84 | } | 84 | } |
85 | |||
86 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
87 | if (index == 0) { /* First encoder */ | ||
88 | if (clockwise) { | ||
89 | tap_code(KC_PGDN); | ||
90 | } else { | ||
91 | tap_code(KC_PGUP); | ||
92 | } | ||
93 | } else if (index == 1) { /* Second encoder */ | ||
94 | if (clockwise) { | ||
95 | tap_code(KC_DOWN); | ||
96 | } else { | ||
97 | tap_code(KC_UP); | ||
98 | } | ||
99 | } | ||
100 | } | ||
85 | ``` | 101 | ``` |
86 | 102 | ||
87 | Example code after change: | 103 | Example code after change: |
@@ -90,6 +106,25 @@ Example code after change: | |||
90 | bool encoder_update_kb(uint8_t index, bool clockwise) { | 106 | bool encoder_update_kb(uint8_t index, bool clockwise) { |
91 | return encoder_update_user(index, clockwise); | 107 | return encoder_update_user(index, clockwise); |
92 | } | 108 | } |
109 | |||
110 | bool encoder_update_user(uint8_t index, bool clockwise) { | ||
111 | if (index == 0) { /* First encoder */ | ||
112 | if (clockwise) { | ||
113 | tap_code(KC_PGDN); | ||
114 | } else { | ||
115 | tap_code(KC_PGUP); | ||
116 | } | ||
117 | } else if (index == 1) { /* Second encoder */ | ||
118 | if (clockwise) { | ||
119 | tap_code(KC_DOWN); | ||
120 | } else { | ||
121 | tap_code(KC_UP); | ||
122 | } | ||
123 | } | ||
124 | return true; | ||
125 | // If you return true, this will allow the keyboard level code to run, as well. | ||
126 | //Returning false will override the keyboard level code. Depending on how the keyboard level function is set up. | ||
127 | } | ||
93 | ``` | 128 | ``` |
94 | 129 | ||
95 | ## Core Changes :id=core-changes | 130 | ## Core Changes :id=core-changes |