Joseph Bradshaw / uCAM_TTL120

Dependencies:   MODSERIAL

Dependents:   mbed_uCAM_TTL120_20141118

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers uCAM_TTL120.h Source File

uCAM_TTL120.h

00001 // uCAM TTL(120) jpeg camera class for mbed
00002 // J. Bradshaw 20141106
00003 
00004 #include "mbed.h"
00005 //define larger buffers for return packets
00006 #define MODSERIAL_DEFAULT_RX_BUFFER_SIZE 1024
00007 #define MODSERIAL_DEFAULT_TX_BUFFER_SIZE 1024 
00008 #include "MODSERIAL.h"
00009 
00010 #ifndef uCAM_TTL120_H
00011 #define uCAM_TTL120_H
00012 
00013 //uCAM command defines, page 8 of uCAM manual
00014 #define uCAM_INITIAL            0xAA01
00015 #define uCAM_GET_PICTURE        0xAA04
00016 #define uCAM_SNAPSHOT           0xAA05
00017 #define uCAM_SET_PACKAGE_SIZE   0xAA06
00018 #define uCAM_SET_BAUD_RATE      0xAA07
00019 #define uCAM_RESET              0xAA08
00020 #define uCAM_DATA               0xAA0A
00021 #define uCAM_SYNC               0xAA0D
00022 #define uCAM_ACK                0xAA0E
00023 #define uCAM_NAK                00xAA0F
00024 #define uCAM_LIGHT              0xAA13
00025 
00026 /**
00027  * uCAM_TTL120 Class.
00028  */
00029  
00030 class uCAM_TTL120{
00031 public:
00032     /**
00033      * Constructor.
00034      * @param tx - Serial port transmit pin
00035      * @param rx - Serial port recieve pin
00036      */ 
00037     uCAM_TTL120(PinName tx, PinName rx);
00038     int uCAM_read(char *str, int numchars, float timeout);
00039 
00040     void uCAM_Command_Send(int command,char p1,char p2,char p3,char p4);
00041     int uCAM_GetACK(int command);
00042     int uCAM_Connect(void);
00043     void uCAM_FlushBuffer(void);
00044     int uCAM_send_INITIAL_80x60_16RAW(void);
00045     int uCAM_send_INITIAL_80x60_2RAW(void);
00046     int uCAM_send_INITIAL_128x128_4RAW(void);
00047     int uCAM_send_SNAPSHOT(void);
00048     int uCAM_send_GET_PICTURE_80x60_16COL_RAW(FILE *fp);
00049     int uCAM_send_GET_PICTURE_80x60_2GRAY_RAW(void);
00050     int uCAM_send_GET_PICTURE_128x128_4GRAY_RAW(void);
00051     
00052     void uCAM_TakePic_RAW_16COLOR_80x60(FILE *fp);
00053     void uCAM_TakePic_RAW_2GRAY_80x60(void);
00054     void uCAM_TakePic_RAW_4GRAY_128x128(void);
00055 
00056     int uCAM_get_jpeg(FILE *fp);
00057 
00058     void uCAM_set_baud(void);
00059 
00060     char picture[10000];
00061     MODSERIAL _cam;
00062 private:    
00063     Timer *timerCam; 
00064 };
00065 
00066 #endif /* uCAM_TTL120_H */