diff options
author | Drashna Jaelre <drashna@live.com> | 2021-05-13 19:20:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-13 19:20:31 -0700 |
commit | a6807d18222295a9a8016d21466f1ec71d73a34a (patch) | |
tree | 13a0dc9a8ea94f3cad825180ac3ae8b2b4021199 /keyboards/ploopyco/trackball_nano | |
parent | f594b22332dfb9bc0ead6b4604a050bf8674a800 (diff) | |
download | qmk_firmware-a6807d18222295a9a8016d21466f1ec71d73a34a.tar.gz qmk_firmware-a6807d18222295a9a8016d21466f1ec71d73a34a.zip |
[Keyboard][PloopyCo] Fix code for Mini and Nano Trackballs (#12889)
Diffstat (limited to 'keyboards/ploopyco/trackball_nano')
-rw-r--r-- | keyboards/ploopyco/trackball_nano/trackball_nano.c | 41 | ||||
-rw-r--r-- | keyboards/ploopyco/trackball_nano/trackball_nano.h | 2 |
2 files changed, 13 insertions, 30 deletions
diff --git a/keyboards/ploopyco/trackball_nano/trackball_nano.c b/keyboards/ploopyco/trackball_nano/trackball_nano.c index 93cb60bd4b..17cdedac7a 100644 --- a/keyboards/ploopyco/trackball_nano/trackball_nano.c +++ b/keyboards/ploopyco/trackball_nano/trackball_nano.c @@ -70,33 +70,9 @@ uint16_t lastMidClick = 0; // Stops scrollwheel from being read if it was press uint8_t OptLowPin = OPT_ENC1; bool debug_encoder = false; -__attribute__((weak)) void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v) { - // There's no scroller on this device. - return; -} - -__attribute__((weak)) void process_wheel(report_mouse_t* mouse_report) { - // There's no scroller on this device. - return; -} - __attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { - // x and y are swapped - // the sensor is rotated - // by 90 degrees - int16_t temp = x; - x = y; - y = temp; - - // Apply delta-X and delta-Y transformations. - float xt = (float) x * ADNS_X_TRANSFORM; - float yt = (float) y * ADNS_Y_TRANSFORM; - - int16_t xti = xt; - int16_t yti = yt; - - mouse_report->x = xti; - mouse_report->y = yti; + mouse_report->x = x; + mouse_report->y = y; } __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) { @@ -106,7 +82,17 @@ __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) { if (debug_mouse) dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy); - process_mouse_user(mouse_report, data.dx, data.dy); + // Apply delta-X and delta-Y transformations. + // x and y are swapped + // the sensor is rotated + // by 90 degrees + float xt = (float) data.dy * ADNS_X_TRANSFORM; + float yt = (float) data.dx * ADNS_Y_TRANSFORM; + + int16_t xti = (int16_t)xt; + int16_t yti = (int16_t)yt; + + process_mouse_user(mouse_report, xti, yti); } } @@ -182,7 +168,6 @@ void pointing_device_init(void) { void pointing_device_task(void) { report_mouse_t mouse_report = pointing_device_get_report(); - process_wheel(&mouse_report); process_mouse(&mouse_report); pointing_device_set_report(mouse_report); pointing_device_send(); diff --git a/keyboards/ploopyco/trackball_nano/trackball_nano.h b/keyboards/ploopyco/trackball_nano/trackball_nano.h index 4bffb04607..5692383b1e 100644 --- a/keyboards/ploopyco/trackball_nano/trackball_nano.h +++ b/keyboards/ploopyco/trackball_nano/trackball_nano.h @@ -33,8 +33,6 @@ void process_mouse(report_mouse_t* mouse_report); void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y); -void process_wheel(report_mouse_t* mouse_report); -void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v); #define LAYOUT(k00) {{ KC_NO }} |