1
0
Fork 0

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
This commit is contained in:
Manna Harbour 2020-04-09 18:29:27 +10:00 committed by GitHub
parent b5aa5e4338
commit 07c75feba3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View file

@ -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) {