summaryrefslogtreecommitdiff
path: root/keyboards/ploopyco/mouse/mouse.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-11-18 14:20:29 -0800
committerGitHub <noreply@github.com>2020-11-18 23:20:29 +0100
commit88a783a8a769e604fa13947ee9c556f0dc1c95ad (patch)
treee1a7803f7d4a17af1f0f1be0c260669a9e939441 /keyboards/ploopyco/mouse/mouse.c
parent3aef2bef8f6a3e33df4c0142da89f229320b212a (diff)
downloadqmk_firmware-88a783a8a769e604fa13947ee9c556f0dc1c95ad.tar.gz
qmk_firmware-88a783a8a769e604fa13947ee9c556f0dc1c95ad.zip
[Keyboard] PloopyCo update and fixes (#10936)
This is based on feedback talking with crop_octagon about the device. Future trackballs will ship with ATMEL DFU for simplicity. This also includes some fixes and optimizations based on code review and tinkering on my own devices.
Diffstat (limited to 'keyboards/ploopyco/mouse/mouse.c')
-rw-r--r--keyboards/ploopyco/mouse/mouse.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/keyboards/ploopyco/mouse/mouse.c b/keyboards/ploopyco/mouse/mouse.c
index 7e44feaf74..788a0a1f08 100644
--- a/keyboards/ploopyco/mouse/mouse.c
+++ b/keyboards/ploopyco/mouse/mouse.c
@@ -140,7 +140,7 @@ __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
if (debug_mouse) dprintf("Cons] X: %d, Y: %d\n", data.dx, data.dy);
// dprintf("Elapsed:%u, X: %f Y: %\n", i, pgm_read_byte(firmware_data+i));
- process_mouse_user(mouse_report, data.dx, -data.dy);
+ process_mouse_user(mouse_report, data.dx, data.dy);
}
}
@@ -171,31 +171,14 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
if (IS_MOUSEKEY_BUTTON(keycode)) {
report_mouse_t currentReport = pointing_device_get_report();
if (record->event.pressed) {
- if (keycode == KC_MS_BTN1)
- currentReport.buttons |= MOUSE_BTN1;
- else if (keycode == KC_MS_BTN2)
- currentReport.buttons |= MOUSE_BTN2;
- else if (keycode == KC_MS_BTN3)
- currentReport.buttons |= MOUSE_BTN3;
- else if (keycode == KC_MS_BTN4)
- currentReport.buttons |= MOUSE_BTN4;
- else if (keycode == KC_MS_BTN5)
- currentReport.buttons |= MOUSE_BTN5;
+ currentReport.buttons |= 1 << (keycode - KC_MS_BTN1);
} else {
- if (keycode == KC_MS_BTN1)
- currentReport.buttons &= ~MOUSE_BTN1;
- else if (keycode == KC_MS_BTN2)
- currentReport.buttons &= ~MOUSE_BTN2;
- else if (keycode == KC_MS_BTN3)
- currentReport.buttons &= ~MOUSE_BTN3;
- else if (keycode == KC_MS_BTN4)
- currentReport.buttons &= ~MOUSE_BTN4;
- else if (keycode == KC_MS_BTN5)
- currentReport.buttons &= ~MOUSE_BTN5;
+ currentReport.buttons &= ~(1 << (keycode - KC_MS_BTN1));
}
pointing_device_set_report(currentReport);
pointing_device_send();
}
+
#endif
return true;