Bremen Team - Hangar / SML2

Dependencies:   CalibrateMagneto QuaternionMath

Fork of SML2 by TobyRich GmbH

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CherryCam.cpp Source File

CherryCam.cpp

00001 #include "CherryCam.h"
00002 
00003 CherryCam::CherryCam() : powerPin(p26), shutterPin(p30), recording(false)
00004 {
00005     powerPin = 0; // keep off initially
00006 }
00007 
00008 void CherryCam::powerOn()
00009 {
00010     powerPin = 1;
00011 }
00012 
00013 void CherryCam::powerOff()
00014 {
00015     powerPin = 0;
00016 }
00017 
00018 void CherryCam::start()
00019 {
00020     if (recording)
00021         return;
00022 
00023     generateFallingEdge();
00024 }
00025 
00026 void CherryCam::stop()
00027 {
00028     if (!recording)
00029         return;
00030 
00031     generateFallingEdge();
00032 }
00033 
00034 void CherryCam::generateFallingEdge()
00035 {
00036     shutterPin = 1;
00037     pulldownTimer.attach(this, &CherryCam::pulldownShutterPin, 0.5); // pull down after 1 sec
00038 }
00039 
00040 void CherryCam::pulldownShutterPin()
00041 {
00042     shutterPin = 0;
00043     recording = !recording;
00044 }