diff options
author | Felix Sargent <fsargent@users.noreply.github.com> | 2021-08-12 13:14:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 06:14:57 +1000 |
commit | 0c175d63cf35561c7a92e0bdeaef0ef185799aec (patch) | |
tree | 612061b178dd40b739a1de983d7256e447257070 /docs/ChangeLog | |
parent | fd4759dcfa281646b7a9b67fabf9552d31ed4ad1 (diff) |
Update 20210529.md (#13170)
This was confusing to me when I updated, so I want to make it more clear for those that come after.
Diffstat (limited to 'docs/ChangeLog')
-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 d005aeed36..2feeed6437 100644 --- a/docs/ChangeLog/20210529.md +++ b/docs/ChangeLog/20210529.md @@ -82,6 +82,22 @@ Example code before change: void encoder_update_kb(uint8_t index, bool clockwise) { encoder_update_user(index, clockwise); } + +void encoder_update_user(uint8_t index, bool clockwise) { + 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_DOWN); + } else { + tap_code(KC_UP); + } + } +} ``` Example code after change: @@ -90,6 +106,25 @@ Example code after change: bool encoder_update_kb(uint8_t index, bool clockwise) { return encoder_update_user(index, clockwise); } + +bool encoder_update_user(uint8_t index, bool clockwise) { + 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_DOWN); + } else { + tap_code(KC_UP); + } + } + return true; + // If you return true, this will allow the keyboard level code to run, as well. + //Returning false will override the keyboard level code. Depending on how the keyboard level function is set up. +} ``` ## Core Changes :id=core-changes |