Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Y201.h
00001 #include "mbed.h" 00002 #define MODSERIAL_DEFAULT_RX_BUFFER_SIZE 1024 00003 #define MODSERIAL_DEFAULT_TX_BUFFER_SIZE 64 00004 #include "MODSERIAL.h" 00005 #pragma once 00006 00007 class Y201 : MODSERIAL { 00008 00009 private: 00010 00011 // serial commands to drive camera 00012 static const char resetSeq [4]; 00013 static const int resetSeqLen = 4; 00014 static const char resetSeqAck [4]; 00015 static const int resetSeqAckLen = 4; 00016 static const char takePicSeq [5]; 00017 static const int takePicSeqLen = 5; 00018 static const char takePicSeqAck [5]; 00019 static const int takePicSeqAckLen = 5; 00020 static const char set160x120 [9]; 00021 static const char set320x240 [9]; 00022 static const char set640x480 [9]; 00023 static const int setSizeLen = 9; 00024 static const char setSizeAck [5]; 00025 static const int setSizeAckLen = 5; 00026 static const char readFileSize [5]; 00027 static const int readFileSizeLen = 5; 00028 static const char readFileSizeAck [7]; 00029 static const int readFileSizeAckLen = 7; 00030 static const char readFileHead [8]; 00031 static const int readFileHeadLen = 8; 00032 static const char readFileAck [5]; 00033 static const int readFileAckLen = 5; 00034 /* 00035 static const char changeBaudRateSeq [5]; 00036 static const int changeBaudRateSeqLen = 5; 00037 static const char changeBaudRateAck [5]; 00038 static const int changeBaudRateAckLen = 5; 00039 */ 00040 static const char enterPowerSavingSeq[7]; 00041 static const int enterPowerSavingLen = 7; 00042 static const char enterPowerSavingAck[5]; 00043 static const int enterPowerSavingAckLen = 5; 00044 static const char exitPowerSavingSeq [7]; 00045 static const int exitPowerSavingLen = 7; 00046 static const char exitPowerSavingAck[5]; 00047 static const int exitPowerSavingAckLen = 5; 00048 00049 public: 00050 00051 enum Y201ImageSize { 00052 e160x120, 00053 e320x240, 00054 e640x480 00055 }; 00056 00057 /* 00058 enum Y201BaudRate { 00059 e9600, 00060 e19200, 00061 e38400, 00062 e57600, 00063 e115200 00064 }; 00065 */ 00066 00067 Y201(PinName tx, PinName rx, const char *name = NULL); 00068 00069 bool setImageSize(Y201ImageSize size); 00070 bool takePicture(); 00071 bool readImageSize(int *fileSize); 00072 bool readImage(int startAddress, int readLen, uint8_t *readBuffer); 00073 //bool changeBaudRate(Y201BaudRate baudRate); 00074 bool enterPowerSaving(); 00075 bool exitPowerSaving(); 00076 void trash(); 00077 00078 bool waitForInt(int bytes, int *fileSize); 00079 bool waitFor(const char *seq, const int seqLen); 00080 void putSeq(const char *seq, int seqLen); 00081 bool reset(); 00082 00083 };
Generated on Mon Jul 18 2022 22:10:58 by
1.7.2