]> git.donarmstrong.com Git - tmk_firmware.git/blobdiff - protocol/serial_mouse_microsoft.c
Merge branch 'rhaberkorn-serial-mouse'
[tmk_firmware.git] / protocol / serial_mouse_microsoft.c
index 6b3f80648bc6e93079afbf46e1d35e4228912005..ab74b7cdd3309e9240a5d5064b2ef1c120e1ceb6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright 2011,2013 Jun Wako <wakojun@gmail.com>
+Copyright 2014 Robin Haberkorn <robin.haberkorn@googlemail.com>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -27,13 +27,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "print.h"
 #include "debug.h"
 
-static void print_usb_data(const report_mouse_t *report);
+#ifdef MAX
+#undef MAX
+#endif
+#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
 
-uint8_t serial_mouse_init(void)
-{
-    serial_init();
-    return 0;
-}
+static void print_usb_data(const report_mouse_t *report);
 
 void serial_mouse_task(void)
 {
@@ -97,8 +96,8 @@ void serial_mouse_task(void)
     report.y = ((buffer[0] << 4) & 0xC0) | buffer[2];
 
     /* USB HID uses values from -127 to 127 only */
-    report.x = report.x < -127 ? -127 : report.x;
-    report.y = report.y < -127 ? -127 : report.y;
+    report.x = MAX(report.x, -127);
+    report.y = MAX(report.y, -127);
 
 #if 0
     if (!report.buttons && !report.x && !report.y) {