Omar Hagrass / Camera_LS_Y201_CANSAT

Dependents:   CANSAT_COMBINED CANSAT_CAMERA_servo CANSAT_CAMERA2

Fork of Camera_LS_Y201 by Shinichiro Nakamura

Revision:
3:44403a8e4f44
Parent:
2:b3da8bab6e99
--- a/Camera_LS_Y201.cpp	Mon Aug 10 16:34:15 2015 +0000
+++ b/Camera_LS_Y201.cpp	Tue Aug 18 00:38:43 2015 +0000
@@ -37,6 +37,27 @@
 Camera_LS_Y201::Camera_LS_Y201(PinName tx, PinName rx) : serial(tx, rx) {
     serial.baud(38400);
 }
+Camera_LS_Y201::ErrorCode Camera_LS_Y201::baud()
+{
+    
+uint8_t send[7] = {
+        0x56,
+        0x00,
+        0x24,
+        0x03,
+        0x01,
+        0x0D,
+        0xA6
+//        56 00 24 03 01 XX XX
+    };
+uint8_t recv[5];
+waitIdle();
+sendBytes(send, sizeof(send), 200 * 1000) ;
+    
+    
+recvBytes(recv, sizeof(recv), 200 * 1000) ;
+    serial.baud(115200);
+    }
 
 /**
  * Dispose.
@@ -165,7 +186,7 @@
          * I think the camera need a time for operating.
          * But there is no any comments on the documents.
          */
-        wait_ms(100);
+        //wait_ms(100);
         return NoError;
     } else {
         return UnexpectedReply;
@@ -282,6 +303,7 @@
             if (!recvBytes(body, sizeof(body), 2 * 1000 * 1000)) {
                 return RecvError;
             }
+            //printf("saved");
             siz_done += sizeof(body);
             if (func != NULL) {
                 if (siz_done > siz_total) {
@@ -341,7 +363,7 @@
          * I think the camera need a time for operating.
          * But there is no any comments on the documents.
          */
-        wait_ms(100);
+       // wait_ms(100);
         return NoError;
     } else {
         return UnexpectedReply;