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.
Fork of ov7670 by
ov7670.h
00001 // 00002 // OV7670 library 00003 // 00004 00005 #pragma once 00006 #include "mbed.h" 00007 #include "ov7670reg.h" 00008 00009 #define OV7670_WRITE (0x42) 00010 #define OV7670_READ (0x43) 00011 #define OV7670_WRITEWAIT (20) 00012 #define OV7670_NOACK (0) 00013 #define OV7670_REGMAX (201) 00014 #define OV7670_I2CFREQ (100000) 00015 00016 00017 class OV7670 00018 { 00019 public: 00020 00021 OV7670( 00022 PinName sda, // Camera I2C port 00023 PinName scl, // Camera I2C port 00024 PinName vs, // VSYNC 00025 PinName hr, // HREF 00026 PinName we, // WEN 00027 00028 //PortName port, // 8bit bus port 00029 //int mask, // 0b0000_0M65_4000_0321_L000_0000_0000_0000 = 0x07878000 00030 PinName d7, // D7 00031 PinName d6, // D6 00032 PinName d5, // D5 00033 PinName d4, // D4 00034 PinName d3, // D3 00035 PinName d2, // D2 00036 PinName d1, // D1 00037 PinName d0, // D0 00038 00039 PinName rt, // /RRST 00040 PinName o, // /OE 00041 PinName rc // RCLK 00042 ); 00043 00044 /*OV7670( 00045 PinName sda, // Camera I2C port 00046 PinName scl, // Camera I2C port 00047 PinName vs, // VSYNC 00048 PinName hr, // HREF 00049 PinName we, // WEN 00050 00051 PortName port, // 8bit bus port 00052 int mask, // 0b0000_0M65_4000_0321_L000_0000_0000_0000 = 0x07878000 00053 00054 PinName rt, // /RRST 00055 PinName o, // /OE 00056 PinName rc // RCLK 00057 ); 00058 */ 00059 ~OV7670(); 00060 00061 void CaptureNext(void); // capture request 00062 bool CaptureDone(void); // capture done? (with clear) 00063 void WriteReg(int addr,int data); // write to camera 00064 int ReadReg(int addr); // read from camera 00065 void Reset(void); // reset reg camera 00066 int Init(char c, int n); // init reg 00067 void VsyncHandler(void); // vsync handler 00068 void HrefHandler(void); // href handler 00069 int ReadOnebyte(void); // Data Read 00070 void ReadStart(void); // Data Start 00071 void ReadStop(void); // Data Stop 00072 00073 00074 private: 00075 I2C _i2c; 00076 InterruptIn vsync,href; 00077 00078 DigitalOut wen; 00079 //PortIn data; 00080 BusIn data; 00081 DigitalOut rrst,oe,rclk; 00082 volatile int LineCounter; 00083 volatile int LastLines; 00084 volatile bool CaptureReq; 00085 volatile bool Busy; 00086 volatile bool Done; 00087 };
Generated on Sat Jul 16 2022 10:43:07 by
1.7.2
