Testni ps2 v2

Dependencies:   PS2 mbed

Files at this revision

API Documentation at this revision

Comitter:
esokic
Date:
Wed Jun 04 11:20:01 2014 +0000
Commit message:
Testni program za ps2mouse

Changed in this revision

PS2.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r a18457486d66 PS2.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PS2.lib	Wed Jun 04 11:20:01 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/shintamainjp/code/PS2/#a57bbbec16b1
diff -r 000000000000 -r a18457486d66 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jun 04 11:20:01 2014 +0000
@@ -0,0 +1,44 @@
+
+#include "mbed.h"
+#include "PS2Mouse.h"
+
+//CLKpin, DATApin
+PS2Mouse ps2ms(dp10, dp11);
+Serial pc(USBTX,USBRX);
+DigitalOut ledica(dp28);
+DigitalOut enable(dp14);
+int main()
+{
+    ledica=1;
+    enable=0;
+    wait(0.5);
+    pc.printf("Inicijaliziran");pc.putc('\n');
+    enable=1;
+    wait(0.5);
+    enable=0;
+       
+    PS2Mouse::mouse_event_t evt_ms;
+    
+    pc.printf("Zakacen Event");pc.putc('\n');
+    enable=1;
+    wait(0.5);
+    enable=0;
+    
+    while (1) {
+        if (ps2ms.processing(&evt_ms)) {
+             pc.printf("L:%d C:%d R:%d X:%4d Y:%4d Z:%2d\n",  int(evt_ms.left), int(evt_ms.center),  int(evt_ms.right), evt_ms.x, evt_ms.y, evt_ms.z);
+             if (evt_ms.x<0) pc.printf("Lijevo"); else pc.printf("Desno");
+             if (evt_ms.y<=0) pc.printf("Dole\n"); else pc.printf("Gore\n");
+             if (evt_ms.left) pc.printf("Kliknut lijevo\n");
+             if (evt_ms.right) pc.printf("Kliknut desno\n");
+                   /*   pc.printf("L: %c\n", evt_ms.left);
+                      pc.printf("C: %c\n", evt_ms.center);
+                      pc.printf("R: %c\n", evt_ms.right);
+                      pc.printf("X: %4d\n", evt_ms.x);
+                      pc.printf("Y: %4d\n", evt_ms.y);
+                      pc.printf("Z: %2d\n", evt_ms.z);
+                      pc.printf("----------------\n");
+                     */ 
+         }
+    }
+}
diff -r 000000000000 -r a18457486d66 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jun 04 11:20:01 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file