Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Revision:
23:bf666fcc61bc
Parent:
22:d87317d7ca91
Child:
24:4e52031a495b
--- a/hardwareIO/hardwareIO.cpp	Sat Jun 02 06:38:12 2012 +0000
+++ b/hardwareIO/hardwareIO.cpp	Wed Jun 13 10:09:41 2012 +0000
@@ -10,12 +10,14 @@
  SPI spiDAC(MOSI_PIN, MISO_PIN, SCK_PIN); // mosi, miso, sclk
  DigitalOut csDAC(CS_DAC_MIRRORS);
     
- DigitalOut Laser_Red(LASER_RED_PIN);
+ AnalogIn ain(POT_ANALOG_INPUT);   
+    
+ DigitalOut Laser_Red(LASER_RED_PIN); // NOTE: this is NOT the lock in sensing laser (actually, not used yet)
  DigitalOut Laser_Green(LASER_GREEN_PIN);
  DigitalOut Laser_Blue(LASER_BLUE_PIN);
 
 void HardwareIO::init(void) {
-    Laser_Red = 1;
+    Laser_Red = 0; // note: this is not the lockin-laser!
     Laser_Green = 0;
     Laser_Blue = 0;
     
@@ -91,10 +93,10 @@
     }
 }
 
-void HardwareIO::setRGBPower(char color) {
-    lockin.setLaserPower(color&0x04);
+void HardwareIO::setRGBPower(unsigned char color) {
+    lockin.setLaserPower(color&0x04>0? false : true);
     Laser_Green=(color&0x02)>>1;
-    Laser_Blue =(color&0x01); 
+    Laser_Blue =color&0x01;
 }
 
 void HardwareIO::showLimitsMirrors(int times) {
@@ -242,7 +244,7 @@
     fprintf(fp, "scan resolution: %d x %d\r\n",LUT_RESOLUTION, LUT_RESOLUTION);
     for(int j=0; j<LUT_RESOLUTION; j++){
       for(int i=0; i<LUT_RESOLUTION; i++){
-            fprintf(fp, "X=%d,\tY=%d,\tI=%d\t \r\n", int(shiftX*i + offsetX), int(shiftY*j + offsetY), lut[i][j] );
+            fprintf(fp, "X=%d,\tY=%d,\tI=%d\t \r\n", int(shiftX*i + offsetX), int(shiftY*j + offsetY), int(1.0*lut[i][j]/NB_SCANS) );
       }
     }
     fclose(fp); //close the file (the mBed will appear connected again)