mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-12-26 02:58:06 +06:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
4adb7d2176
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user