Library for LinkSprite Y201 JPEG serial camera.
Y201.h@0:4c0fca059a0a, 2012-06-02 (annotated)
- Committer:
- ashleymills
- Date:
- Sat Jun 02 11:47:56 2012 +0000
- Revision:
- 0:4c0fca059a0a
- Child:
- 1:30a6aeda21c2
[mbed] converted /3GCamera/Y201
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashleymills | 0:4c0fca059a0a | 1 | #include "mbed.h" |
ashleymills | 0:4c0fca059a0a | 2 | #pragma once |
ashleymills | 0:4c0fca059a0a | 3 | |
ashleymills | 0:4c0fca059a0a | 4 | class Y201 : Serial { |
ashleymills | 0:4c0fca059a0a | 5 | |
ashleymills | 0:4c0fca059a0a | 6 | private: |
ashleymills | 0:4c0fca059a0a | 7 | |
ashleymills | 0:4c0fca059a0a | 8 | // serial commands to drive camera |
ashleymills | 0:4c0fca059a0a | 9 | static const int resetSeq [4]; |
ashleymills | 0:4c0fca059a0a | 10 | static const int resetSeqLen = 4; |
ashleymills | 0:4c0fca059a0a | 11 | static const int resetSeqAck [4]; |
ashleymills | 0:4c0fca059a0a | 12 | static const int resetSeqAckLen = 4; |
ashleymills | 0:4c0fca059a0a | 13 | static const int takePicSeq [5]; |
ashleymills | 0:4c0fca059a0a | 14 | static const int takePicSeqLen = 5; |
ashleymills | 0:4c0fca059a0a | 15 | static const int takePicSeqAck [5]; |
ashleymills | 0:4c0fca059a0a | 16 | static const int takePicSeqAckLen = 5; |
ashleymills | 0:4c0fca059a0a | 17 | static const int set160x120 [9]; |
ashleymills | 0:4c0fca059a0a | 18 | static const int set320x240 [9]; |
ashleymills | 0:4c0fca059a0a | 19 | static const int set640x480 [9]; |
ashleymills | 0:4c0fca059a0a | 20 | static const int setSizeLen = 9; |
ashleymills | 0:4c0fca059a0a | 21 | static const int setSizeAck [5]; |
ashleymills | 0:4c0fca059a0a | 22 | static const int setSizeAckLen = 5; |
ashleymills | 0:4c0fca059a0a | 23 | static const int readFileSize [5]; |
ashleymills | 0:4c0fca059a0a | 24 | static const int readFileSizeLen = 5; |
ashleymills | 0:4c0fca059a0a | 25 | static const int readFileSizeAck [7]; |
ashleymills | 0:4c0fca059a0a | 26 | static const int readFileSizeAckLen = 7; |
ashleymills | 0:4c0fca059a0a | 27 | static const int readFileHead [8]; |
ashleymills | 0:4c0fca059a0a | 28 | static const int readFileHeadLen = 8; |
ashleymills | 0:4c0fca059a0a | 29 | static const int readFileAck [5]; |
ashleymills | 0:4c0fca059a0a | 30 | static const int readFileAckLen = 5; |
ashleymills | 0:4c0fca059a0a | 31 | |
ashleymills | 0:4c0fca059a0a | 32 | public: |
ashleymills | 0:4c0fca059a0a | 33 | |
ashleymills | 0:4c0fca059a0a | 34 | enum Y201ImageSize { |
ashleymills | 0:4c0fca059a0a | 35 | e160x120, |
ashleymills | 0:4c0fca059a0a | 36 | e320x240, |
ashleymills | 0:4c0fca059a0a | 37 | e640x480 |
ashleymills | 0:4c0fca059a0a | 38 | }; |
ashleymills | 0:4c0fca059a0a | 39 | |
ashleymills | 0:4c0fca059a0a | 40 | Y201(PinName tx, PinName rx, const char *name = NULL); |
ashleymills | 0:4c0fca059a0a | 41 | |
ashleymills | 0:4c0fca059a0a | 42 | bool setImageSize(Y201ImageSize size); |
ashleymills | 0:4c0fca059a0a | 43 | bool takePicture(); |
ashleymills | 0:4c0fca059a0a | 44 | bool readImageSize(int *fileSize); |
ashleymills | 0:4c0fca059a0a | 45 | bool readImage(int startAddress, int readLen, uint8_t *readBuffer); |
ashleymills | 0:4c0fca059a0a | 46 | void trash(); |
ashleymills | 0:4c0fca059a0a | 47 | |
ashleymills | 0:4c0fca059a0a | 48 | bool waitForInt(int bytes, int *fileSize); |
ashleymills | 0:4c0fca059a0a | 49 | bool waitFor(const int *seq, const int seqLen); |
ashleymills | 0:4c0fca059a0a | 50 | void putSeq(const int *seq, int seqLen); |
ashleymills | 0:4c0fca059a0a | 51 | bool reset(); |
ashleymills | 0:4c0fca059a0a | 52 | |
ashleymills | 0:4c0fca059a0a | 53 | }; |