Test of ADNS3080 on DISCO_F429ZI

Dependencies:   BSP_DISCO_F429ZI LCD_DISCO_F429ZI mbed

Fork of ADNS3080_HelloWorld by ryosuke yumoto

Files at this revision

API Documentation at this revision

Comitter:
DenMorena
Date:
Wed Sep 27 03:28:48 2017 +0000
Parent:
1:46abb3b9347d
Commit message:
Test using ADNS3080 on DISCO_F429ZI

Changed in this revision

BSP_DISCO_F429ZI.lib Show annotated file Show diff for this revision Revisions of this file
LCD_DISCO_F429ZI.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 46abb3b9347d -r c7076b745c5a BSP_DISCO_F429ZI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_DISCO_F429ZI.lib	Wed Sep 27 03:28:48 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/ST/code/BSP_DISCO_F429ZI/#2371382139dd
diff -r 46abb3b9347d -r c7076b745c5a LCD_DISCO_F429ZI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F429ZI.lib	Wed Sep 27 03:28:48 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
diff -r 46abb3b9347d -r c7076b745c5a main.cpp
--- a/main.cpp	Fri Aug 08 06:36:15 2014 +0000
+++ b/main.cpp	Wed Sep 27 03:28:48 2017 +0000
@@ -1,20 +1,40 @@
 #include "mbed.h"
 #include "ADNS3080.h"
+#include "LCD_DISCO_F429ZI.h"
 
-DigitalOut myled(LED1);
-ADNS3080 OptFlow(p5, p6, p7, p8);
+ADNS3080 OptFlow(PE_6, PE_5, PE_2, PE_4);//MOSI, MISO, SCLK, NCS
 Serial pc(USBTX, USBRX);
 
+LCD_DISCO_F429ZI lcd;
+
 int main() {
 
-    pc.printf("Hello World! test ADNS3080\n\r");
+    pc.printf("Test ADNS3080\n\r");
     
     pc.printf("prodID is %x\n\r", OptFlow.getProdID());
+    pc.printf("RevID is %x\n\r", OptFlow.getRevID());
+    pc.printf("InverProdID is %x\n\r", OptFlow.getInverProdID());
     pc.printf("configuration is %x\n\r", OptFlow.getConfiguration_bits()); 
     
+    uint8_t text[30];
+    BSP_LCD_SetFont(&Font20);
+    sprintf((char*)text, "prodID1 is %x", OptFlow.getProdID());
+    lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE);   
+    
+    int x=0, y=0, dx=0, dy=0;
     while(1){
         OptFlow.getMotion();
-        pc.printf("%4d, %4d\n\r", OptFlow.getDelta_X(),OptFlow.getDelta_Y());
+        dx = OptFlow.getDelta_X();
+        dy = OptFlow.getDelta_Y();
+        x += dx;
+        y += dy; 
+        pc.printf("%4d, %4d, (%d,%d)\n\r", dx, dy, x, y);
+
+        sprintf((char*)text, "(dx,dy)=%4d,%4d", dx, dy);
+        lcd.DisplayStringAt(0, LINE(1), (uint8_t *)&text, LEFT_MODE);   
+        sprintf((char*)text, "(x,y)=%4d,%4d", x, y);
+        lcd.DisplayStringAt(0, LINE(2), (uint8_t *)&text, LEFT_MODE);   
+
         wait(0.01); 
     }
 }
diff -r 46abb3b9347d -r c7076b745c5a mbed.bld
--- a/mbed.bld	Fri Aug 08 06:36:15 2014 +0000
+++ b/mbed.bld	Wed Sep 27 03:28:48 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/675da3299148
\ No newline at end of file