Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of dgps by
handle/handleCamera.cpp
- Committer:
- dylanembed123
- Date:
- 2014-04-01
- Revision:
- 7:c75d5e5e6bfc
- Child:
- 8:28b866df62cf
File content as of revision 7:c75d5e5e6bfc:
#include "takeImage.h" void ImageHandle::setup(){ //char* version = cam.getVersion(); uint8_t targetSize=VC0706_160x120;//VC0706_640x480;//VC0706_160x120; cam.setImageSize(targetSize); uint8_t realSize=cam.getImageSize(); } void ImageHandle::take(){ if (! cam.takePicture()) { USB::getSerial().printf("Failed to snap!\n"); while(1){} } int size=cam.frameLength(); USB::getSerial().printf("Image Start\n",size); int i; for(i=0;i<size;){ // read 32 bytes at a time; uint8_t bytesToRead = min(64, size-i); // change 32 to 64 for a speedup but may not work with all setups! uint8_t bytesRead=0; uint8_t* buffer = cam.readPicture(bytesToRead,&bytesRead); for(int a=0;a<bytesRead;a++){USB::getSerial().putc(buffer[a]);} i+=bytesRead; } USB::getSerial().printf("Image End\n",size); } bool ImageHandle::check(){ return true; } void ImageHandle::run(){ if(!initialized){ initialized=true; setup(); } if(check()){ take(); } }