diff options
author | QMK Bot <hello@qmk.fm> | 2022-01-25 13:41:28 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-01-25 13:41:28 +0000 |
commit | efbfd3031816eb13e2a3453ab44b84753277dcd5 (patch) | |
tree | bf8ee3e096e0ff660d4eba976c37d77fd4b9c22e /quantum | |
parent | 2da12182f33b2909338b653420cf8ae0eed53414 (diff) | |
parent | 3e0ee6fb74e125d14ac22c922d80def4649f6784 (diff) | |
download | qmk_firmware-efbfd3031816eb13e2a3453ab44b84753277dcd5.tar.gz qmk_firmware-efbfd3031816eb13e2a3453ab44b84753277dcd5.zip |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/process_keycode/process_joystick.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/quantum/process_keycode/process_joystick.c b/quantum/process_keycode/process_joystick.c index 3ffaf42bf8..fa9c2c1dbc 100644 --- a/quantum/process_keycode/process_joystick.c +++ b/quantum/process_keycode/process_joystick.c @@ -28,10 +28,11 @@ bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record) { if (keycode < JS_BUTTON0 || keycode > JS_BUTTON_MAX) { return true; } else { + uint8_t button_idx = (keycode - JS_BUTTON0); if (record->event.pressed) { - joystick_status.buttons[(keycode - JS_BUTTON0) / 8] |= 1 << (keycode % 8); + joystick_status.buttons[button_idx / 8] |= 1 << (button_idx % 8); } else { - joystick_status.buttons[(keycode - JS_BUTTON0) / 8] &= ~(1 << (keycode % 8)); + joystick_status.buttons[button_idx / 8] &= ~(1 << (button_idx % 8)); } joystick_status.status |= JS_UPDATED; |