diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2017-11-06 07:50:23 -0800 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2017-11-06 07:50:23 -0800 |
commit | 728ac460d4fcf1f9747aa36ec9cc12c43a213596 (patch) | |
tree | 811bd94c97cd683d7a2376f14edcb57a62ff8c87 | |
parent | 79ba4c7d55a64e55514724514595af4c0e0cf924 (diff) |
Pass pointer to first element of buff
I think this is correct...
-rw-r--r-- | camera.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -48,7 +48,7 @@ int readResponse (Camera *cam, int nBytes, unsigned int timeout) { // read while below timeout and while the buffer // is still smaller than expected while(timeout >= counter && cam->bufferLen <= nBytes) { - ssize_t bytesRead = read(cam->fd, &(cam->buff) + cam->bufferLen, 1); // read one byte at a time + ssize_t bytesRead = read(cam->fd, &(cam->buff[0]) + cam->bufferLen, 1); // read one byte at a time cam->bufferLen++; // bytesRead will be 0 or -1 if no data was received if (bytesRead <= 0) { @@ -114,6 +114,7 @@ byte *readPicture (Camera *cam, byte n) { bool resumeVideo (Camera *cam) { return cameraFrameBuffCtrl(cam, VC0706_RESUMEFRAME); } + uint32_t frameLength (Camera *cam) { byte args[] = { 0x01, 0x00 }; if (!runCommand(cam, VC0706_GET_FBUF_LEN, args, 9)) @@ -137,7 +138,7 @@ char *getVersion (Camera *cam) { if (!readResponse(cam, BUFF_SIZE, 200)) return 0; cam->buff[cam->bufferLen] = 0; - return (char*)&(cam->buff); + return (char*)&(cam->buff[0]); } byte available (Camera *cam) { |