capstone_finish

Dependencies:   BufferedSerial motor_sn7544

Revision:
2:e98408458d2b
Parent:
1:509676f3be32
Child:
3:2a3664dc6634
--- a/main.cpp	Fri Feb 17 15:06:15 2012 +0000
+++ b/main.cpp	Mon Aug 12 07:12:38 2019 +0000
@@ -2,25 +2,22 @@
 // OV7670 + FIFO AL422B camera board test
 //
 #include "mbed.h"
-#include "spilcd_qvga.h"
 #include "ov7670.h"
-#include <stdlib.h>
+
+
 
-//
-// SPILCD LG 
-//
-SPILCD_QVGA lcd(p29, p30, p5, p6, p7) ;
 OV7670 camera(
-    p28,p27,       // SDA,SCL(I2C / SCCB)
-    p21,p22,p20,   // VSYNC,HREF,WEN(FIFO)
+    D14,D15,       // SDA,SCL(I2C / SCCB)
+    D9,D14,D11,   // VSYNC,HREF,WEN(FIFO)
     //p18,p17,p16,p15,p11,p12,p14,p13, // D7-D0
-    Port0,0x07878000,
-    p23,p24,p25) ; // RRST,OE,RCLK
+    PortB,0xFF,
+    D13,D12,D6) ; // RRST,OE,RCLK
 
-Serial pc(USBTX,USBRX) ;
+Serial pc(USBTX,USBRX,115200) ;
 Timer t;
 
-#undef QQVGA
+//#undef QQVGA
+#define QQVGA
 
 #ifdef QQVGA
 # define SIZEX (160)
@@ -30,42 +27,51 @@
 # define SIZEY (240)
 #endif
 
+uint16_t fdata[SIZEX*SIZEY];
+
 int main() {
     int last ;
     pc.baud(115200) ;
     camera.Reset() ;
 
 #ifdef QQVGA
-    camera.InitQQVGA565(true,false) ;
-#else
-    camera.InitQVGA565(true,false) ;
+//    camera.InitQQVGA565(true,false) ;
+    camera.InitQVGAYUV(true,false);
+
+#else 
+    //camera.InitQVGA565(true,false) ;
 #endif
 
     // CAPTURE and SEND LOOP
     t.start();
     last = t.read_ms() ;
-    while(1)
-    {
+//    while(1)
+//    {
         camera.CaptureNext() ;
         while(camera.CaptureDone() == false) ;
         printf("Caputure %d(ms)\r\n", t.read_ms() - last) ;
         last = t.read_ms() ;
         camera.ReadStart() ;
-        lcd.Lcd_SetCursor(0,0);
-        lcd.Lcd_WR_Start();
-        lcd.rsout(1) ;
-        for (int y = 0;y < SIZEY;y++) {
-            lcd.Lcd_SetCursor(y,0);
-            lcd.Lcd_WR_Start();
+//        lcd.Lcd_SetCursor(0,0);
+//        lcd.Lcd_WR_Start();
+//        lcd.rsout(1) ;
+        for (int y = 0; y < SIZEY*SIZEX;y++) {
+//            pc.printf("\r\n");
+ //           lcd.Lcd_SetCursor(y,0);
+ 
+//            lcd.Lcd_WR_Start();
             for (int x = 0;x < SIZEX;x++) {
-                lcd.csout(0) ;
-                lcd.DataToWrite(camera.ReadOneWord());
-                lcd.csout(1) ;
+//             pc.printf("%x ",camera.ReadOneWord());
+              //  lcd.csout(0) ;
+//                lcd.DataToWrite(camera.ReadOneWord());
+//                lcd.csout(1) ;
+            fdata[SIZEX*SIZEY]=camera.ReadOneWord();
             }
         }
+   
         camera.ReadStop() ; 
-        lcd.rsout(0) ;
+        printf("%d\n", sizeof(fdata));
         printf("FIFO Read & Lcd Out %d(ms)\r\n", t.read_ms() - last) ;
         last = t.read_ms() ;
-    }
+ //   }
 }