ov7670 FIFO from Edoardo De Marchi

Dependents:   3D_Scanner_OV7670_

Fork of OV7670 with FIFO by angelo mottolese

Revision:
1:f5f5d7c979cf
Parent:
0:101fbacf126f
diff -r 101fbacf126f -r f5f5d7c979cf OV7670.h
--- a/OV7670.h	Wed Nov 16 10:37:49 2016 +0000
+++ b/OV7670.h	Tue Oct 03 16:39:42 2017 +0000
@@ -1,3 +1,4 @@
+#pragma once 
 #include "mbed.h"
 #include "ov7670reg.h"
 
@@ -6,7 +7,7 @@
 #define OV7670_WRITEWAIT (20)
 #define OV7670_NOACK (0)
 #define OV7670_REGMAX (201)
-#define OV7670_I2CFREQ (50000)
+#define OV7670_I2CFREQ (100000)
 
 
 //
@@ -16,25 +17,7 @@
 {
     
 public:  
-volatile int LineCounter ;
-    volatile int LastLines ;
-    volatile bool CaptureReq ;
-    volatile bool Busy ;
-    volatile bool Done ;  
-        void CaptureNext(void);
-        bool CaptureDone(void);
-            void WriteReg(int addr,char data);
-        void Reset(void);
-        void test(void);
-        void InitQQVGA(void);
-            char ReadReg(int addr);
-    int ReadOneByte(void);
-    void ReadStart(void);
-    void ReadStop(void);
-    void VsyncHandler(void);
-    InterruptIn vsync;
-
-    OV7670(
+OV7670(
         PinName sda,// Camera I2C port
         PinName scl,// Camera I2C port
         PinName vs, // VSYNC
@@ -45,26 +28,35 @@
         PinName rt, // /RRST
         PinName o,  // /OE
         PinName rc  // RCLK      
-        ) : camera(sda,scl),vsync(vs),href(hr),wen(we),dataP(port,mask),rrst(rt),oe(o),rclk(rc)
-    {
-        //camera.stop() ;
-        camera.frequency(OV7670_I2CFREQ) ;
-      //  camera.start() ;
+        ) ;
+        
+                 ~OV7670();
 
-        CaptureReq = false ;
-        Busy = false ;
-        Done = false ;
-        LineCounter = 0 ;
-        rrst = 1 ;
-        oe = 1 ;
-        rclk = 1 ;
-        wen = 0 ;
-             vsync.rise(this,&OV7670::VsyncHandler) ;
-    }
-protected:
+        void CaptureNext(void);
+        bool CaptureDone(void);
+            void WriteReg(int addr,char data);
+        void Reset(void);
+        void test(void);
+        void InitQQVGA(int SIZEX);
+            char ReadReg(int addr);
+    int ReadOneByte(void);
+    int ReadOneWord(void);
+    void ReadStart(void);
+    void ReadStop(void);
+    void VsyncHandler(void);
+          
+
+private:
     I2C camera ;
+    InterruptIn vsync;
     DigitalIn href;
     DigitalOut wen ;
     PortIn dataP;
     DigitalOut rrst,oe,rclk ;
+            volatile int LineCounter;
+        volatile int LastLines;
+        volatile bool CaptureReq;
+        volatile bool Busy;
+        volatile bool Done; 
+        char *format_temp;
     };