AVGG

Dependencies:   mbed

Fork of 7_7Boboobooo by 譯文 張

Revision:
15:7f21c08be164
Parent:
11:9b4788de75fe
--- a/camera_api.cpp	Thu Jul 10 14:52:32 2014 +0000
+++ b/camera_api.cpp	Thu Jul 10 16:38:27 2014 +0000
@@ -46,8 +46,135 @@
  }
  
 
+void BX_camera::read(void)
+{
  
- void BX_camera::read(void){
+    w_f_vL=0x0000;
+    b_f_vL=0xffff;
+ 
+    w_f_vR=0x0000;
+    b_f_vR=0xffff;
+ 
+ 
+     line_CamR->enable();
+ 
+    *si=1;
+    *cam_clk=1;
+ 
+    wait_us(30);   // tune here
+    *si=0;
+    *cam_clk=0;
+ 
+ 
+   
+    
+ 
+ 
+    //input 128 //both
+ 
+    for(int i=127; i>=0; i--) {
+        *cam_clk=1;
+        wait_us(5);
+ 
+ 
+        line_imageR[i]=line_CamR->read_u16();
+  
+      
+      
+       
+ 
+        //  big small
+        if(line_imageR[i] > w_f_vR)
+            w_f_vR=line_imageR[i];
+        else if(line_imageR[i] < b_f_vR )
+            b_f_vR = line_imageR[i];
+ 
+ 
+ 
+ 
+ 
+        *cam_clk=0;
+        wait_us(5);
+ 
+ 
+    }
+   line_CamR->disable();
+ 
+  *si=1;
+    *cam_clk=1;
+ 
+    wait_us(30);   // tune here
+    *si=0;
+    *cam_clk=0;
+ 
+ 
+    
+    line_CamL->enable();
+     for(int i=127; i>=0; i--) {
+        *cam_clk=1;
+        wait_us(5);
+ 
+ 
+    
+  
+      
+      
+        line_imageL[i]=line_CamL->read_u16();
+ 
+        //  big small
+     
+ 
+        if(line_imageL[i] > w_f_vL)
+            w_f_vL=line_imageL[i];
+        else if(line_imageL[i] < b_f_vL )
+            b_f_vL = line_imageL[i];
+ 
+ 
+ 
+ 
+        *cam_clk=0;
+        wait_us(5);
+ 
+ 
+    }
+    
+    
+   
+  
+    line_CamL->disable();
+ 
+    //filter L R   //may change
+ 
+    for(int i=0; i<128; i++) {
+ 
+ 
+        if( (line_imageR[i]-b_f_vR) < (w_f_vR - line_imageR[i] )    )
+            sign_line_imageR[i]=' ';
+        else
+            sign_line_imageR[i]='O';
+ 
+ 
+        if( (line_imageL[i]-b_f_vL) < (w_f_vL - line_imageL[i] )    )
+            sign_line_imageL[i]=' ';
+        else
+            sign_line_imageL[i]='O';
+ 
+ 
+ 
+ 
+ 
+        if(i==0) {
+            sign_line_imageR[i]='X';
+            sign_line_imageL[i]='X';
+        }
+ 
+ 
+    }
+ 
+ 
+ 
+}
+/* void BX_camera::read(void){
  
           w_f_vL=0x0000;
           b_f_vL=0xffff;
@@ -137,4 +264,4 @@
            
            
            
-           }
\ No newline at end of file
+           }*/
\ No newline at end of file