-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCamera.cpp
57 lines (49 loc) · 971 Bytes
/
Camera.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* Camera.cpp
*
* Created on: 17 Mar 2012
* Author: Robin
*/
#include "Camera.h"
Camera::Camera(int focus_pin, int shutter_pin)
{
_focus_pin = focus_pin;
_shutter_pin = shutter_pin;
// TODO Read from eeprom
interval = 1.0;
exposure_time = 100;
focus_hold_time = 0;
focus_with_shutter = 0;
post_exposure_delay = 100;
}
void Camera::reset()
{
shots = 0;
}
void Camera::focus()
{
}
void Camera::fire()
{
// Fire camera shutter
if ( focus_with_shutter )
{
digitalWrite(_focus_pin, HIGH);
}
digitalWrite(_shutter_pin, HIGH);
shots++;
Serial.print("Firing camera for ");
Serial.print(exposure_time);
Serial.print("ms");
MsTimer2::set(exposure_time, (void *)this, Camera::stop);
MsTimer2::start();
}
void Camera::stop(void * instance)
{
Camera* me = (Camera*)instance;
digitalWrite(me->_shutter_pin, LOW);
digitalWrite(me->_focus_pin, LOW);
MsTimer2::stop();
Serial.print("Camera firing complete");
// TODO Flag cycle complete
}