CameraC328
Dependents: CameraC328_TestProgram CameraC328_Thresholding Camera_TestProgram_2015 Camera_TestProgram_2015 ... more
Diff: CameraC328.h
- Revision:
- 12:4daa8c068bc5
- Parent:
- 10:b04f3444b794
- Child:
- 13:17cf1e2015f7
--- a/CameraC328.h Mon Aug 30 14:43:37 2010 +0000 +++ b/CameraC328.h Mon Aug 30 22:24:39 2010 +0000 @@ -1,5 +1,5 @@ /** - * C328-7640 device driver class (Version 0.0.3) + * C328-7640 device driver class (Version 0.0.4) * Reference documents: C328-7640 User Manual v3.0 2004.8.19 * * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) @@ -23,6 +23,9 @@ class CameraC328 { public: + /** + * Color type. + */ enum ColorType { GrayScale2bit = 0x01, // 2bit for Y only GrayScale4bit = 0x02, // 4bit for Y only @@ -32,11 +35,17 @@ Jpeg = 0x07 }; + /** + * Raw resolution. + */ enum RawResolution { RawResolution80x60 = 0x01, RawResolution160x120 = 0x03 }; + /** + * JPEG resolution. + */ enum JpegResolution { JpegResolution80x64 = 0x01, JpegResolution160x128 = 0x03, @@ -44,6 +53,9 @@ JpegResolution640x480 = 0x07 }; + /** + * Error number. + */ enum ErrorNumber { NoError = 0x00, PictureTypeError = 0x01, @@ -68,17 +80,26 @@ SendCommandError = 0xff }; + /** + * Picture type. + */ enum PictureType { SnapshotPicture = 0x01, PreviewPicture = 0x02, JpegPreviewPicture = 0x05 }; + /** + * Snapshot type. + */ enum SnapshotType { CompressedPicture = 0x00, UncompressedPicture = 0x01 }; + /** + * Baud rate. + */ enum Baud { Baud7200 = 7200, Baud9600 = 9600, @@ -90,38 +111,77 @@ Baud115200 = 115200 }; + /** + * Reset type. + */ enum ResetType { ResetWholeSystem = 0x00, ResetStateMachines = 0x01 }; + /** + * Data type. + */ enum DataType { DataTypeSnapshotPicture = 0x01, DataTypePreviewPicture = 0x02, DataTypeJpegPreviewPicture = 0x05 }; - /* Constructor: CameraC328 - * Create a CameraC328 object, connected to the specified pins + /** + * Constructor. * - * Variables: - * tx - Used to specify data or command - * rx - Used to determine read or write - * e - enable - * d0..d3 - The data lines - * tx - TX of UART. - * rx - RX of UART. - * baud - Baudrate of UART. (Default is Baud19200) + * @param tx A pin for transmit. + * @param rx A pin for receive. + * @param baud Baud rate. (Default is Baud19200.) */ CameraC328(PinName tx, PinName rx, Baud baud = Baud19200); + /** + * Destructor. + */ ~CameraC328(); + /** + * Make a sync. for baud rate. + */ ErrorNumber sync(); + + /** + * Initialize. + * + * @param ct Color type. + * @param rr Raw resolution. + * @param jr JPEG resolution. + */ ErrorNumber init(ColorType ct, RawResolution rr, JpegResolution jr); + + /** + * Get uncompressed snapshot picture. + * + * @param func A pointer to a call back function. + */ ErrorNumber getUncompressedSnapshotPicture(void(*func)(size_t done, size_t total, char c)); + + /** + * Get uncompressed preview picture. + * + * @param func A pointer to a call back function. + */ ErrorNumber getUncompressedPreviewPicture(void(*func)(size_t done, size_t total, char c)); + + /** + * Get JPEG snapshot picture. + * + * @param func A pointer to a call back function. + */ ErrorNumber getJpegSnapshotPicture(void(*func)(char *buf, size_t siz)); + + /** + * Get JPEG preview picture. + * + * @param func A pointer to a call back function. + */ ErrorNumber getJpegPreviewPicture(void(*func)(char *buf, size_t siz)); private: