Joseph Bradshaw / uCAM_TTL120

Dependencies:   MODSERIAL

Dependents:   mbed_uCAM_TTL120_20141118

Revision:
0:fcc0eaeeb35c
Child:
1:a33d709303c6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uCAM_TTL120.h	Mon Nov 17 21:03:43 2014 +0000
@@ -0,0 +1,60 @@
+// uCAM TTL(120) jpeg camera class for mbed
+// J. Bradshaw 20141106
+
+#include "mbed.h"
+
+#ifndef uCAM_TTL120_H
+#define uCAM_TTL120_H
+
+//uCAM command defines, page 8 of uCAM manual
+#define uCAM_INITIAL            0xAA01
+#define uCAM_GET_PICTURE        0xAA04
+#define uCAM_SNAPSHOT           0xAA05
+#define uCAM_SET_PACKAGE_SIZE   0xAA06
+#define uCAM_SET_BAUD_RATE      0xAA07
+#define uCAM_RESET              0xAA08
+#define uCAM_DATA               0xAA0A
+#define uCAM_SYNC               0xAA0D
+#define uCAM_ACK                0xAA0E
+#define uCAM_NAK                00xAA0F
+#define uCAM_LIGHT              0xAA13
+
+/**
+ * uCAM_TTL120 Class.
+ */
+ 
+class uCAM_TTL120{
+public:
+    /**
+     * Constructor.
+     * @param tx - Serial port transmit pin
+     * @param rx - Serial port recieve pin
+     */ 
+    uCAM_TTL120(PinName tx, PinName rx);
+    int uCAM_read(char *str, int numchars, float timeout);
+
+    void uCAM_Command_Send(int command,char p1,char p2,char p3,char p4);
+    int uCAM_GetACK(void);
+    int uCAM_Connect(void);
+    void uCAM_FlushBuffer(void);
+    int uCAM_send_INITIAL_80x60_16RAW(void);
+    int uCAM_send_INITIAL_80x60_2RAW(void);
+    int uCAM_send_INITIAL_128x128_4RAW(void);
+    int uCAM_send_SNAPSHOT(void);
+    int uCAM_send_GET_PICTURE_80x60_16COL_RAW(void);
+    int uCAM_send_GET_PICTURE_80x60_2GRAY_RAW(void);
+    int uCAM_send_GET_PICTURE_128x128_4GRAY_RAW(void);
+    
+    void uCAM_TakePic_RAW_16COLOR_80x60(void);
+    void uCAM_TakePic_RAW_2GRAY_80x60(void);
+    void uCAM_TakePic_RAW_4GRAY_128x128(void);
+
+    void uCAM_set_baud(void);
+
+    char picture[10000];
+    Serial _cam;
+private:    
+    Timer *timerCam; 
+};
+
+#endif /* uCAM_TTL120_H */