Changes to allow hardware camera trigger
Fork of GPS_Incremental by
Diff: main.cpp
- Revision:
- 7:1730ee31d181
- Parent:
- 6:2a8486283198
--- a/main.cpp Tue Apr 02 15:22:37 2013 +0000 +++ b/main.cpp Wed Apr 17 20:21:58 2013 +0000 @@ -14,7 +14,7 @@ DigitalOut ppsled(LED1); //blink an LED at the 1PPS DigitalOut trig1led(LED2); //blink an LED at the camera trigger detection DigitalOut recordDataled(LED4); //set the led when the record is on -InterruptIn camera1Int(p30); // camera interrupt in +//InterruptIn camera1Int(p30); // camera interrupt in DigitalOut camera2Pin(p29); // We dont use the second camera interrupt //USB serial data stream back to the PC Serial toPC(USBTX, USBRX); //connect the GPS TX, RX to p9 and p10 @@ -34,6 +34,7 @@ double camera1Time; //GPS time of the camera event int TotalBadCRCmatches = 0; //counter for the bad CRC matches for all GPS messages + ////////////////////////////////////////////////////////////////////// // the below should become classes ////////////////////////////////////////////////////////////////////// @@ -65,15 +66,18 @@ }; //ISR for detection of the hotshoe trigger 1 -void camera1ISR(void) -{ +//void camera1ISR(void) +//{ //GPSTime is from POS message header //PPSTimeOffset is an even sec to account for Time becoming known AFTER the 1PPS //PPSTimeOffset + timeFromPPS.read() can be as large as 1.02 secs - camera1Time = GPSTime + PPSTimeOffset + timeFromPPS.read(); - camera1EventDetected = true; //reset to false in main after processing the image detection - trig1led = !trig1led; //blink an LEWD at the camera event detection -}; + //camera1Time = GPSTime + PPSTimeOffset + timeFromPPS.read(); + // + //trig1led = !trig1led; //blink an LEWD at the camera event detection + //wait(.25); + //camera2Pin = 1; //NDM add to cause HW trigger + //toPC.printf("\n inside the camera1ISR \n"); +//}; /////////////////////////////////////////////////////// //set up the USB port and the GPS COM port @@ -179,10 +183,10 @@ void setupTriggers() { - camera1Int.mode(PullUp); + //camera1Int.mode(PullDown); camera2Pin = 1; //establish Trigger ISR - camera1Int.rise(&camera1ISR); + //camera1Int.fall(&camera1ISR); }; @@ -203,7 +207,7 @@ //set up the ADIS16488 setupADIS(); - //setup Hotshoe + //setup Trigger setupTriggers(); setUpMessages(); //set up the expected text message commands frm the PC @@ -359,8 +363,29 @@ if (camera1EventDetected) //we have detected a camera trigger event { + camera2Pin = 0; //NDM add to cause trigger to fire + wait(.25); + + toPC.printf("\nfire 1st trigger\n"); + camera2Pin = 1; + wait(.50); + + camera2Pin = 0; //NDM add to cause trigger to fire + //GPSTime is from POS message header + //PPSTimeOffset is an even sec to account for Time becoming known AFTER the 1PPS + //PPSTimeOffset + timeFromPPS.read() can be as large as 1.02 secs + camera1Time = GPSTime + PPSTimeOffset + timeFromPPS.read(); + + wait(.25); + toPC.printf("\nfire 2nd trigger\n"); + + camera2Pin = 1; + toPC.printf("WMsg TRIGGERTIME %5.3lf\n", camera1Time); + trig1led = !trig1led; //blink an LED1 at the camera event detection + camera1EventDetected = false; + } if (detectedGPS1PPS) //true if we are exactly at a 1PPS event detection