summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/ps2_mouse.c
diff options
context:
space:
mode:
authorManna Harbour <51143715+manna-harbour@users.noreply.github.com>2020-04-09 18:29:27 +1000
committerFlorian Didron <fdidron@users.noreply.github.com>2020-06-12 17:00:27 +0900
commit2a1ff15c3983a81c4c59c197081cfe4355c4777f (patch)
tree0032299950ace6f96c58bb081f8cc70110976cfb /tmk_core/protocol/ps2_mouse.c
parent7ec087183b4d79d998fca72d6a5d6aefea32c0d6 (diff)
Add PS2_MOUSE_ROTATE to compensate for device orientation (#8650)
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per #6316
Diffstat (limited to 'tmk_core/protocol/ps2_mouse.c')
-rw-r--r--tmk_core/protocol/ps2_mouse.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c
index aa3a307ebf..a0e52bc7c3 100644
--- a/tmk_core/protocol/ps2_mouse.c
+++ b/tmk_core/protocol/ps2_mouse.c
@@ -157,6 +157,21 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report)
// invert coordinate of y to conform to USB HID mouse
mouse_report->y = -mouse_report->y;
#endif
+
+#ifdef PS2_MOUSE_ROTATE
+ int8_t x = mouse_report->x;
+ int8_t y = mouse_report->y;
+# if PS2_MOUSE_ROTATE == 90
+ mouse_report->x = y;
+ mouse_report->y = -x;
+# elif PS2_MOUSE_ROTATE == 180
+ mouse_report->x = -x;
+ mouse_report->y = -y;
+# elif PS2_MOUSE_ROTATE == 270
+ mouse_report->x = -y;
+ mouse_report->y = x;
+# endif
+#endif
}
static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report) {