-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera.cpp
More file actions
36 lines (21 loc) · 779 Bytes
/
Copy pathcamera.cpp
File metadata and controls
36 lines (21 loc) · 779 Bytes
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
//camera.cpp - library for interacting with the camera
#include "camera.h"
#define READ_SIZE 32
const char GET_SIZE[5] = {0x56, 0x00, 0x34, 0x01, 0x00};
const char RESET_CAMERA[4] = {0x56, 0x00, 0x26, 0x00};
const char TAKE_PICTURE[5] = {0x56, 0x00, 0x36, 0x01, 0x00};
const char STOP_TAKING_PICTURES[5] = {0x56, 0x00, 0x36, 0x01, 0x03};
const char READ_DATA[8] = {0x56, 0x00, 0x32, 0x0C, 0x00, 0x0A, 0x00, 0x00};
Camera::Camera(void) {
serial = Uart(1);
}
void Camera::reset(void) {
while (!serial.transmit(RESET_CAMERA, 4));
char ret[4];
while(!serial.receive(ret, 4));
if ((ret[0] != '0x76') && (ret[1] != '0x00') && (re[2] != '0x26') &&
(ret[3] != '0x00')) {
cerr << "Error resetting camera\n";
exit(1);
}
}