Class導入前です まだできてません
Dependencies: mbed CameraUS015sb612-3
JPEGCamera.h
00001 00002 /* Arduino JPEGCamera Library 00003 * Copyright 2010 SparkFun Electronics 00004 * Written by Ryan Owens 00005 * Modified by arms22 00006 * Ported to mbed by yamaguch 00007 */ 00008 00009 #ifndef JPEG_CAMERA_H 00010 #define JPEG_CAMERA_H 00011 00012 #include "mbed.h" 00013 00014 /** 00015 * Interface for LinkSprite JPEG Camera module LS-Y201 00016 */ 00017 class JPEGCamera : public Serial { 00018 public: 00019 /***/ 00020 enum PictureSize { 00021 SIZE160x120 = 0x22, 00022 SIZE320x240 = 0x11, 00023 SIZE640x480 = 0x00, 00024 }; 00025 00026 /** 00027 * Create JPEG Camera 00028 * 00029 * @param tx tx pin 00030 * @param rx rx pin 00031 */ 00032 JPEGCamera(PinName tx, PinName rx); 00033 00034 /** 00035 * Set picture size 00036 * 00037 * @param size picture size (available sizes are SIZE160x120, SIZE320x240, SIZE640x480) 00038 * @param doReset flag to perform reset operation after changing size 00039 * 00040 * @returns true if succeeded, false otherwise 00041 */ 00042 bool setPictureSize(JPEGCamera::PictureSize size, bool doReset = true); 00043 00044 /** 00045 * Return whether camera is ready or not 00046 * 00047 * @returns true if ready, false otherwise 00048 */ 00049 bool isReady(); 00050 00051 /** 00052 * Return whether camera is processing the taken picture or not 00053 * 00054 * @returns true if the camera is in processing, false otherwise 00055 */ 00056 bool isProcessing(); 00057 00058 /** 00059 * Take a picture 00060 * 00061 * @param filename filename to store the picture data 00062 * @returns true if succeeded, false otherwise 00063 */ 00064 bool takePicture(char *filename); 00065 /** 00066 * Process picture (writing the file) 00067 * 00068 * @returns true if no error in processing, false otherwise 00069 */ 00070 bool processPicture(); 00071 00072 /** 00073 * Perform reset oepration (it takes 4 seconds) 00074 * 00075 * @returns true if succeeded, false otherwise 00076 */ 00077 bool reset(); 00078 00079 /** 00080 * Send a picture command to the camera module 00081 * 00082 * @returns true if succeeded, false otherwise 00083 */ 00084 bool takePicture(void); 00085 00086 /** 00087 * Send a stop pictures command to the camera module 00088 * 00089 * @returns true if succeeded, false otherwise 00090 */ 00091 bool stopPictures(void); 00092 00093 /** 00094 * Get the picture image size 00095 * 00096 * @returns the actual image size in bytes 00097 */ 00098 int getImageSize(); 00099 00100 /** 00101 * Read the picture data to the buffer 00102 * 00103 * @param dataBuf data buffer address to store the received data 00104 * @param size data size to read 00105 * @param address the address of the picture data to read 00106 * 00107 * @returns the size of the data read 00108 */ 00109 int readData(char *dataBuf, int size, int address); 00110 00111 //private: 00112 Timer timer; 00113 FILE *fp; 00114 int imageSize; 00115 int address; 00116 enum State {UNKNOWN, READY, PROCESSING, ERROR = -1} state; 00117 00118 int sendReceive(char *buf, int sendSize, int receiveSize); 00119 int receive(char *buf, int size, int timeout); 00120 }; 00121 00122 #endif
Generated on Wed Jul 20 2022 21:28:09 by 1.7.2