int main(int argc, char *argv[]) { clock_init(); led_init(); uart_init(); //interrupt_init(); led_display(64); fprintf(stream_board, "Welcome to camera test.\n\n"); camera_reset(); fprintf(stream_board, "Camera has reset.\n\n"); //camera_set_baudrate(9600); //uart_set_baudrate(stream_cam, 9600); camera_snap(); fprintf(stream_board, "Camera has snapped.\n\n"); uint16_t filesize = camera_get_filesize(); fprintf(stream_cam, "finished, filesize is %d\n", filesize); /* Get a block */ camera_get_block(0, 16); camera_stop_image(); while (1) { fprintf(stream_board, "HELLO\n"); _delay_ms(3000); } return 0; }
static void mipi_camera_io_init(void) { pr_info("%s\n", __func__); camera_reset(GP_CAMERA_RESET); /* for mx6dl, mipi virtual channel 1 connect to csi 1*/ if (cpu_is_mx6dl()) mxc_iomux_set_gpr_register(13, 3, 3, 1); }
static void adv7180_io_init(void) { camera_reset(IMX_GPIO_NR(3, 13), 0, IMX_GPIO_NR(3, 14), -1); if (cpu_is_mx6q()) mxc_iomux_set_gpr_register(1, 20, 1, 1); else mxc_iomux_set_gpr_register(13, 3, 3, 4); }
float CameraTool::find_view ( const SGR::vec3f& minvec, const SGR::vec3f& maxvec, float percentOfView ) { // translate SGR::vec3f center = ( minvec + maxvec ) / 2.0f; // scale float s = calcScale ( minvec, maxvec ); if ( s != 0 ) { _currentScale = percentOfView / s; camera_reset ( _pview->camid() ); camera_translate ( _pview->camid(), center.x(), center.y(), center.z() ); camera_scale ( _pview->camid(), _currentScale ); _currentTranslate.xyz ( center.x(), center.y(), center.z() ); } return _currentScale; }
static void ov5640_mipi_camera_io_init(void) { IOMUX_SETUP(mipi_pads); pr_info("%s\n", __func__); mipi_pwm = pwm_request(2, "mipi_clock"); if (IS_ERR(mipi_pwm)) { pr_err("unable to request PWM for mipi_clock\n"); } else { unsigned period = 1000/22; pr_info("got pwm for mipi_clock\n"); pwm_config(mipi_pwm, period >> 1, period); pwm_enable(mipi_pwm); } camera_reset(IMX_GPIO_NR(6, 9), 1, IMX_GPIO_NR(2, 5), IMX_GPIO_NR(6, 11)); /* for mx6dl, mipi virtual channel 1 connect to csi 1*/ if (cpu_is_mx6dl()) mxc_iomux_set_gpr_register(13, 3, 3, 1); }
/* * GPIO_6 GPIO[1]:6 (ov5642) - J5 - CSI0 power down * GPIO_8 GPIO[1]:8 (ov5642) - J5 - CSI0 reset * NANDF_CS0 GPIO[6]:11 (ov5642) - J5 - reset * SD1_DAT0 GPIO[1]:16 (ov5642) - J5 - GP */ static void ov5642_io_init(void) { IOMUX_SETUP(csi0_sensor_pads); camera_reset(GP_CSI0_PWN, 1, GP_CSI0_RST, IMX_GPIO_NR(6, 11)); /* For MX6Q GPR1 bit19 and bit20 meaning: * Bit19: 0 - Enable mipi to IPU1 CSI0 * virtual channel is fixed to 0 * 1 - Enable parallel interface to IPU1 CSI0 * Bit20: 0 - Enable mipi to IPU2 CSI1 * virtual channel is fixed to 3 * 1 - Enable parallel interface to IPU2 CSI1 * IPU1 CSI1 directly connect to mipi csi2, * virtual channel is fixed to 1 * IPU2 CSI0 directly connect to mipi csi2, * virtual channel is fixed to 2 */ if (cpu_is_mx6q()) mxc_iomux_set_gpr_register(1, 19, 1, 1); else mxc_iomux_set_gpr_register(13, 0, 3, 4); }
void scene_reset(void) { camera_reset(scene.camera); }
void myfunc() { int num_rows,k, l; double orient,delta_orient,rot_speed,t_rot,t_trans; double x0,y0,x,y,dx,dy; float distance,distance1,lala; double PI=3.14159265; x0=0; y0=0; double orient0; orient0=0; // starting conditions still have to be properly intialized double D = 0.094; /*distance between wheels, has to be measured*/ char ch; const float tol = 1.0e-7; // 7 significant figures float xold, xnew; // local variables int test; /*Read in coords, mat[d][0] contains x-coords, mat[d][1] contains y-coords*/ int i=0,j=0; double mat[100][2]; double z; // UInt32* pathx; // UInt32* pathy; // Here we should store the path-coordinates // // while((line=fgets(buffer,sizeof(buffer),fp))!=NULL) // { // // record = strtok(line,","); /*break up string, return first token */ // while(record != NULL) // { // printf("record : %s \n",record); //here you can put the record into the array as per your requirement. // mat[i][j++] = atof(record) ; /*Convert string to double, put in [i,j] then j+1*/ // record = strtok(NULL,","); // } // ++i ; // j=0; // } initRTC(); camera_reset(160); init_uart1(57600); while(1){ if(getsignal()){ ch = getch(); printf("Character on serial %c 1\r\n", ch ); if(ch == 75) {return;} else{ switch (ch) { case '1': /*Read in csv-file, mat[d][0] contains distance in m, mat[d][1] contains delta_orientation in degrees */ mat[0][0]=0.61; mat[0][1]=0; mat[1][0]=0.58; mat[1][1]=90; mat[2][0]=1.00; mat[2][1]=-45; mat[3][0]=0.33; mat[3][1]=-60; num_rows = 4; // to be determined depends on how weread in givens k=0; while(k<=num_rows-1) { distance=mat[k][0]; delta_orient=mat[k][1]; if(delta_orient>0){ t_rot=1000*(0.010*delta_orient+0.003); } else{ if(delta_orient<0){ t_rot=1000*(-0.010*delta_orient+0.003); } else t_rot=0; } t_trans=1000*(4.8*distance+0.05); printf("tekst 2 distance: %lf,delta_orient:%lf \n t_rot: %lf t_trans: %lf \n\n",distance*1000,delta_orient,t_rot,t_trans); if (delta_orient>0){ sendReceive(203,22,202,20);//turn counterclockwise delay(t_rot); sendReceive(201,0,202,0);//stop } if(delta_orient<0){ sendReceive(201, 22, 204, 20);//turn clockwise delay(t_rot); sendReceive(201,0,202,0);//stop } sendReceive(201, 23, 202, 20);//drive forward delay(t_trans); sendReceive(201, 0, 202, 0);//stop printf("k: %d",k); k++; } break; case '5': /* Drive forward */ sendReceive(201, 23, 202, 20); /* 201: Right motor moves forward 202: Left motor moves forward Forward= opposite the antenna */ break; case '6': /* Stop */ sendReceive(201, 0, 202, 0); break; case '7': sendReceive(203, 22, 204, 20); /* 203: Right motor moves backward 204: Left motor moves backward Backward= antenna - side */ break; case '8': /* Rotate left (counter clockwise) */ sendReceive(203, 22, 202, 20); /* Rotate: left motor rotates backward; right one forward */ break; case '9': /* Rotate right (clockwise) */ sendReceive(201,22,204,20); /* Rotate: left motor rotates forward; right one backward */ break; case 'a': printf("Reading path"); l = readNumber(); printf("l = ",l); followPath(l); break; } } } } //end while } //end myfunc