TSL1401 is the line sensor camera.This library is used to read the raw data. modified Polytec paris sud
Fork of TSL1401 by
TSL1401.cpp
- Committer:
- bouaziz
- Date:
- 2018-01-26
- Revision:
- 1:7a8ca2147516
- Parent:
- 0:71198cb26156
File content as of revision 1:7a8ca2147516:
#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 ) { SI = s; CLK = c; A0 = new AnalogIn( a ); } /* Destructor */ TSL1401::~TSL1401() { if( A0 != NULL) { delete A0; } } /* Image Caputure */ int *TSL1401::Capture( int LineStart, int LineStop) { int i; 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; TAOS_CLK_HIGH; TAOS_CLK_LOW; } */ for(i = LineStart; i < LineStop; i++) { TAOS_CLK_HIGH; // 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; Max = ( Max < *pp ? *pp : Max); // Max = ( Max < ImageData[i] ? ImageData[i] : Max); /*if(Max < ImageData[i]){ Max = ImageData[i]; } */ Min = (Min > *pp ? *pp : Min); pp++; //Min = (Min > ImageData[i] ? ImageData[i] : Min); } return ImageData; }