ov7670 library

Dependents:   Project_test Capture_bw_portin Capture_bw_v3 Project_190659132

Revision:
6:b1b77891bddf
Parent:
5:46b8114bb5dd
Child:
7:2ca4f55b5ac2
Child:
8:39ad588f56e5
--- a/ov7670.cpp	Mon Apr 06 10:07:45 2020 +0000
+++ b/ov7670.cpp	Sat Jun 20 11:07:03 2020 +0000
@@ -1,11 +1,12 @@
 #include "ov7670.h"   
 
     
-OV7670::OV7670(PinName sda, PinName scl, PinName vs, PinName hr, PinName we, PinName d7, PinName d6, PinName d5, PinName d4, PinName d3, PinName d2, PinName d1, PinName d0, PinName rt, PinName o, PinName rc) : _i2c(sda,scl),vsync(vs),href(hr),wen(we),data(d7,d6,d5,d4,d3,d2,d1,d0)/*da7(d7),da6(d6),da5(d5),da4(d4),da3(d3),da2(d2),da1(d1),da0(d0)*/,rrst(rt),oe(o),rclk(rc)
+OV7670::OV7670(PinName sda, PinName scl, PinName vs, PinName hr, PinName we, /*PinName d7, PinName d6, PinName d5, PinName d4, PinName d3, PinName d2, PinName d1, PinName d0,*/PortName port, int mask, PinName rt, PinName o, PinName rc) : _i2c(sda,scl),vsync(vs),href(hr),wen(we),/*data(d0,d1,d2,d3,d4,d5,d6,d7)*/data(port,mask),rrst(rt),oe(o),rclk(rc)
 {
         _i2c.stop();
         _i2c.frequency(OV7670_I2CFREQ);
         vsync.fall(this,&OV7670::VsyncHandler);     // interrupt fall edge
+        href.fall(this,&OV7670::HrefHandler);     // interrupt fall edge
         CaptureReq = false;
         Busy = false;
         Done = false;
@@ -16,7 +17,7 @@
         wen = 0;
 }
 
-
+int bit=0;
 OV7670::~OV7670()
 {
 }
@@ -48,7 +49,7 @@
 
 // vsync handler
 void OV7670::VsyncHandler(void)
-{ 
+{   
     // Capture Enable
     if (CaptureReq) 
     {
@@ -66,6 +67,11 @@
     }
 }
 
+void OV7670::HrefHandler(void)
+{
+    
+}
+
 
 // Data Read
 int OV7670:: ReadOnebyte(void)
@@ -74,6 +80,11 @@
         rclk = 1 ;
 //        wait_us(1) ;
         result = data ;
+        
+        int top= result>>4;
+        result=result&0x0F;
+        result=result+top;
+        
         rclk = 0 ;
         return result ;
     }