boolean _blackfinGetPixel(CAMERA* cam,uint16_t x, uint16_t y, COLOR * color){ BLACKFIN_CAMERA* camera = (BLACKFIN_CAMERA*)cam; boolean rtn = FALSE; int32_t values[3]; // Make rprintf go to _blackfin_command Writer old = rprintfInit(&_blackfin_putcmd); _blackfin_index=0; // send 'vp' command rprintf("vp"); rprintfNum(10,4,FALSE,'0',x); rprintfNum(10,4,FALSE,'0',y); // process the command int args = __blackfinCommand(camera,PSTR("##vp "),null,values,3); if(args==3){ rtn = TRUE; colorSetYUV(color,(uint8_t)(values[0]), (uint8_t)(values[1]),(uint8_t)(values[2])); #ifdef BLACKFIN_DEBUG _blackfin_set_active(camera->debug); //Send rprintf to the debugger rprintf(" Color = "); colorDump(color); rprintfCRLF(); #endif } // Restore rprintf to original position rprintfInit(old); return rtn; }
/* vb Returns multiple lines one for each blob ix = vblob((unsigned char *)FRAME_BUF, (unsigned char*)FRAME_BUF3, ch1); printf("##vb%c %d\r\n", ch2, ix); for (iy=0; iy<ix; iy++) { printf(" %d - %d %d %d %d \r\n", blobcnt[iy], blobx1[iy], blobx2[iy], bloby1[iy],bloby2[iy]); } */ uint8_t blackfinDetectBlobs (BLACKFIN_CAMERA* camera, uint8_t bin){ int32_t values[5]; BLACKFIN_BLOB* dest; uint8_t actual = 0; // allocate space for blob storage if(camera->blob==null){ camera->blob = malloc(MAX_BLOBS * sizeof(BLACKFIN_BLOB)) ; } dest = camera->blob; // Make rprintf go to _blackfin_command Writer old = rprintfInit(&_blackfin_putcmd); _blackfin_index=0; rprintf("vb%d",bin);//start command, send bin # // process the command int args = __blackfinCommand(camera,PSTR("##vb"),PSTR(" vblob #"),values,2); #ifdef BLACKFIN_DEBUG _blackfin_set_active(camera->debug); //Send rprintf to the debugger #endif if(args==2 && values[0]==bin){ int8_t numBlobs = values[1]; // The number of blobs if(numBlobs > MAX_BLOBS){ numBlobs = MAX_BLOBS; } #ifdef BLACKFIN_DEBUG rprintf(" %d blobs\n",(int)numBlobs); #endif // Get each blob for(int8_t num = 0; num < numBlobs; num++){ args = __blackfin_get_args(camera, values, 5, TRUE); #ifdef BLACKFIN_DEBUG rprintf(" #%d=",(int)num); #endif if(args==5){ dest->pixels = values[0]; dest->left = values[1]; dest->right = values[2]; dest->top = values[3]; dest->bottom = values[4]; dest->xCenter = dest->left + ((dest->right - dest->left)>>1); dest->yCenter = dest->top + ((dest->bottom - dest->top)>>1); #ifdef BLACKFIN_DEBUG rprintf("Left,Top="); rprintfNum(10,4,FALSE,'0',dest->left); rprintfChar(','); rprintfNum(10,4,FALSE,'0',dest->top); rprintf(" Right,Bottom="); rprintfNum(10,4,FALSE,'0',dest->right); rprintfChar(','); rprintfNum(10,4,FALSE,'0',dest->bottom); rprintf(" Pixels=");rprintfNum(10,10,FALSE,' ',dest->pixels); rprintfCRLF(); #endif dest++; actual++; }else{