Dependencies:   mbed

Committer:
mux
Date:
Fri Dec 09 05:32:12 2011 +0000
Revision:
0:796c01948235
4D uCAM driver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mux 0:796c01948235 1 #ifndef __UCAM__H__
mux 0:796c01948235 2 #define __UCAM__H__
mux 0:796c01948235 3 #include <mbed.h>
mux 0:796c01948235 4 /*color space*/
mux 0:796c01948235 5 #define COLOR_YUV_2 0x01
mux 0:796c01948235 6 #define COLOR_YUV_4 0x02
mux 0:796c01948235 7 #define COLOR_YUV_8 0x03
mux 0:796c01948235 8 #define COLOR_RGB_332 0x04
mux 0:796c01948235 9 #define COLOR_RGB_444 0x05
mux 0:796c01948235 10 #define COLOR_RGB_565 0x06
mux 0:796c01948235 11 #define COLOR_JPEG 0x07
mux 0:796c01948235 12 /*raw resolution*/
mux 0:796c01948235 13 #define RAW_80x60 0x01
mux 0:796c01948235 14 #define RAW_160x120 0x03
mux 0:796c01948235 15 #define RAW_320x240 0x05
mux 0:796c01948235 16 #define RAW_640x480 0x07
mux 0:796c01948235 17 #define RAW_128x128 0x09
mux 0:796c01948235 18 #define RAW_128x96 0x0B
mux 0:796c01948235 19 /*jpeg resolution*/
mux 0:796c01948235 20 #define JPEG_80x64 0x01
mux 0:796c01948235 21 #define JPEG_160x128 0x03
mux 0:796c01948235 22 #define JPEG_320x240 0x05
mux 0:796c01948235 23 #define JPEG_640x480 0x07
mux 0:796c01948235 24 struct ucam_command;
mux 0:796c01948235 25
mux 0:796c01948235 26 class UCam{
mux 0:796c01948235 27 public:
mux 0:796c01948235 28 Serial *ucam;
mux 0:796c01948235 29 DigitalOut led;
mux 0:796c01948235 30
mux 0:796c01948235 31 public:
mux 0:796c01948235 32 UCam(PinName tx_pin, PinName rx_pin, PinName led_pin, uint32_t baudrate);
mux 0:796c01948235 33 ~UCam();
mux 0:796c01948235 34 int8_t connect();
mux 0:796c01948235 35 int8_t snapshot(uint8_t *buf, uint16_t *len, uint8_t colorspace, uint8_t raw_size, uint8_t jpeg_size);
mux 0:796c01948235 36 int8_t start_video(uint8_t colorspace, uint8_t raw_size, uint8_t jpeg_size);
mux 0:796c01948235 37 int8_t next_frame(uint8_t *buf, uint16_t *len);
mux 0:796c01948235 38 int8_t end_video();
mux 0:796c01948235 39
mux 0:796c01948235 40 private:
mux 0:796c01948235 41 void uart_isr();
mux 0:796c01948235 42 int8_t send_cmd(uint8_t cmd, uint8_t p1=0, uint8_t p2=0, uint8_t p3=0, uint8_t p4=0, uint8_t noack=0);
mux 0:796c01948235 43 int8_t recv_cmd(struct ucam_command *cmd);
mux 0:796c01948235 44 };
mux 0:796c01948235 45 #endif/*#define __UCAM_H__*/