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.
Dependents: mbed_uCAM_TTL120_20141118
uCAM_TTL120.cpp
00001 // Library for uCAM-TTL120 from Saelig 00002 00003 #include "uCAM_TTL120.h" 00004 #define __DEBUG 00005 00006 //----------------- uCAM Functions ------------------------------ 00007 00008 uCAM_TTL120::uCAM_TTL120(PinName tx, PinName rx) : _cam(tx, rx) { 00009 _cam.baud(115200); //Initial baud rate 00010 timerCam = new Timer(); 00011 00012 timerCam->start(); 00013 } 00014 00015 int uCAM_TTL120::uCAM_read(char *str, int numchars, float timeout){ 00016 Timer t_Frame; 00017 int i=0; 00018 int timeoutState=0; 00019 t_Frame.start(); 00020 00021 while(timeoutState != 3 && (i < numchars)){ 00022 switch(timeoutState){ 00023 case 0: 00024 while(_cam.readable()){ //if characters are in buffer, read them 00025 str[i++] = _cam.getc(); 00026 if(i == numchars){ 00027 timeoutState = 3; 00028 break; 00029 } 00030 } 00031 //if no characters in buffer, initiate timeout 00032 timeoutState = 1; 00033 break; 00034 case 1: 00035 timeout = t_Frame.read() + timeout; //current time plus timeout time 00036 timeoutState = 2; 00037 // pc.printf("Timeout initiated %f\r\n", timeout); 00038 break; 00039 case 2: 00040 if(_cam.readable()){ //check buffer while timeout is running 00041 str[i++] = _cam.getc(); 00042 if(i == numchars){ 00043 timeoutState = 3; 00044 } 00045 else{ 00046 timeoutState = 0; 00047 } 00048 break; 00049 } 00050 if(t_Frame.read() >= timeout) //if timeout has elapsed, exit the while loop with state 3 00051 timeoutState = 3; 00052 break; 00053 default: 00054 timeoutState = 0; 00055 }//switch timeoutState 00056 }//while timeoutState != 2 00057 return i; //return number of bytes read 00058 } 00059 00060 void uCAM_TTL120::uCAM_Command_Send(int command,char p1,char p2,char p3,char p4) 00061 { 00062 _cam.putc((char)(command >> 8) & 0xff); 00063 _cam.putc((char)(command & 0xff)); 00064 _cam.putc(p1); 00065 _cam.putc(p2); 00066 _cam.putc(p3); 00067 _cam.putc(p4); 00068 } 00069 00070 int uCAM_TTL120::uCAM_GetACK(int command) 00071 { 00072 char ser_read[7]; 00073 int i; 00074 00075 for(i=0;i<7;i++) //clear the string 00076 ser_read[i] = 0; 00077 00078 wait(.1); 00079 00080 //read serial buffer and wait for ACK (0xAA0E0DXX0000) 00081 uCAM_read(ser_read, 6, .5); 00082 if((ser_read[0] == 0xAA) && 00083 (ser_read[1] == 0x0E)){ 00084 if((command & 0xff) == ser_read[2]) 00085 return 1; 00086 } 00087 else 00088 return 0; 00089 } 00090 00091 int uCAM_TTL120::uCAM_Connect(void) 00092 { 00093 char ser_read[20]; 00094 int i, retries; 00095 00096 for(i=0;i<20;i++) //clear the string 00097 ser_read[i] = 0; 00098 retries=0; 00099 00100 while(retries < 60) 00101 { 00102 uCAM_FlushBuffer(); 00103 00104 //Transmit SYNC command 00105 uCAM_Command_Send(uCAM_SYNC,0x00,0x00,0x00,0x00); 00106 00107 wait(.2); 00108 00109 //read serial buffer and wait for ACK (0xAA0E0DXX0000) 00110 uCAM_read(ser_read, 6, .1); 00111 00112 if((ser_read[0] == 0xAA) && 00113 (ser_read[1] == 0x0E) && 00114 (ser_read[2] == 0x0D) && //skip ser_read[3] 00115 (ser_read[4] == 0x00)) 00116 { 00117 //after receiving ACK, wait for SYNC (0xAA0D00000000) 00118 uCAM_read(ser_read, 6, .100); 00119 00120 if((ser_read[0] == 0xAA) && 00121 (ser_read[1] == 0x0D) && 00122 (ser_read[2] == 0x00) && 00123 (ser_read[3] == 0x00) && 00124 (ser_read[4] == 0x00) && 00125 (ser_read[5] == 0x00)) 00126 { 00127 //Transmit ACK command 00128 uCAM_Command_Send(uCAM_ACK,0x0D,0x00,0x00,0x00); 00129 00130 printf("\r\n uCAM 120 Initialized\r\nDelaying 2 seconds for AGC and AEC \r\n circuits to stabilise before image capture."); 00131 wait(.5); //2 second delay before capturing first image 00132 printf("."); 00133 wait(.5); 00134 printf("."); 00135 wait(.5); 00136 printf("."); 00137 wait(.5); 00138 printf(".\r\nFinished\r\n"); 00139 00140 return 1; //Camera connection successful 00141 } 00142 } 00143 retries++; 00144 } 00145 if(retries == 60) 00146 return 0; 00147 00148 return -1; 00149 } 00150 00151 int uCAM_TTL120::uCAM_send_INITIAL_80x60_16RAW(void) 00152 { 00153 char ser_read[7]; 00154 int i; 00155 00156 uCAM_Command_Send(uCAM_INITIAL,0x00,0x06,0x01,0x00); // p2=0x06-16 bit color(RAW,565(RGB)) 00157 // p3=0x01-80 x 60 bit resolution 00158 // p4=0x00-raw 00159 00160 for(i=0;i<7;i++) //clear the string 00161 ser_read[i] = 0; 00162 00163 //read serial C buffer and wait for ACK (0xAA0E0DXX0000) 00164 uCAM_read(ser_read, 6, .02); //.01 00165 00166 if((ser_read[0] == 0xAA) && 00167 (ser_read[1] == 0x0E) && 00168 (ser_read[2] == 0x01)){ 00169 return 1; 00170 } 00171 else 00172 return 0; 00173 } 00174 00175 int uCAM_TTL120::uCAM_send_INITIAL_80x60_2RAW(void) 00176 { 00177 char ser_read[7]; 00178 int i; 00179 uCAM_Command_Send(uCAM_INITIAL,0x00,0x01,0x01,0x00); // p2=0x01-2 bit GRAY (RAW) 00180 // p3=0x01-80 x 60 bit resolution 00181 // p4=0x01-JPEG res 80 x 64 00182 wait(.02); 00183 00184 for(i=0;i<7;i++) //clear the string 00185 ser_read[i] = 0; 00186 00187 //read serial C buffer and wait for ACK (0xAA0E0DXX0000) 00188 uCAM_read(ser_read, 6, .1); 00189 00190 if((ser_read[0] == 0xAA) && 00191 (ser_read[1] == 0x0E) && 00192 (ser_read[2] == 0x01)) 00193 { 00194 wait(.010); 00195 return 1; 00196 } 00197 else 00198 return 0; 00199 } 00200 00201 int uCAM_TTL120::uCAM_send_INITIAL_128x128_4RAW(void) 00202 { 00203 char ser_read[7]; 00204 int i; 00205 uCAM_Command_Send(uCAM_INITIAL,0x00,0x02,0x09,0x00); // p2=0x02-4 bit GRAY (RAW) 00206 // p3=0x09- 128x128 bit resolution 00207 // p4=0x01-JPEG res 80 x 64 00208 wait(.02); 00209 00210 for(i=0;i<7;i++) //clear the string 00211 ser_read[i] = 0; 00212 00213 //read serial buffer and wait for ACK (0xAA0E0DXX0000) 00214 uCAM_read(ser_read, 6, .100); 00215 00216 if((ser_read[0] == 0xAA) && 00217 (ser_read[1] == 0x0E) && 00218 (ser_read[2] == 0x01)) 00219 { 00220 wait(.02); 00221 return 1; 00222 } 00223 else 00224 return 0; 00225 } 00226 int uCAM_TTL120::uCAM_send_SNAPSHOT(void) 00227 { 00228 uCAM_Command_Send(uCAM_SNAPSHOT,0x01,0x00,0x00,0x00); // p1=0x01-Uncompressed Image 00229 // p2 and p3 = 0, current frame 00230 wait(.01); 00231 00232 if(uCAM_GetACK(uCAM_SNAPSHOT)) 00233 return 1; 00234 else 00235 return 0; 00236 } 00237 00238 int uCAM_TTL120::uCAM_send_GET_PICTURE_80x60_16COL_RAW(FILE *fp) 00239 { 00240 char ser_read[7]; 00241 unsigned long pic_bytes; 00242 unsigned int i, j, k; 00243 unsigned int serbytes_read; 00244 unsigned int pixel_col; 00245 00246 pic_bytes = 0; 00247 serbytes_read = 0; 00248 00249 for(i=0;i<100;i++) 00250 picture[i] = 0; 00251 00252 while(_cam.readable()){ //flush the buffer 00253 char c = _cam.getc(); 00254 } 00255 00256 uCAM_Command_Send(uCAM_GET_PICTURE,0x01,0x00,0x00,0x00); // p1=0x01-Snapshot picture 00257 wait(.3); 00258 00259 if(uCAM_GetACK(uCAM_GET_PICTURE)) //returned get pic 00260 { 00261 //read serial C buffer and wait for ACK (0xAA0E0DXX0000) 00262 char c=uCAM_read(ser_read, 6, .1); 00263 00264 if((ser_read[0] == 0xAA) && //first 2 bytes indicate it was a DATA packet 00265 (ser_read[1] == 0x0A)) 00266 { 00267 pic_bytes = (unsigned long)ser_read[3]; 00268 pic_bytes += (unsigned long)ser_read[4] << 8; 00269 pic_bytes += (unsigned long)ser_read[5] << 16; 00270 00271 serbytes_read = uCAM_read(picture, pic_bytes, .200); 00272 00273 if(serbytes_read == pic_bytes) 00274 { 00275 k=0; 00276 for(i=0;i<60;i++) 00277 { 00278 for(j=0;j<80;j++) 00279 { 00280 pixel_col = picture[k]; 00281 k++; 00282 fputc(((picture[k] >> 8) & 0xff), fp); //write pixel high byte to file 00283 fputc(picture[k] & 0xff, fp); //write low byte 00284 // printf("%d ", pixel_col); 00285 // TFT.pixel(j, i, pixel_col); //Do something with the pixel 00286 } 00287 } 00288 00289 uCAM_Command_Send(uCAM_ACK, 0x0A, 0x00, 0x01, 0x00); 00290 00291 return pic_bytes; 00292 } 00293 else 00294 return -4; 00295 } 00296 } 00297 else 00298 return -1; 00299 } 00300 00301 int uCAM_TTL120::uCAM_send_GET_PICTURE_80x60_2GRAY_RAW(void) 00302 { 00303 char ser_read[7]; 00304 char c; 00305 unsigned long pic_bytes; 00306 unsigned int pixel_col; 00307 unsigned int i, j, k; 00308 int m; 00309 unsigned int serbytes_read; 00310 int temp; 00311 00312 pic_bytes = 0; 00313 c=0; 00314 serbytes_read = 0; 00315 00316 for(i=0;i<100;i++) 00317 picture[i] = 0; 00318 00319 while(_cam.readable()){ //flush the buffer 00320 char c = _cam.getc(); 00321 } 00322 00323 uCAM_Command_Send(uCAM_GET_PICTURE,0x01,0x00,0x00,0x00); // p1=0x01-Snapshot picture 00324 wait(.3); 00325 00326 //read serial C buffer and wait for ACK (0xAA0E0DXX0000) 00327 c=uCAM_read(ser_read, 6, 1); 00328 wait(.2); 00329 00330 if(c==6) //received 6 bytes back 00331 { 00332 if((ser_read[0] == 0xAA) && //first 2 bytes indicate it was a DATA packet 00333 (ser_read[1] == 0x0E) && 00334 (ser_read[2] == 0x04)) //returned get pic 00335 { 00336 //read serial C buffer and wait for ACK (0xAA0E0DXX0000) 00337 c=uCAM_read(ser_read, 6, 1); 00338 00339 if(c==6) //received 6 bytes back 00340 { 00341 if((ser_read[0] == 0xAA) && //first 2 bytes indicate it was a DATA packet 00342 (ser_read[1] == 0x0A)) 00343 { 00344 pic_bytes = (unsigned long)ser_read[3]; 00345 pic_bytes += (unsigned long)ser_read[4] << 8; 00346 pic_bytes += (unsigned long)ser_read[5] << 16; 00347 00348 serbytes_read = uCAM_read(picture, pic_bytes, 200); 00349 00350 if(serbytes_read == pic_bytes) 00351 { 00352 k=0; 00353 for(i=0;i<60;i++) 00354 { 00355 for(j=0;j<80;) 00356 { 00357 temp = picture[k]; 00358 for(m=14;m>=0;m-=2) 00359 { 00360 pixel_col = (temp >> m) & 0x03; 00361 switch(pixel_col) 00362 { 00363 case 0: 00364 // uLCD144_Put_Pixel(j, i, 0x0000); //0x0000 00365 break; 00366 case 1: 00367 // uLCD144_Put_Pixel(j, i, 0x0180); //0x39e7 00368 break; 00369 case 2: 00370 // uLCD144_Put_Pixel(j, i, 0xc209); //0x7bef 00371 break; 00372 case 3: 00373 // uLCD144_Put_Pixel(j, i, 0xFFFF); //0xFFFF 00374 break; 00375 default: 00376 // uLCD144_Put_Pixel(j, i, 0x0000); 00377 break; 00378 } 00379 j++; 00380 } 00381 k++; 00382 } 00383 } 00384 00385 uCAM_Command_Send(uCAM_ACK, 0x0A, 0x00, 0x01, 0x00); 00386 00387 return pic_bytes; 00388 } 00389 else 00390 return -4; 00391 } 00392 else 00393 return -3; 00394 } 00395 } 00396 else 00397 return -2; 00398 } 00399 return -1; 00400 } 00401 00402 int uCAM_TTL120::uCAM_send_GET_PICTURE_128x128_4GRAY_RAW(void) 00403 { 00404 char ser_read[7]; 00405 char c; 00406 unsigned long pic_bytes; 00407 unsigned int pixel_col; 00408 unsigned int i, j, k; 00409 unsigned int serbytes_read; 00410 int temp; 00411 00412 pic_bytes = 0; 00413 c=0; 00414 serbytes_read = 0; 00415 00416 for(i=0;i<100;i++) 00417 picture[i] = 0; 00418 00419 while(_cam.readable()){ //flush the buffer 00420 char c = _cam.getc(); 00421 } 00422 00423 uCAM_Command_Send(uCAM_GET_PICTURE,0x01,0x00,0x00,0x00); // p1=0x01-Snapshot picture 00424 wait(.3); 00425 00426 //read serial C buffer and wait for ACK (0xAA0E0DXX0000) 00427 c=uCAM_read(ser_read, 6, .1); 00428 wait(.2); 00429 00430 if(c==6) //received 6 bytes back 00431 { 00432 if((ser_read[0] == 0xAA) && //first 2 bytes indicate it was a DATA packet 00433 (ser_read[1] == 0x0E) && 00434 (ser_read[2] == 0x04)) //returned get pic 00435 { 00436 //read serial C buffer and wait for ACK (0xAA0E0DXX0000) 00437 c=uCAM_read(ser_read, 6, .1); 00438 00439 if(c==6) //received 6 bytes back 00440 { 00441 if((ser_read[0] == 0xAA) && //first 2 bytes indicate it was a DATA packet 00442 (ser_read[1] == 0x0A)) 00443 { 00444 pic_bytes = (unsigned long)ser_read[3]; 00445 pic_bytes += (unsigned long)ser_read[4] << 8; 00446 pic_bytes += (unsigned long)ser_read[5] << 16; 00447 00448 serbytes_read = uCAM_read(picture, pic_bytes, .2); 00449 00450 if(serbytes_read == pic_bytes) 00451 { 00452 k=0; 00453 for(i=0;i<128;i++) 00454 { 00455 for(j=0;j<128;) 00456 { 00457 temp = picture[k]; 00458 pixel_col = (temp >> 12) & 0x000F; 00459 pixel_col |= ((temp >> 12) & 0x000F) << 6; 00460 pixel_col |= ((temp >> 12) & 0x000F) << 11; 00461 // uLCD144_Put_Pixel(j, i, pixel_col); 00462 printf("%c", pixel_col); 00463 j++; 00464 00465 pixel_col = (temp >> 8) & 0x000F; 00466 pixel_col |= ((temp >> 8) & 0x000F) << 6; 00467 pixel_col |= ((temp >> 8) & 0x000F) << 11; 00468 // uLCD144_Put_Pixel(j, i, pixel_col); 00469 printf("%c", pixel_col); 00470 j++; 00471 00472 pixel_col = (temp >> 4) & 0x000F; 00473 pixel_col |= ((temp >> 4) & 0x000F) << 6; 00474 pixel_col |= ((temp >> 4) & 0x000F) << 11; 00475 // uLCD144_Put_Pixel(j, i, pixel_col); 00476 printf("%c", pixel_col); 00477 j++; 00478 00479 pixel_col = temp & 0x000F; 00480 pixel_col |= (temp & 0x000F) << 6; 00481 pixel_col |= (temp & 0x000F) << 11; 00482 // uLCD144_Put_Pixel(j, i, pixel_col); 00483 printf("%c", pixel_col); 00484 j++; 00485 00486 k++; 00487 } 00488 } 00489 00490 uCAM_Command_Send(uCAM_ACK, 0x0A, 0x00, 0x01, 0x00); 00491 00492 return pic_bytes; 00493 } 00494 else 00495 return -4; 00496 } 00497 else 00498 return -3; 00499 } 00500 } 00501 else 00502 return -2; 00503 } 00504 return -1; 00505 } 00506 00507 void uCAM_TTL120::uCAM_set_baud(void) 00508 { 00509 uCAM_Command_Send(uCAM_SET_BAUD_RATE,0x03,0x00,0x00,0x00); // set baud to 00510 wait(.05); 00511 00512 if(uCAM_GetACK(uCAM_SET_BAUD_RATE)){ 00513 printf("Baud rate sucessfully changed"); 00514 } 00515 else{ 00516 printf("Baud rate NOT sucessfully changed"); 00517 } 00518 00519 _cam.baud(921600); 00520 // uCAM_Command_Send(uCAM_SET_BAUD_RATE,0x02,0x00,0x00,0x00); // set baud to 00521 // _cam.baud(1228800); 00522 } 00523 00524 void uCAM_TTL120::uCAM_TakePic_RAW_16COLOR_80x60(FILE *fp) 00525 { 00526 uCAM_send_INITIAL_80x60_16RAW(); 00527 wait(.1); 00528 uCAM_send_SNAPSHOT(); 00529 wait(.1); 00530 uCAM_send_GET_PICTURE_80x60_16COL_RAW(fp); 00531 } 00532 00533 void uCAM_TTL120::uCAM_TakePic_RAW_2GRAY_80x60(void) 00534 { 00535 uCAM_send_INITIAL_80x60_2RAW(); 00536 wait(.1); 00537 uCAM_send_SNAPSHOT(); 00538 wait(.1); 00539 00540 while(uCAM_send_GET_PICTURE_80x60_2GRAY_RAW() < 0){ 00541 wait(.1); 00542 uCAM_send_SNAPSHOT(); 00543 wait(.2); 00544 } 00545 } 00546 00547 void uCAM_TTL120::uCAM_TakePic_RAW_4GRAY_128x128(void) 00548 { 00549 uCAM_send_INITIAL_128x128_4RAW(); 00550 wait(.100); 00551 uCAM_send_SNAPSHOT(); 00552 wait(.100); 00553 while(uCAM_send_GET_PICTURE_128x128_4GRAY_RAW() < 0){ 00554 wait(.100); 00555 uCAM_send_SNAPSHOT(); 00556 wait(.200); 00557 } 00558 } 00559 00560 void uCAM_TTL120::uCAM_FlushBuffer(void){ 00561 while(_cam.readable()){ //flush the buffer 00562 char c = _cam.getc(); 00563 } 00564 } 00565 00566 int uCAM_TTL120::uCAM_get_jpeg(FILE *fp){ 00567 00568 char ser_read[7]; 00569 unsigned long pic_bytes; 00570 00571 uCAM_FlushBuffer(); 00572 uCAM_Command_Send(uCAM_INITIAL,0x00,0x07,0x07,0x07); // JPEG,640 x 480,JPEG 00573 //cam.uCAM_Command_Send(uCAM_INITIAL,0x00,0x07,0x07,0x03); // JPEG,160 x 120,JPEG 00574 wait(.05); 00575 00576 if(uCAM_GetACK(uCAM_INITIAL)){ //INITIAL ACK 00577 printf("ACK received on uCAM_INITIAL\r\n"); 00578 } 00579 else{ 00580 printf("Did not receive ACK on uCAM_INITIAL\r\n"); 00581 } 00582 00583 uCAM_FlushBuffer(); 00584 uCAM_Command_Send(uCAM_SET_PACKAGE_SIZE,0x08,0x00,0x02,0x00); //512 bytes 00585 00586 wait(.05); 00587 00588 if(uCAM_GetACK(uCAM_SET_PACKAGE_SIZE)){ //SET PACKAGE SIZE ACK 00589 printf("ACK received on uCAM_SET_PACKAGE_SIZE\r\n"); 00590 } 00591 else{ 00592 printf("Did not receive ACK on SET PACKAGE SIZE\r\n"); 00593 } 00594 00595 uCAM_FlushBuffer(); 00596 uCAM_Command_Send(uCAM_SNAPSHOT,0x00,0x00,0x00,0x00); //JPEG 00597 00598 if(uCAM_GetACK(uCAM_SNAPSHOT)){ //uCAM_SNAPSHOT ACK 00599 printf("ACK received on uCAM_SNAPSHOT\r\n"); 00600 } 00601 else{ 00602 printf("Did not receive ACK on uCAM_SNAPSHOT\r\n"); 00603 } 00604 00605 pic_bytes = 0; 00606 00607 uCAM_FlushBuffer(); 00608 uCAM_Command_Send(uCAM_GET_PICTURE,0x01,0x00,0x00,0x00); // p1=0x01-Snapshot picture 00609 wait(.1); 00610 00611 if(uCAM_GetACK(uCAM_GET_PICTURE)) //returned get pic 00612 { 00613 //read serial buffer and wait for ACK (0xAA0E0DXX0000) 00614 uCAM_read(ser_read, 6, 1); 00615 00616 if((ser_read[0] == 0xAA) && //first 2 bytes indicate it was a DATA packet 00617 (ser_read[1] == 0x0A) && 00618 (ser_read[2] == 0x01)) //DATA from snapshot ACK 00619 { 00620 pic_bytes = (unsigned long)ser_read[3]; 00621 pic_bytes += (unsigned long)ser_read[4] << 8; 00622 pic_bytes += (unsigned long)ser_read[5] << 16; 00623 00624 int packID=0; 00625 char packID_l, packID_h; 00626 00627 // pc.printf("\r\n"); 00628 int numPackages = pic_bytes / (512 - 6); 00629 00630 while(numPackages>=0){ 00631 packID_h = (packID >> 8) & 0xff; 00632 packID_l = packID & 0xff; 00633 00634 uCAM_FlushBuffer(); 00635 uCAM_Command_Send(uCAM_ACK, 0x00, 0x00, packID_l, packID_h); 00636 00637 char ID_ret[2]; 00638 uCAM_read(ID_ret, 2, .2); 00639 00640 char dataSize[2]; 00641 uCAM_read(dataSize, 2, .2); 00642 00643 char imageData[506]; //512 - 6 00644 int imageDataSize = ((dataSize[1] & 0xff) << 8) + (dataSize[0] & 0xff); 00645 00646 //uCAM_read(imageData, imageDataSize, .2); 00647 for(int i=0;i<imageDataSize;i++) 00648 imageData[i] = _cam.getc(); 00649 00650 char verifyCode[2]; 00651 uCAM_read(verifyCode, 2, .2); 00652 00653 int vCodeCheck=0; 00654 vCodeCheck += ID_ret[0]; 00655 vCodeCheck += ID_ret[1]; 00656 vCodeCheck += dataSize[0]; 00657 vCodeCheck += dataSize[1]; 00658 00659 for(int i=0;i<imageDataSize;i++) 00660 vCodeCheck += imageData[i]; 00661 00662 if((verifyCode[0] & 0xff) == (vCodeCheck & 0xff)){ 00663 //pc.printf("\r\nPack ID = %d\r\n", packID);//debugging 00664 for(int j=0;j<imageDataSize;j++){ //write image data to file pointer 00665 fputc(imageData[j], fp); 00666 //pc.printf("%2X ", imageData[j]); 00667 } 00668 packID++; 00669 numPackages--; 00670 } 00671 else{ 00672 printf("\r\nBad Data in transfer. ReTransfer\r\n"); 00673 return -2; 00674 } 00675 } 00676 uCAM_Command_Send(uCAM_ACK, 0x00, 0x00, 0xf0, 0xf0); 00677 return 0; //return 0 on success 00678 } 00679 }//data packet 00680 return -1; 00681 } //function
Generated on Sat Jul 16 2022 01:57:29 by
1.7.2