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