OV7670 no FIFO Nucleo F411
Dependencies: mbed OV7670 FastPWM
main.cpp
- Committer:
- rulla
- Date:
- 2016-11-21
- Revision:
- 1:b5475be96383
- Parent:
- 0:d69a19a5c0ff
- Child:
- 2:9c5089ac2596
File content as of revision 1:b5475be96383:
// // OV7670 + FIFO AL422B camera board test // #include "mbed.h" #include "OV6620.h" OV6620 camera( p28,p27, // SDA,SCL(I2C / SCCB) p21,p22,p20, // VSYNC,HREF,WEN(FIFO) Port0,0x07878000, // D7-D0 p23) ; // RRST,OE,RCLK Serial pc(USBTX,USBRX); #define SIZEX (160) #define SIZEY (120) #define SIZE SIZEX*SIZEY //uint8_t rgb[SIZE]; //unsigned char *bank1 = (unsigned char *)(0x2007C000); uint16_t bank0,bank1,bank2,bank3; int main() { pc.baud(115200); TFT.set_orientation(3); camera.Reset() ; int i; char data1[OV7670_REGMAX],data2[OV7670_REGMAX]; for (i=0;i<OV7670_REGMAX;i++) { data1[i]=cam.ReadReg(i); // READ REG //if ((i & 0x0F) == 0) pc.printf("\r\n%02X : ",i); //pc.printf("Add %02X = %02X ,",i,data); } camera.InitQQVGA() ; pc.printf("\r\nDefault\r\n"); for (i=0;i<OV7670_REGMAX;i++) { data2[i]=cam.ReadReg(i); // READ REG // if ((i & 0x0F) == 0) pc.printf("\r\n%02X : ",i); if(data1[i]!=data2[i]) pc.printf("Add %02X = %02X/%02X ,",i,data1[i],data2[i]); } while(1) { pc.printf("Hit Any Key to send RGBx160x120 Capture Data.\r\n") ; while(!pc.readable()) ; pc.getc() ; camera.CaptureNext() ; while(camera.CaptureDone() == false) ; pc.printf("*\r\n") ; camera.ReadStart() ; i = 0 ; for (int y = 0;y < SIZEY;y++) { int r,g,b,d1,d2 ; for (int x = 0;x < SIZEX;x++) { d1 = camera.ReadOneByte() ; // upper nibble is XXX , lower nibble is B d2 = camera.ReadOneByte() ; // upper nibble is G , lower nibble is R b = (d1 & 0x0F) ; g = (d2 & 0xF0) >> 4 ; r = (d2 & 0x0F) ; pc.printf ("%1X%1X%1X",r,g,b) ; } pc.printf("\r\n") ; } camera.ReadStop() ; } }