Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Revision:
14:0fc33a3a7b4b
Parent:
10:6f8e48dca1bd
Child:
22:d87317d7ca91
--- a/hardwareIO/hardwareIO.cpp	Thu Apr 12 09:50:47 2012 +0000
+++ b/hardwareIO/hardwareIO.cpp	Thu Apr 12 13:02:59 2012 +0000
@@ -20,7 +20,8 @@
     Laser_Blue = 0;
     
     //Serial Communication setup:
-    pc.baud(921600);//115200);//
+    pc.baud(115200);//
+   //  pc.baud(921600);//115200);//
     
     // Setup for lock-in amplifier and pwm references:
     lockin.init();
@@ -113,7 +114,7 @@
         for(int i=0; i<pointsPerLine; i++){
           writeOutX(i*shiftX + MIN_AD_MIRRORS);
 
-          wait_us(100);//delay between each points
+          wait_us(200);//delay between each points
           
           // SEND A VALUE BETWEEN 0 and 255:
           pc.putc(int(255.0*lockin.getMedianValue()/4095));//printf("%dL",int(valueLockin*255));//pc.putc(int(lockin*255));//
@@ -223,8 +224,8 @@
 #else 
 //*******Correction using BILINEAR approximation
 #ifdef LUT_BILINEAR
-    int X = x >> LUT_BITS_SHIFT; //mirror "x" is 12bits, LUT "X" needs 4bits when lut is 17x17
-    int Y = y >> LUT_BITS_SHIFT; //mirror "y" is 12bits, LUT "Y" needs 4bits when lut is 17x17
+    unsigned short X = x >> LUT_BITS_SHIFT; //mirror "x" is 12bits, LUT "X" needs 4bits when lut is 17x17
+    unsigned short Y = y >> LUT_BITS_SHIFT; //mirror "y" is 12bits, LUT "Y" needs 4bits when lut is 17x17
     float dx = 1.0*(x & LUT_BITS_MASK)/(LUT_BITS_MASK+1); //weight to apply on X (mask with 255 and norm) 
     float dy = 1.0*(y & LUT_BITS_MASK)/(LUT_BITS_MASK+1); //weight to apply on Y (mask with 255 and norm)
     
@@ -236,8 +237,8 @@
 #else
 //*******Correction using LINEAR approximation
 #ifdef LUT_LINEAR
-    int X = x >> LUT_BITS_SHIFT; //mirror "x" is 12bits, LUT "X" needs 4bits when lut is 17x17
-    int Y = y >> LUT_BITS_SHIFT; //mirror "y" is 12bits, LUT "Y" needs 4bits when lut is 17x17
+    unsigned short X = x >> LUT_BITS_SHIFT; //mirror "x" is 12bits, LUT "X" needs 4bits when lut is 17x17
+    unsigned short Y = y >> LUT_BITS_SHIFT; //mirror "y" is 12bits, LUT "Y" needs 4bits when lut is 17x17
     float dx = 1.0*(x & LUT_BITS_MASK)/(LUT_BITS_MASK+1); //weight to apply on X (mask with 255 and norm) 
     float dy = 1.0*(y & LUT_BITS_MASK)/(LUT_BITS_MASK+1); //weight to apply on Y (mask with 255 and norm)
     float linearLUT, dzx, dzy;