txBufferEmpty() is supposed to return true if there is nothing being held in the buffer from the camera right?
So my logic was that if there is something in the camera -> mbed buffer, txBufferEmpty() would return false and but while loop needs a true statement to keep running so just invert the response.
Earlier on you agreed with me that getc() "drains" the buffer so by storing the first 6 byes in the bytes_rcvd array the txBuffer of the camera would be minus 6 bytes down to 6 remaining bytes which would get printed to my console.
Then since there were still bytes remaining and the while loop was still running it would go back to the top draining the remaining 6 bytes, giving me the second expected response and then jumping out of the while loop because the txBuffer would now be empty and !txBufferEmpty() would return false.
What I'm attempting has already been done here >>http://mbed.org/users/jarkman/programs/ucam/gpdz4b. I'm fairly new to programming and even newer to C/C++ so I can only wrap my head around so much of what his code is doing.
As an exercise I've attempted to reinvent this wheel using baby steps at a time while using his code as reference sometimes. I send the 6 sync bytes I should be getting 12 response bytes back, which I am. I intentionally made the bytes_rcv array just hold 6 elements at a time. My problem lies in the fact that after first 3 receives(or 2nd depending on how you look at it) the response gets offset and I have no idea why. Please advise.