ov7670 no fifo

Dependents:   OV7670_Nucleo

Revision:
1:e216fd4e8d9c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OV6620.h	Mon Nov 21 10:04:38 2016 +0000
@@ -0,0 +1,89 @@
+#include "mbed.h"
+#include "OV6620reg.h"
+#include <FastPWM.h>
+#include "ST7735_TFT.h"
+
+#define OV6620_WRITE (0xa2)
+#define OV6620_READ  (0xa2)
+#define OV6620_WRITEWAIT (20)
+#define OV6620_NOACK (0)
+#define OV6620_REGMAX (201)
+#define OV6620_I2CFREQ (39000)
+
+#define SIZEX  176
+#define SIZEY 144
+#define SIZE 25344
+//
+// OV6620 + FIFO AL422B camera board test
+//
+ST7735_TFT TFT(p5, p6, p7, p8, p9, p10,"TFT");// SDA, nc, SCK,CS,A0,RESET
+int per=2;
+int pwi=1;
+
+class OV6620 
+{
+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);
+    int ReadOneWord(void);
+    void ReadStart(void);
+    void ReadStop(void);
+    void VsyncHandler(void);
+    void PclkHandler(void) ;
+    void wait_posedge(InterruptIn pin);
+    void wait_posedge(InterruptIn pin);
+    
+    OV6620(
+        PinName sda,// Camera I2C port
+        PinName scl,// Camera I2C port
+        PinName vs, // VSYNC
+        PinName hr, // HREF
+        PinName pic ,// /pclk
+        PortName port, // 8bit bus port
+        int mask, // 0b0000_0M65_4000_0321_L000_0000_0000_0000 = 0x07878000
+        PinName xk
+    ) : camera(sda,scl),vsync(vs),href(hr),pclk(pic),dataP(port,mask),xclk(xk)
+
+    {
+        pc.baud(115200) ;
+
+        xclk..period(1/24000000.0);
+        xclk.write(.5);
+        TFT.claim(stdout);                          // Send stdout to the TFT display
+        TFT.background(Black);                      // Set background to black
+        TFT.foreground(White);                      // Set chars to white
+        TFT.cls();                                  // Clear the screen
+        TFT.set_orientation(3);
+
+        camera.stop() ;
+       camera.frequency(OV6620_I2CFREQ) ;
+       // vsync.fall(this,&OV6620::VsyncHandler) ;
+     //   href.rise(this,&OV6620::HrefHandler) ;
+      // pclk.rise(this,&OV6620::PclkHandler) ; // ????????????? blocca tutto il programma
+        CaptureReq = false ;
+        Busy = false ;
+        Done = false ;
+        LineCounter = 0 ;
+        FrameCounter = 0 ;
+        PixCounter = 0 ;
+        camera.start();
+    }
+    protected:
+        I2C camera ;
+    //InterruptIn vsync,href,pclk;
+    DigitalIn vsync,href,pclk;
+    PortIn dataP ;
+    FastPWM xclk;
+        };
\ No newline at end of file