]> git.donarmstrong.com Git - tmk_firmware.git/blobdiff - protocol/ps2_mouse.c
Fix rn42.h API
[tmk_firmware.git] / protocol / ps2_mouse.c
index ea629655f723b62ec78a10ac6c72d7caf78b5d10..c3e8b3c1c3354753cc3ce12d902c6978caf8af16 100644 (file)
@@ -47,20 +47,15 @@ uint8_t ps2_mouse_init(void) {
     phex(rcv); phex(ps2_error); print("\n");
 
     // read completion code of BAT
-    rcv = ps2_host_recv();
+    rcv = ps2_host_recv_response();
     print("ps2_mouse_init: read BAT: ");
     phex(rcv); phex(ps2_error); print("\n");
 
     // read Device ID
-    rcv = ps2_host_recv();
+    rcv = ps2_host_recv_response();
     print("ps2_mouse_init: read DevID: ");
     phex(rcv); phex(ps2_error); print("\n");
 
-    // send Enable Data Reporting
-    rcv = ps2_host_send(0xF4);
-    print("ps2_mouse_init: send 0xF4: ");
-    phex(rcv); phex(ps2_error); print("\n");
-
     // send Set Remote mode
     rcv = ps2_host_send(0xF0);
     print("ps2_mouse_init: send 0xF0: ");
@@ -87,9 +82,14 @@ void ps2_mouse_task(void)
         mouse_report.x = ps2_host_recv_response();
         mouse_report.y = ps2_host_recv_response();
     } else {
-        if (!debug_mouse) print("ps2_mouse: fail to get mouse packet\n");
+        if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n");
         return;
     }
+        xprintf("%ud ", timer_read());
+        print("ps2_mouse raw: [");
+        phex(mouse_report.buttons); print("|");
+        print_hex8((uint8_t)mouse_report.x); print(" ");
+        print_hex8((uint8_t)mouse_report.y); print("]\n");
 
     /* if mouse moves or buttons state changes */
     if (mouse_report.x || mouse_report.y ||