I made Digital Camera using Arducam & WIZwiki-W7500

Dependencies:   Arduino Arducam_OV5642 SDFileSystem Arducam_UTFT_SPI WIZnetInterface_Ricky mbed

Revision:
1:3a14a4c84db2
Parent:
0:e01f64037748
Child:
2:3a12c5e8b030
--- a/main.cpp	Thu Oct 29 06:27:02 2015 +0000
+++ b/main.cpp	Thu Oct 29 06:58:08 2015 +0000
@@ -43,14 +43,14 @@
 };
 
 ArduCAM myCAM(D11, D12, D13, D10, D14, D15);
-//ArduLCD myGLCD(D11, D12, D13, D10);
+ArduLCD myGLCD(D11, D12, D13, D10);
 SDFileSystem SD(PB_3, PB_2, PB_1, PB_0, "sd");
 Serial pc(USBTX, USBRX);
 bool isShowFlag = true;
 
 int main()
 {
-    //*(volatile uint32_t *)(0x41001014) = 0x0060100; //clock 48MHz
+    *(volatile uint32_t *)(0x41001014) = 0x0060100; //clock 48MHz
     
     setup();
     
@@ -67,10 +67,20 @@
   
   pc.baud(115200);
   pc.printf("ArduCAM Start!\r\n"); 
-
-  //Check if the ArduCAM SPI bus is OK
+  
+  uint8_t temp1,temp2;
+  myCAM.write_reg(ARDUCHIP_TEST1, 0x55);         //Write to test1 register by 0x55
+  myCAM.write_reg(ARDUCHIP_TEST2, 0xAA);         //Write to test1 register by 0xaa
+  wait_ms(1000);
+  temp1 = myCAM.read_reg(ARDUCHIP_TEST1);                //Read from test1 register 
+  temp2 = myCAM.read_reg(ARDUCHIP_TEST2);                //Read from test1 register
+  pc.printf("temp1 : %d\r\n",temp1);
+  pc.printf("temp2 : %d\r\n",temp2);
+  wait_ms(1000);
+  
   myCAM.write_reg(ARDUCHIP_TEST1, 0x55);
   temp = myCAM.read_reg(ARDUCHIP_TEST1);
+  
   if(temp != 0x55)
   {
     pc.printf("SPI interface Error!\r\n");
@@ -81,7 +91,7 @@
   myCAM.set_mode(MCU2LCD_MODE);
   
   //Initialize the LCD Module
-  //myGLCD.InitLCD();
+  myGLCD.InitLCD();
   
   //Check if the camera module type is OV5642
   myCAM.rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid);
@@ -108,18 +118,21 @@
     if(!myCAM.get_bit(ARDUCHIP_TRIG,VSYNC_MASK))                //New Frame is coming
     {
        myCAM.set_mode(MCU2LCD_MODE);        //Switch to MCU
-       //myGLCD.resetXY();
+       myGLCD.resetXY();
        myCAM.set_mode(CAM2LCD_MODE);        //Switch to CAM
        while(!myCAM.get_bit(ARDUCHIP_TRIG,VSYNC_MASK));     //Wait for VSYNC is gone
+       pc.printf("VSYNC\r\n");
     }
     else if(myCAM.get_bit(ARDUCHIP_TRIG,SHUTTER_MASK))
-    {
+    {       
+       pc.printf("SHUTTER\r\n");
        previous_time = millis();
        while(myCAM.get_bit(ARDUCHIP_TRIG,SHUTTER_MASK))
        {
          if((millis() - previous_time) > 1500)
          {
            Playback();
+           pc.printf("playback\r\n");
          }
        }
        if((millis() - previous_time) < 1500)
@@ -129,6 +142,7 @@
          strcat(str,".bmp");                //Generate file name
          myCAM.set_mode(MCU2LCD_MODE);      //Switch to MCU, freeze the screen 
          GrabImage(str);
+         pc.printf("GrabImage\r\n");
        }
     }
   }
@@ -205,7 +219,7 @@
   char str[8];
   int k = 0;
   myCAM.set_mode(MCU2LCD_MODE);         //Switch to MCU
-  //myGLCD.InitLCD(PORTRAIT);
+  myGLCD.InitLCD(PORTRAIT);
   
   while(1)
   {
@@ -215,8 +229,8 @@
       inFile = fopen("preview","r");
       if (! inFile) 
         return;
-      //myGLCD.clrScr();
-      //myGLCD.resetXY();
+      myGLCD.clrScr();
+      myGLCD.resetXY();
       dispBitmap(inFile);
       fclose(inFile);
       wait_ms(2000);
@@ -238,7 +252,7 @@
         //Serial.write(VL);
         VH = fread(buf,256,1,fname);
         //Serial.write(VH);
-        //myGLCD.LCD_Write_DATA(VH,VL);
+        myGLCD.LCD_Write_DATA(VH,VL);
     }
-    //myGLCD.clrXY();
+    myGLCD.clrXY();
 }