CANSAT_CAMERA
Dependents: CANSAT_COMBINED CANSAT_CAMERA_servo CANSAT_CAMERA2
Fork of Camera_LS_Y201 by
Revision 6:2e14476d7164, committed 2015-09-09
- Comitter:
- Hagrass
- Date:
- Wed Sep 09 16:42:16 2015 +0000
- Parent:
- 2:b3da8bab6e99
- Commit message:
- cansat;
Changed in this revision
Camera_LS_Y201.cpp | Show annotated file Show diff for this revision Revisions of this file |
Camera_LS_Y201.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r b3da8bab6e99 -r 2e14476d7164 Camera_LS_Y201.cpp --- a/Camera_LS_Y201.cpp Mon Aug 10 16:34:15 2015 +0000 +++ b/Camera_LS_Y201.cpp Wed Sep 09 16:42:16 2015 +0000 @@ -37,6 +37,27 @@ Camera_LS_Y201::Camera_LS_Y201(PinName tx, PinName rx) : serial(tx, rx) { serial.baud(38400); } +Camera_LS_Y201::ErrorCode Camera_LS_Y201::baud() +{ + +uint8_t send[7] = { + 0x56, + 0x00, + 0x24, + 0x03, + 0x01, + 0x0D, + 0xA6 +// 56 00 24 03 01 XX XX + }; +uint8_t recv[5]; +waitIdle(); +sendBytes(send, sizeof(send), 200 * 1000) ; + + +recvBytes(recv, sizeof(recv), 200 * 1000) ; + serial.baud(115200); + } /** * Dispose. @@ -282,6 +303,7 @@ if (!recvBytes(body, sizeof(body), 2 * 1000 * 1000)) { return RecvError; } + //printf("saved"); siz_done += sizeof(body); if (func != NULL) { if (siz_done > siz_total) {
diff -r b3da8bab6e99 -r 2e14476d7164 Camera_LS_Y201.h --- a/Camera_LS_Y201.h Mon Aug 10 16:34:15 2015 +0000 +++ b/Camera_LS_Y201.h Wed Sep 09 16:42:16 2015 +0000 @@ -78,7 +78,7 @@ * @return Error code. */ ErrorCode reset(); - +ErrorCode baud(); /** * Set image size. * @@ -116,6 +116,17 @@ * @return Error code. */ ErrorCode stopTakingPictures(); + bool sendBytes(uint8_t *buf, size_t len, int timeout_us); + + /** + * Receive bytes from camera module. + * + * @param buf Pointer to the data buffer. + * @param len Length of the data buffer. + * + * @return True if the data received. + */ + bool recvBytes(uint8_t *buf, size_t len, int timeout_us); private: SerialBuffered serial; @@ -135,18 +146,7 @@ * * @return True if the data sended. */ - bool sendBytes(uint8_t *buf, size_t len, int timeout_us); - - /** - * Receive bytes from camera module. - * - * @param buf Pointer to the data buffer. - * @param len Length of the data buffer. - * - * @return True if the data received. - */ - bool recvBytes(uint8_t *buf, size_t len, int timeout_us); - + /** * Wait received. *