Laser Sensing Display for UI interfaces in the real world
Fork of skinGames_forktest by
Diff: hardwareIO/hardwareIO.cpp
- Revision:
- 35:35af5086ab4f
- Parent:
- 34:1244fa3f2559
- Child:
- 36:233b12d0b1f0
--- a/hardwareIO/hardwareIO.cpp Wed Nov 07 14:41:55 2012 +0000 +++ b/hardwareIO/hardwareIO.cpp Tue Nov 13 04:40:08 2012 +0000 @@ -56,16 +56,22 @@ switchTwo.mode(PullUp); switchOne.fall(this, &HardwareIO::switchOneInterrupt); // attach the address of the flip function to the falling edge switchTwo.fall(this, &HardwareIO::switchTwoInterrupt); // attach the address of the flip function to the falling edge - switchOneState=false; // false means fixed threshold + switchOneState=true; switchTwoState=false; switchOneChange=false; switchTwoChange=false; - ledSwitchOne=(switchOneState? 1 :0); + + setSwitchOneState(true); //equal to switchOneState=true, plus set led value. False means fixed threshold, true AUTO THRESHOLD (will be the default mode) // Read and update pot value: // updatePotValue(); // the value will be ajusted in the range 0-255 } +void HardwareIO::setSwitchOneState(bool newstate) { + switchOneState=newstate; + ledSwitchOne=(switchOneState? 1 :0); +} + // these ISR could do more (like debouncing). // For the time being, I will debounce electrically with a small capacitor. void HardwareIO::switchOneInterrupt() { @@ -235,8 +241,10 @@ //scan the total surface with a custom resolution //send the lockin value for each point as a byte on the serial port to the PC //use "scanSLP_save" to see the data on processing - - + // First, set the red laser on, and other off: + setRGBPower(0x4); + wait_us(1000); // just to give time to the lockin to set + int shiftX = (MAX_AD_MIRRORS - MIN_AD_MIRRORS) / pointsPerLine; int shiftY = (MAX_AD_MIRRORS - MIN_AD_MIRRORS) / pointsPerLine;