TSL1401 is the line sensor camera.This library is used to read the raw data. modified Polytec paris sud

Fork of TSL1401 by tanabe hitoshi

Revision:
1:7a8ca2147516
Parent:
0:71198cb26156
--- a/TSL1401.cpp	Sun Oct 05 04:12:56 2014 +0000
+++ b/TSL1401.cpp	Fri Jan 26 10:52:00 2018 +0000
@@ -1,11 +1,13 @@
 #include "TSL1401.h"
-
+#include "FastIO.h"
+#include "FastAnalogIn.h"
 /* Macro */
 #define TAOS_SI_HIGH    TAOS_SI = 1
 #define TAOS_SI_LOW     TAOS_SI = 0
 #define TAOS_CLK_HIGH   TAOS_CLK = 1
 #define TAOS_CLK_LOW    TAOS_CLK = 0
 
+FastAnalogIn AA1(p20,0);
 /* Constructor */
 TSL1401::TSL1401(PinName s, PinName c, PinName a )
 {
@@ -26,31 +28,43 @@
 int *TSL1401::Capture( int LineStart, int LineStop)
 {
     int i;
-    DigitalOut TAOS_SI(SI);
+    FastOut<p9> TAOS_SI;
+    FastOut<p10> TAOS_CLK;
+    
+ /*   DigitalOut TAOS_SI(SI);
     DigitalOut TAOS_CLK(CLK);
-    
+ */   
     Max = 0,Min = 70000;
     TAOS_SI_HIGH;
     TAOS_CLK_HIGH;
     TAOS_SI_LOW;
     ImageData[0] = 0;
+    volatile int *pp=ImageData;
     TAOS_CLK_LOW;
-    for(i = 1; i < LineStart; i++) {        
-        TAOS_CLK_HIGH;      
+ /*   for(i = 1; i < LineStart; i++) {        
+        TAOS_CLK_HIGH; 
+        TAOS_CLK_HIGH;           
         TAOS_CLK_LOW;
     }
+*/
     for(i = LineStart; i < LineStop; i++) {                  
         TAOS_CLK_HIGH;
-        ImageData[i] = A0->read_u16();  // inputs data from camera (one pixel each time through loop) 
+//        TAOS_CLK_HIGH;
+        TAOS_CLK_HIGH;
+ //       ImageData[i] = A0->read_u16();  // inputs data from camera (one pixel each time through loop) 
+       // ImageData[i] 
+            *pp = AA1.read_u16();
         TAOS_CLK_LOW;
-            
-        if(Max < ImageData[i]){
+        Max = ( Max < *pp ? *pp : Max);  
+      //  Max = ( Max < ImageData[i] ? ImageData[i] : Max);  
+        /*if(Max < ImageData[i]){
             Max = ImageData[i];
-        }           
-        if(Min > ImageData[i]){
-            Min = ImageData[i];
-        }
-            
+        } 
+*/
+        Min = (Min > *pp ? *pp : Min);
+        pp++;
+        //Min = (Min > ImageData[i] ? ImageData[i] : Min);
+         
     }
     return ImageData;
 }