Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Revision:
10:6f8e48dca1bd
Parent:
0:345b3bc7a0ea
Child:
14:0fc33a3a7b4b
--- a/hardwareIO/hardwareIO.h	Wed Apr 11 13:06:23 2012 +0000
+++ b/hardwareIO/hardwareIO.h	Wed Apr 11 14:51:08 2012 +0000
@@ -41,13 +41,19 @@
 //      33              7               127
 //      65              6               63
 //  ...
+#define NB_SCANS 8 // number of scans performed to generate the LUT table (actually, each site CUMULATES NB_SCANS values)
+
 #define LUT_FILENAME "/local/LUT.txt"
 //#define LUT_H_FILENAME "/local/LUT_pos.txt" //define if human readable file is required
 
-//Methode of acquisition and correction
-#define lockin_read() lockin.getMedianValue()
+// Current Look-up table approximation: 
 #define LUT_BILINEAR 
 
+//Current method for lockin data acquisition and correction
+#define lockin_read() lockin.getMedianValue() // lockin.getSmoothValue(); //return the average of the value stored on the buffer
+                                              // lockin.getLastValue(); //return the last conversion of the ADC
+                                              // lockin.getMedianValue(); //return the median value of the buffer
+
 
 // **** REFERENCE SIGNAL: 
 /*
@@ -65,21 +71,21 @@
     void init(void);
 
     //Lock-in acquisition methods:
-    float LockInRead_Volts(); 
-    int LockInRead_AD(); 
-    float LockInAD_to_Volts(int); 
+   // float LockInRead_Volts(); 
+   // int LockInRead_AD(); 
+  //  float LockInAD_to_Volts(int); 
     
     //Look-Up Table:
-    uint16 lut[LUT_RESOLUTION][LUT_RESOLUTION]; //Look-Up Table
+    uint16 lut[LUT_RESOLUTION][LUT_RESOLUTION]; //Look-Up Table (uint16 is "unsigned short")
     void scanLUT(); //create and save the Look-Up Table
     void setLUT(); //set the Look-Up Table: either from scanning, or from the file LUT.TXT (if it is present)
-    float lockInCorrectedValue(int x, int y); //return the lockin value corrected with the Look-UpTable
+    float lockInCorrectedValue(unsigned short x, unsigned short y); //return the lockin value corrected with the Look-UpTable (this is, a RATIO of reflectivities, and <1)
     
-    void scan_serial(int pointsPerLine = 400);
+    void scan_serial(unsigned short pointsPerLine = 400);
 
     // SPI control for DAC for mirrors and red laser power (low level): 
-    void writeOutX(int value);
-    void writeOutY(int value);
+    void writeOutX(unsigned short value);
+    void writeOutY(unsigned short value);
     
     // mirror degree-to-AD units conversion factors: 
     //float AD_to_Deg_MIRROR_X;//=1.0*(MAX_DEG_MIRROR_X-MIN_DEG_MIRROR_X)/(MAX_AD_MIRRORS-MIN_AD_MIRRORS);