Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
Diff: CherryCam.cpp
- Revision:
- 27:e71a2e4e6e3f
- Child:
- 28:13eee3fe2e34
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CherryCam.cpp Tue Apr 21 13:34:25 2015 +0000 @@ -0,0 +1,38 @@ +#include "CherryCam.h" + +CherryCam::CherryCam() : powerPin(p31), shutterPin(p30), recording(false) {} + +void CherryCam::powerOn() +{ + powerPin = 1; +} + +void CherryCam::powerOff() +{ + powerPin = 0; +} + +void CherryCam::start() +{ + if (recording) + return; + + generateFallingEdge(shutterPin); + recording = true; +} + +void CherryCam::stop() +{ + if (!recording) + return; + + generateFallingEdge(shutterPin); + recording = false; +} + +void CherryCam::generateFallingEdge(DigitalOut &d) +{ + d = 1; + wait_ms(1); + d = 0; +} \ No newline at end of file