test

Dependencies:   zbar_010

Fork of ov7670 by Edoardo De Marchi

Files at this revision

API Documentation at this revision

Comitter:
levkovigor
Date:
Mon Sep 25 12:38:33 2017 +0000
Parent:
3:b40a945dd672
Commit message:
test

Changed in this revision

ov7670.cpp Show annotated file Show diff for this revision Revisions of this file
ov7670.h Show annotated file Show diff for this revision Revisions of this file
zbar_010.lib Show annotated file Show diff for this revision Revisions of this file
--- a/ov7670.cpp	Sat Feb 15 15:00:37 2014 +0000
+++ b/ov7670.cpp	Mon Sep 25 12:38:33 2017 +0000
@@ -1,7 +1,16 @@
 #include "ov7670.h"   
 
     
-OV7670::OV7670(PinName sda, PinName scl, PinName vs, PinName hr, PinName we, PortName port, int mask, PinName rt, PinName o, PinName rc) : _i2c(sda,scl),vsync(vs),href(hr),wen(we),data(port,mask),rrst(rt),oe(o),rclk(rc)
+//OV7670::OV7670(PinName sda, PinName scl, PinName vs, PinName hr, PinName we, PortName port, int mask, PinName rt, PinName o, PinName rc) : _i2c(sda,scl),vsync(vs),href(hr),wen(we),data(port,mask),rrst(rt),oe(o),rclk(rc)
+OV7670::OV7670(PinName sda, PinName scl, PinName vs, PinName hr, PinName we, PinName d7, // D7
+        PinName d6, // D6
+        PinName d5, // D5
+        PinName d4, // D4
+        PinName d3, // D3
+        PinName d2, // D2
+        PinName d1, // D1
+        PinName d0, // D0 
+        PinName rt, PinName o, PinName rc) : _i2c(sda,scl),vsync(vs),href(hr),wen(we),data(d0,d1,d2,d3,d4,d5,d6,d7),rrst(rt),oe(o),rclk(rc)
 {
         _i2c.stop();
         _i2c.frequency(OV7670_I2CFREQ);
@@ -70,14 +79,40 @@
 // Data Read
 int OV7670::ReadOnebyte(void)
 {
-        int B1;
+        /*int B1;
         rclk = 1;
         B1 = (((data&0x07800000)>>19)|((data&0x078000)>>15));
         rclk = 0;
-        return B1; 
+        return B1; */
+       
+        int result ;
+        rclk = 1 ;
+//        wait_us(1) ;
+        result = data ;
+        rclk = 0 ;
+        return result ;
+        
+
+      /*int result;
+        rclk = 1;
+        result = data;
+
+        // Shift the bits around to form the byte
+        int top = result >> 19;         // Isolate the top nibble
+        int middle = result >> 2;       // Isolate bits 2 & 3
+        result = result & 0x00000003;   // Isolate bits 0 & 1
+        
+        result += middle;
+        result += top;
+       
+        rclk = 0;
+        return result;*/
+
+    
 }
 
 
+
 // Data Start read from FIFO
 void OV7670::ReadStart(void)
 {        
--- a/ov7670.h	Sat Feb 15 15:00:37 2014 +0000
+++ b/ov7670.h	Mon Sep 25 12:38:33 2017 +0000
@@ -18,7 +18,30 @@
 {
     public:
             
-        OV7670(
+             OV7670(
+            PinName sda,    // Camera I2C port
+            PinName scl,    // Camera I2C port
+            PinName vs,     // VSYNC
+            PinName hr,     // HREF
+            PinName we,     // WEN
+                      
+            //PortName port,  // 8bit bus port
+            //int mask,       // 0b0000_0M65_4000_0321_L000_0000_0000_0000 = 0x07878000
+            PinName d7, // D7
+        PinName d6, // D6
+        PinName d5, // D5
+        PinName d4, // D4
+        PinName d3, // D3
+        PinName d2, // D2
+        PinName d1, // D1
+        PinName d0, // D0
+            
+            PinName rt,     // /RRST
+            PinName o,      // /OE
+            PinName rc      // RCLK      
+            );
+            
+        /*OV7670(
             PinName sda,    // Camera I2C port
             PinName scl,    // Camera I2C port
             PinName vs,     // VSYNC
@@ -32,7 +55,7 @@
             PinName o,      // /OE
             PinName rc      // RCLK      
             );
-        
+        */
         ~OV7670();
         
         void CaptureNext(void);              // capture request
@@ -53,7 +76,8 @@
         InterruptIn vsync,href;
         
         DigitalOut wen;
-        PortIn data;
+        //PortIn data;
+        BusIn data;
         DigitalOut rrst,oe,rclk;
         volatile int LineCounter;
         volatile int LastLines;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zbar_010.lib	Mon Sep 25 12:38:33 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/RyoheiHagimoto/code/zbar_010/#500d42699c34