Library for LinkSprite Y201 JPEG serial camera.
Y201.h@10:fd12c96da974, 2012-07-20 (annotated)
- Committer:
- ashleymills
- Date:
- Fri Jul 20 08:59:03 2012 +0000
- Revision:
- 10:fd12c96da974
- Parent:
- 3:decf96d8e6b0
Added change baud rate, then removed it, as this apparently reprograms the camera ROM !! Nice product linksprite
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashleymills | 0:4c0fca059a0a | 1 | #include "mbed.h" |
ashleymills | 10:fd12c96da974 | 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 | 10:fd12c96da974 | 12 | static const char resetSeq [4]; |
ashleymills | 10:fd12c96da974 | 13 | static const int resetSeqLen = 4; |
ashleymills | 10:fd12c96da974 | 14 | static const char resetSeqAck [4]; |
ashleymills | 10:fd12c96da974 | 15 | static const int resetSeqAckLen = 4; |
ashleymills | 10:fd12c96da974 | 16 | static const char takePicSeq [5]; |
ashleymills | 10:fd12c96da974 | 17 | static const int takePicSeqLen = 5; |
ashleymills | 10:fd12c96da974 | 18 | static const char takePicSeqAck [5]; |
ashleymills | 10:fd12c96da974 | 19 | static const int takePicSeqAckLen = 5; |
ashleymills | 10:fd12c96da974 | 20 | static const char set160x120 [9]; |
ashleymills | 10:fd12c96da974 | 21 | static const char set320x240 [9]; |
ashleymills | 10:fd12c96da974 | 22 | static const char set640x480 [9]; |
ashleymills | 10:fd12c96da974 | 23 | static const int setSizeLen = 9; |
ashleymills | 10:fd12c96da974 | 24 | static const char setSizeAck [5]; |
ashleymills | 10:fd12c96da974 | 25 | static const int setSizeAckLen = 5; |
ashleymills | 10:fd12c96da974 | 26 | static const char readFileSize [5]; |
ashleymills | 10:fd12c96da974 | 27 | static const int readFileSizeLen = 5; |
ashleymills | 10:fd12c96da974 | 28 | static const char readFileSizeAck [7]; |
ashleymills | 10:fd12c96da974 | 29 | static const int readFileSizeAckLen = 7; |
ashleymills | 10:fd12c96da974 | 30 | static const char readFileHead [8]; |
ashleymills | 10:fd12c96da974 | 31 | static const int readFileHeadLen = 8; |
ashleymills | 10:fd12c96da974 | 32 | static const char readFileAck [5]; |
ashleymills | 10:fd12c96da974 | 33 | static const int readFileAckLen = 5; |
ashleymills | 10:fd12c96da974 | 34 | /* |
ashleymills | 10:fd12c96da974 | 35 | static const char changeBaudRateSeq [5]; |
ashleymills | 10:fd12c96da974 | 36 | static const int changeBaudRateSeqLen = 5; |
ashleymills | 10:fd12c96da974 | 37 | static const char changeBaudRateAck [5]; |
ashleymills | 10:fd12c96da974 | 38 | static const int changeBaudRateAckLen = 5; |
ashleymills | 10:fd12c96da974 | 39 | */ |
ashleymills | 10:fd12c96da974 | 40 | static const char enterPowerSavingSeq[7]; |
ashleymills | 10:fd12c96da974 | 41 | static const int enterPowerSavingLen = 7; |
ashleymills | 10:fd12c96da974 | 42 | static const char enterPowerSavingAck[5]; |
ashleymills | 10:fd12c96da974 | 43 | static const int enterPowerSavingAckLen = 5; |
ashleymills | 10:fd12c96da974 | 44 | static const char exitPowerSavingSeq [7]; |
ashleymills | 10:fd12c96da974 | 45 | static const int exitPowerSavingLen = 7; |
ashleymills | 10:fd12c96da974 | 46 | static const char exitPowerSavingAck[5]; |
ashleymills | 10:fd12c96da974 | 47 | static const int exitPowerSavingAckLen = 5; |
ashleymills | 0:4c0fca059a0a | 48 | |
ashleymills | 0:4c0fca059a0a | 49 | public: |
ashleymills | 0:4c0fca059a0a | 50 | |
ashleymills | 0:4c0fca059a0a | 51 | enum Y201ImageSize { |
ashleymills | 10:fd12c96da974 | 52 | e160x120, |
ashleymills | 10:fd12c96da974 | 53 | e320x240, |
ashleymills | 10:fd12c96da974 | 54 | e640x480 |
ashleymills | 0:4c0fca059a0a | 55 | }; |
ashleymills | 10:fd12c96da974 | 56 | |
ashleymills | 10:fd12c96da974 | 57 | /* |
ashleymills | 10:fd12c96da974 | 58 | enum Y201BaudRate { |
ashleymills | 10:fd12c96da974 | 59 | e9600, |
ashleymills | 10:fd12c96da974 | 60 | e19200, |
ashleymills | 10:fd12c96da974 | 61 | e38400, |
ashleymills | 10:fd12c96da974 | 62 | e57600, |
ashleymills | 10:fd12c96da974 | 63 | e115200 |
ashleymills | 10:fd12c96da974 | 64 | }; |
ashleymills | 10:fd12c96da974 | 65 | */ |
ashleymills | 0:4c0fca059a0a | 66 | |
ashleymills | 1:30a6aeda21c2 | 67 | Y201(PinName tx, PinName rx, const char *name = NULL); |
ashleymills | 0:4c0fca059a0a | 68 | |
ashleymills | 1:30a6aeda21c2 | 69 | bool setImageSize(Y201ImageSize size); |
ashleymills | 0:4c0fca059a0a | 70 | bool takePicture(); |
ashleymills | 0:4c0fca059a0a | 71 | bool readImageSize(int *fileSize); |
ashleymills | 0:4c0fca059a0a | 72 | bool readImage(int startAddress, int readLen, uint8_t *readBuffer); |
ashleymills | 10:fd12c96da974 | 73 | //bool changeBaudRate(Y201BaudRate baudRate); |
ashleymills | 10:fd12c96da974 | 74 | bool enterPowerSaving(); |
ashleymills | 10:fd12c96da974 | 75 | bool exitPowerSaving(); |
ashleymills | 0:4c0fca059a0a | 76 | void trash(); |
ashleymills | 0:4c0fca059a0a | 77 | |
ashleymills | 1:30a6aeda21c2 | 78 | bool waitForInt(int bytes, int *fileSize); |
ashleymills | 10:fd12c96da974 | 79 | bool waitFor(const char *seq, const int seqLen); |
ashleymills | 10:fd12c96da974 | 80 | void putSeq(const char *seq, int seqLen); |
ashleymills | 1:30a6aeda21c2 | 81 | bool reset(); |
ashleymills | 0:4c0fca059a0a | 82 | |
ashleymills | 0:4c0fca059a0a | 83 | }; |