Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Project_test Capture_bw_portin Capture_bw_v3 Project_190659132
Revision 6:b1b77891bddf, committed 2020-06-20
- Comitter:
- sebbarpar
- Date:
- Sat Jun 20 11:07:03 2020 +0000
- Parent:
- 5:46b8114bb5dd
- Child:
- 7:2ca4f55b5ac2
- Child:
- 8:39ad588f56e5
- Commit message:
- uh
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 |
--- 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 ;
}
--- a/ov7670.h Mon Apr 06 10:07:45 2020 +0000
+++ b/ov7670.h Sat Jun 20 11:07:03 2020 +0000
@@ -17,13 +17,14 @@
class OV7670
{
public:
-
+ PortIn data;
OV7670(
PinName sda, // Camera I2C port
PinName scl, // Camera I2C port
PinName vs, // VSYNC
PinName hr, // HREF
PinName we, // WEN
+ /*
PinName d7, // D7
PinName d6, // D6
PinName d5, // D5
@@ -32,6 +33,9 @@
PinName d2, // D2
PinName d1, // D1
PinName d0, // D0
+ */
+ PortName port,
+ int mask,
PinName rt, // /RRST
PinName o, // /OE
PinName rc // RCLK
@@ -55,7 +59,8 @@
private:
I2C _i2c;
InterruptIn vsync,href;
- BusIn data;
+ //BusIn data;
+
DigitalOut wen;
/*
DigitalIn da7;