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.
handle/handleCamera.cpp
- Committer:
- dylanembed123
- Date:
- 2014-04-03
- Revision:
- 6:f0248eb6714d
- Parent:
- 5:eef5ea6a9916
File content as of revision 6:f0248eb6714d:
#include "handleCamera.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 = std::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(); } }