Implemented first Hangar-Service

Dependencies:   CalibrateMagneto QuaternionMath

Fork of SML2 by TobyRich GmbH

Revision:
30:a56c141d1d38
Parent:
29:e81a2b1f8825
Child:
46:fd5a62296b12
--- a/CherryCam.cpp	Wed Apr 22 11:06:42 2015 +0000
+++ b/CherryCam.cpp	Thu Apr 23 12:13:28 2015 +0000
@@ -20,8 +20,7 @@
     if (recording)
         return;
         
-    generateFallingEdge(shutterPin);
-    recording = true;
+    generateFallingEdge();
 }
     
 void CherryCam::stop()
@@ -29,13 +28,17 @@
     if (!recording)
         return;
         
-    generateFallingEdge(shutterPin);
-    recording = false;
+    generateFallingEdge();
 }
 
-void CherryCam::generateFallingEdge(DigitalOut &d)
+void CherryCam::generateFallingEdge()
 {
-    d = 1;
-    wait_ms(1);
-    d = 0;
+    shutterPin = 1;
+    pulldownTimer.attach(this, &CherryCam::pulldownShutterPin, 0.5); // pull down after 1 sec
+}
+
+void CherryCam::pulldownShutterPin()
+{
+    shutterPin = 0;
+    recording = !recording;
 }
\ No newline at end of file