Library for LinkSprite Y201 JPEG serial camera.
Y201.h
- Committer:
- ashleymills
- Date:
- 2012-07-02
- Revision:
- 3:decf96d8e6b0
- Parent:
- 2:7d8a6087f2e5
- Child:
- 6:d8f5f576712b
- Child:
- 10:fd12c96da974
File content as of revision 3:decf96d8e6b0:
#include "mbed.h" #define MODSERIAL_DEFAULT_RX_BUFFER_SIZE 512 #define MODSERIAL_DEFAULT_TX_BUFFER_SIZE 64 #include "MODSERIAL.h" #pragma once class Y201 : MODSERIAL { private: // serial commands to drive camera static const int resetSeq [4]; static const int resetSeqLen = 4; static const int resetSeqAck [4]; static const int resetSeqAckLen = 4; static const int takePicSeq [5]; static const int takePicSeqLen = 5; static const int takePicSeqAck [5]; static const int takePicSeqAckLen = 5; static const int set160x120 [9]; static const int set320x240 [9]; static const int set640x480 [9]; static const int setSizeLen = 9; static const int setSizeAck [5]; static const int setSizeAckLen = 5; static const int readFileSize [5]; static const int readFileSizeLen = 5; static const int readFileSizeAck [7]; static const int readFileSizeAckLen = 7; static const int readFileHead [8]; static const int readFileHeadLen = 8; static const int readFileAck [5]; static const int readFileAckLen = 5; public: enum Y201ImageSize { e160x120, e320x240, e640x480 }; Y201(PinName tx, PinName rx, const char *name = NULL); bool setImageSize(Y201ImageSize size); bool takePicture(); bool readImageSize(int *fileSize); bool readImage(int startAddress, int readLen, uint8_t *readBuffer); void trash(); bool waitForInt(int bytes, int *fileSize); bool waitFor(const int *seq, const int seqLen); void putSeq(const int *seq, int seqLen); bool reset(); };