Implemented first Hangar-Service

Dependencies:   CalibrateMagneto QuaternionMath

Fork of SML2 by TobyRich GmbH

CherryCam.cpp

Committer:
pvaibhav
Date:
2015-04-23
Revision:
30:a56c141d1d38
Parent:
29:e81a2b1f8825
Child:
46:fd5a62296b12

File content as of revision 30:a56c141d1d38:

#include "CherryCam.h"

CherryCam::CherryCam() : powerPin(p26), shutterPin(p30), recording(false)
{
    powerPin = 0; // keep off initially
}
    
void CherryCam::powerOn()
{
    powerPin = 1;
}

void CherryCam::powerOff()
{
    powerPin = 0;
}
    
void CherryCam::start()
{
    if (recording)
        return;
        
    generateFallingEdge();
}
    
void CherryCam::stop()
{
    if (!recording)
        return;
        
    generateFallingEdge();
}

void CherryCam::generateFallingEdge()
{
    shutterPin = 1;
    pulldownTimer.attach(this, &CherryCam::pulldownShutterPin, 0.5); // pull down after 1 sec
}

void CherryCam::pulldownShutterPin()
{
    shutterPin = 0;
    recording = !recording;
}