diff options
author | Manna Harbour <51143715+manna-harbour@users.noreply.github.com> | 2020-04-09 18:29:27 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-09 01:29:27 -0700 |
commit | 07c75feba3f2c0b4baf1c230750483004e502020 (patch) | |
tree | b07e03f3463b06077e9bfbfe6170fa3c67a2a1bd /tmk_core | |
parent | b5aa5e4338750f6a7d969a30b2fe96f0f5382405 (diff) | |
download | qmk_firmware-07c75feba3f2c0b4baf1c230750483004e502020.tar.gz qmk_firmware-07c75feba3f2c0b4baf1c230750483004e502020.zip |
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')
-rw-r--r-- | tmk_core/protocol/ps2_mouse.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index aa3a307eb..a0e52bc7c 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) | |||
157 | // invert coordinate of y to conform to USB HID mouse | 157 | // invert coordinate of y to conform to USB HID mouse |
158 | mouse_report->y = -mouse_report->y; | 158 | mouse_report->y = -mouse_report->y; |
159 | #endif | 159 | #endif |
160 | |||
161 | #ifdef PS2_MOUSE_ROTATE | ||
162 | int8_t x = mouse_report->x; | ||
163 | int8_t y = mouse_report->y; | ||
164 | # if PS2_MOUSE_ROTATE == 90 | ||
165 | mouse_report->x = y; | ||
166 | mouse_report->y = -x; | ||
167 | # elif PS2_MOUSE_ROTATE == 180 | ||
168 | mouse_report->x = -x; | ||
169 | mouse_report->y = -y; | ||
170 | # elif PS2_MOUSE_ROTATE == 270 | ||
171 | mouse_report->x = -y; | ||
172 | mouse_report->y = x; | ||
173 | # endif | ||
174 | #endif | ||
160 | } | 175 | } |
161 | 176 | ||
162 | static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report) { | 177 | static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report) { |