Example controlling galvanomirrors (X and Y) using the spi DAC MCP4922 and the new platform FRDM_K64F

Dependencies:   mbed

Revision:
3:89f592efbe84
Parent:
2:383b2acec6e4
Child:
4:1428775752f7
--- a/laserProjectorHardware/laserProjectorHardware.h	Mon May 26 08:37:38 2014 +0000
+++ b/laserProjectorHardware/laserProjectorHardware.h	Wed Jun 04 09:47:04 2014 +0000
@@ -16,9 +16,13 @@
 #define CS_DAC_MIRRORS   D7 //Chip Select of the first DAC (mirrors)
 
 //**** LASERS pins:
-#define LASER_RED_PIN   D8 // USED (TTL control). 
-#define LASER_GREEN_PIN D9 // NOT YET USED USED (TTL control)
-#define LASER_BLUE_PIN  D10 // NOT YET USED USED (TTL control)
+// NOTE: for some reason PWM output D8 does not goes to 0!!
+#define LASER_LOCKIN_PIN D5 // this can be analog, or TTL controlled (PWM modulation or real analog output, in this case it needs to be pin DAC0_OUT
+#define LOCKIN_FREQUENCY 100 // in Hertz
+
+#define LASER_RED_PIN   D4 // NOT YET USED  (TTL control)
+#define LASER_GREEN_PIN D8 // NOT YET USED  (TTL control)
+#define LASER_BLUE_PIN  D6 // NOT YET USED  (TTL control)
 
 //**** MIRRORS: 
 //The DAC is 12 bytes capable (Max=4096), but we will limit this a little. 
@@ -45,6 +49,11 @@
     void writeOutXY(unsigned short valueX, unsigned short valueY) {writeOutX(valueX); writeOutY(valueY);};
  
      
+    // Lockin Laser: 
+    void setLockinFreq(int freqHz);
+    void setLockinPower(int powerLockin); // actually 0 or >0, for 0 and 50% duty cycle of the pwm output
+     
+     
     //Displaying lasers: 
     // Again: for the moment laser are TTL but these could be analog. Now, it is just: powerValue > 0 ==> 'true'; else 'false'
     // Red laser: