Test Code for OV7670 Camera module with FIFO AL422

Dependencies:   MODSERIAL mbed ov7670

Dependents:   OV7670_Test_Code

You can find more information in this page: https://mbed.org/users/edodm85/notebook/ov7670-camera-module/

Revision:
4:d0d4760d32b2
Parent:
3:b4e0cefc37f6
--- a/main.cpp	Sun Apr 07 10:52:10 2013 +0000
+++ b/main.cpp	Sat Feb 15 15:01:55 2014 +0000
@@ -30,7 +30,8 @@
 
     while(1) 
     { 
-        if(new_send){
+        if(new_send)
+        {
             int i = 0;
        
             while(pc.readable())
@@ -46,7 +47,8 @@
 
 
 
-void parse_cmd(){
+void parse_cmd()
+{
             new_send = false;
             
             if(strcmp("snap", word) == 0)              
@@ -139,6 +141,22 @@
             {
                     pc.printf("Tot time acq + send (mbed): %dms\r\n", t2-t1);
                     memset(word, 0, sizeof(word));
+            }else
+            if(strcmp("reg_status", word) == 0)              
+            {  
+                    int i = 0;
+                    pc.printf("AD : +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F");
+                    for (i=0;i<OV7670_REGMAX;i++) 
+                    {
+                        int data;
+                        data = camera.ReadReg(i); // READ REG
+                        if ((i & 0x0F) == 0) 
+                        {
+                            pc.printf("\r\n%02X : ",i);
+                        }
+                        pc.printf("%02X ",data);
+                    }
+                    pc.printf("\r\n");
             }
             
             memset(word, 0, sizeof(word));
@@ -146,7 +164,8 @@
 }
 
 
-void CameraSnap(){
+void CameraSnap()
+{
         led4 = 1;
 
                 // Kick things off by capturing an image
@@ -172,12 +191,10 @@
         }
        
         camera.ReadStop();
-        t2 = t.read_ms();         
+        t2 = t.read_ms(); 
         
-                 // Immediately request the next image to be captured (takes around 45ms)
-        camera.CaptureNext();                             
-                // Now wait for the image to finish being captured
-        while (camera.CaptureDone() == false);
+        camera.CaptureNext();
+        while(camera.CaptureDone() == false);             
         
         pc.printf("Snap_done\r\n");   
         led4 = 0;