Seminar

Dependencies:   mbed ov7670class

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ov7670s.h"
00003 
00004 OV7670 camera(
00005     D14, D15,       // SDA,SCL(I2C / SCCB)
00006     D9,D8,D10,   // VSYNC,HREF,pcclk
00007     D7,D6,D5,D4,D3,D2,D1,D0,
00008     A5) ; // RRST
00009 
00010 Serial pc(USBTX,USBRX);
00011 
00012 #define SIZEX (160)
00013 #define SIZEY (120)
00014 #define SIZE 19200
00015 
00016 unsigned char bank0 [SIZE];
00017 unsigned char *bank1 = (unsigned char *)(0x2007C000);
00018 
00019 int main()
00020 {
00021 
00022 
00023 
00024     
00025     camera.Reset() ;
00026 
00027     // Set up for 160*120 pixels RGB565
00028     camera.InitQQVGA() ;
00029 
00030 
00031     camera.CaptureNext() ;
00032     while (camera.CaptureDone() == false) ;
00033 
00034     while (!pc.readable()) {
00035 
00036         camera.ReadStart();
00037 
00038         for (int i = 0; i < SIZE; i++) {
00039             bank0[i] =  camera.ReadOneByte();
00040         }
00041 
00042         for (int i = 0; i < SIZE ; i++) {
00043             bank1[i] =  camera.ReadOneByte();
00044         }
00045 
00046         camera.ReadStop() ;
00047 
00048         camera.CaptureNext() ;
00049 
00050 
00051         while (camera.CaptureDone() == false) ;
00052     }
00053 }