Hover! test program.

Dependencies:   MjHover mbed

Files at this revision

API Documentation at this revision

Comitter:
matsujirushi
Date:
Sat Apr 04 14:51:39 2015 +0000
Parent:
1:514827ffb84a
Commit message:
Added MjHover2 class.

Changed in this revision

MjHover.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
diff -r 514827ffb84a -r 93729c9dad56 MjHover.lib
--- a/MjHover.lib	Fri Apr 03 13:57:14 2015 +0000
+++ b/MjHover.lib	Sat Apr 04 14:51:39 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/matsujirushi/code/MjHover/#8d68ac1bab97
+http://developer.mbed.org/users/matsujirushi/code/MjHover/#a3b72910732d
diff -r 514827ffb84a -r 93729c9dad56 main.cpp
--- a/main.cpp	Fri Apr 03 13:57:14 2015 +0000
+++ b/main.cpp	Sat Apr 04 14:51:39 2015 +0000
@@ -9,18 +9,20 @@
 DigitalInOut hover_ts(p21);
 DigitalInOut hover_reset_n(p22);
 
-MjHover hover(&i2c, 0x84, &hover_ts, &hover_reset_n);
-
 int main()
 {
     pc.baud(115200);
-    i2c.frequency(100000);
+    i2c.frequency(400000);
     
-    pc.printf("Start\r\n");
+#if 0   // 1:MjHover, 0:MjHover2
+
+    pc.printf("MjHover class.\r\n");
     
+    MjHover hover(&i2c, 0x84, &hover_ts, &hover_reset_n);
+
     hover.begin();
     
-    for(;;)
+    for (;;)
     {
         if (hover.getStatus() == false)
         {
@@ -34,4 +36,22 @@
             }
         }
     }
+
+#else
+
+    pc.printf("MjHover2 class.\r\n");
+    
+    MjHover2 hover(&i2c, 0x84, &hover_ts, &hover_reset_n);
+    hover.Reset();
+    for (;;)
+    {
+        hover.Task();
+
+        if (hover.SensorData.GestureInfoValid) printf("GestureInfo %d\r\n", hover.SensorData.GestureInfo);
+//        if (hover.SensorData.TouchInfoValid) printf("TouchInfo %04x\r\n", hover.SensorData.TouchInfo);
+//        if (hover.SensorData.XyzPositionValid) printf("XyzPosition %5u,%5u,%5u\r\n", hover.SensorData.XyzPosition.X, hover.SensorData.XyzPosition.Y, hover.SensorData.XyzPosition.Z);
+
+    }
+
+#endif
 }