A Simple library to capture pictures from the uCam by 4D Systems

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers uCam.h Source File

uCam.h

00001 #ifndef __UCAM_H__
00002 #define __UCAM_H__
00003 
00004 #include "mbed.h"
00005 #include "MODSERIAL.h"
00006 #include "FeRAM.h"
00007 
00008 // Define colours
00009 #define GREY_2BIT 0x01
00010 #define GREY_4BIT 0x02
00011 #define GREY_8BIT 0x03
00012 #define COLOUR_8BIT 0x04
00013 #define COLOUR_12BIT 0x05
00014 #define COLOUR_16BIT 0x06
00015 #define JPEG 0x07
00016 // Define RAW formats
00017 #define RAW_80x60 0x01
00018 #define RAW_160x120 0x03
00019 #define RAW_320x240 0x05
00020 #define RAW_640x480 0x07
00021 #define RAW_128x128 0x09
00022 #define RAW_128x96 0x0B
00023 // Define JPEG formats
00024 #define JPEG_60x64 0x01
00025 #define JPEG_160x128 0x03
00026 #define JPEG_320x240 0x05
00027 #define JPEG_640x480 0x07
00028 // Define uCam responses
00029 #define _ACK 0x0E
00030 #define _SYNC 0x0D
00031 
00032 // mode codes for 23K256
00033 #define BYTE_MODE       0x00
00034 #define SEQUENTIAL_MODE 0x40
00035 
00036 // command codes for 23K256
00037 #define READ            0x03
00038 #define WRITE           0x02
00039 #define READ_STATUS     0x05 // called RDSR in datasheet
00040 #define WRITE_STATUS    0x01 // called WRSR in datasheet
00041 
00042 class uCam {
00043 public:
00044     // define which pins are used
00045     uCam(PinName tx, PinName rx, int buffer);
00046 
00047     // Methods
00048     int Sync();
00049     int SetBaud(int baud);
00050     int Initial(unsigned char COLOUR, unsigned char RES);
00051     int Get_Picture(unsigned char *data);
00052     int Get_Response(unsigned char type, unsigned char command);
00053     int Save_Picture_To_Memory(FeRAM &flash, int address);
00054     int Save_Zoom_Picture_To_Memory(FeRAM &flash, int address);
00055     
00056 private:
00057     MODSERIAL _uCam;    // uCam TX and RX
00058     
00059 };
00060 
00061 #endif