コード例 #1
0
ファイル: eject.c プロジェクト: Berrrry/util-linux
/*
 * List Speed of CD-ROM drive.
 */
static void list_speeds(const char *name, int fd)
{
#ifdef CDROM_SELECT_SPEED
	int max_speed, curr_speed = 0, prev_speed;

	select_speed(fd, 0);
	max_speed = read_speed(name);

	while (curr_speed < max_speed) {
		prev_speed = curr_speed;
		select_speed(fd, prev_speed + 1);
		curr_speed = read_speed(name);
		if (curr_speed > prev_speed)
			printf("%d ", curr_speed);
		else
			curr_speed = prev_speed + 1;
	}

	printf("\n");
#else
	warnx(_("CD-ROM select speed command not supported by this kernel"));
#endif
}
コード例 #2
0
ファイル: eject.c プロジェクト: ArakniD/util-linux
/* handle -x option */
static void set_device_speed(struct eject_control *ctl)
{
	if (!ctl->x_option)
		return;

	if (ctl->x_arg == 0)
		verbose(ctl, _("setting CD-ROM speed to auto"));
	else
		verbose(ctl, _("setting CD-ROM speed to %ldX"), ctl->x_arg);

	open_device(ctl);
	select_speed(ctl);
	exit(EXIT_SUCCESS);
}
コード例 #3
0
ファイル: eject.c プロジェクト: ArakniD/util-linux
/*
 * List Speed of CD-ROM drive.
 */
static void list_speeds(struct eject_control *ctl)
{
#ifdef CDROM_SELECT_SPEED
	int max_speed, curr_speed = 0;

	select_speed(ctl);
	max_speed = read_speed(ctl->device);

	while (curr_speed < max_speed) {
		ctl->x_arg = curr_speed + 1;
		select_speed(ctl);
		curr_speed = read_speed(ctl->device);
		if (ctl->x_arg < curr_speed)
			printf("%d ", curr_speed);
		else
			curr_speed = ctl->x_arg + 1;
	}

	printf("\n");
#else
	warnx(_("CD-ROM select speed command not supported by this kernel"));
#endif
}
コード例 #4
0
ファイル: eject.c プロジェクト: Berrrry/util-linux
/* handle -x option */
static void set_device_speed(char *name)
{
	int fd;

	if (!x_option)
		return;

	if (x_arg == 0)
		verbose(_("setting CD-ROM speed to auto"));
	else
		verbose(_("setting CD-ROM speed to %ldX"), x_arg);

	fd = open_device(name);
	select_speed(fd, x_arg);
	exit(EXIT_SUCCESS);
}
コード例 #5
0
ファイル: yo-zef_v2-6.c プロジェクト: deryuu07/NNB
void trace()	//一週目
{
	short start_frag=0;
	short trace_roop_frag=0;
	short i=0;
	short permit_goal=0;
	circl_count=1;	
	LED1=ON;
	TIMER_WAIT(1000);
	LED1=OFF;
	
	ch_para();
	//ch_para2(0);
	select_P();
//	select_sub();
	select_I();
//	select_D();
//	select_G();
	select_goal();
//	select_corner();
	select_speed();
	
	while(trace_roop_frag==0){
		init_thre();			
		calc_senc();
	
		if(cari_SEN[1] > 20.0){
			if(Dispermit_goal==1){
				start_frag=1;
				LED2=ON;
				TIMER_WAIT(500);
			}
			else{
				LED2=ON;
				permit_goal=1;
			}
		}
		
		if(cari_SEN[6] > 20.0 && permit_goal==1){
			start_frag=1;
			LED3=ON;
			TIMER_WAIT(500);
		}
		else if(cari_SEN[6] > 20.0 && permit_goal==0){	//ゴールさせない
			LED3=ON;
			Dispermit_goal=1;
		}	
	
		if(start_frag==1){
			countdown();
			TIMER_WAIT(1000);
			for(i=0; i<201; i++){
				ENC_dis[i]=0.0;
				ENC_check[i]=0;
				RL_check[i]=3;

			}
			for(i=0; i<5; i++)
				SC_box[i]=ST;

			zero_gyro=get_gyro();
			ENC_R=15000;
			ENC_sub_R=0;
			ENC_L=15000;
			ENC_sub_L=0;
			EncTimeCount=0;
			ENC_count=0;
			dis_count=0;
			
			mot_STB(START_A);
			
			start0=1;
			mot_frag=1;
			LED1=OFF;
			while(stop_frag==0){
				if(PORTE.PORT.BIT.B0 == 0){
					stop_frag=1;
					TIMER_WAIT(500);
				}
			}
			
			stop_manager();
			trace_roop_frag=1;
		}
		else{}
	}
}
コード例 #6
0
ファイル: yo-zef_v2-6.c プロジェクト: deryuu07/NNB
void trace2()	//二週目
{
	short start_frag=0;
	short trace_roop_frag=0;
	short permit_goal=0;

	circl_count=2;
	LED2=ON;
	TIMER_WAIT(1000);
	LED2=OFF;

//	ch_para2(0);
	ch_para();
	select_P();
	select_I();
//	select_D();
//	select_G();
	select_goal();
//	select_corner();
	select_speed();
	
	while(trace_roop_frag==0){
		init_thre();			
		calc_senc();
	
		if(cari_SEN[1] > 20.0){
			if(Dispermit_goal==1){
				start_frag=1;
				LED2=ON;
				TIMER_WAIT(500);
			}
			else{
				LED2=ON;
				permit_goal=1;
			}
		}
		
		if(cari_SEN[6] > 20.0 && permit_goal==1){
			start_frag=1;
			LED3=ON;
			TIMER_WAIT(500);
		}
		else if(cari_SEN[6] > 20.0 && permit_goal==0){	//ゴールさせない
			LED3=ON;
			Dispermit_goal=1;
		}	
	
		if(start_frag==1){
			countdown();
			TIMER_WAIT(1000);
				
			zero_gyro=get_gyro();
			ENC_R=15000;
			ENC_sub_R=0;
			ENC_L=15000;
			ENC_sub_L=0;
			EncTimeCount=0;
			ENC_count=0;
			dis_count=0;
				
			mot_STB(START_A);
		
			start0=1;
			mot_frag=1;
			while(stop_frag==0){}
					
			stop_manager();
			trace_roop_frag=1;			
		}
		else{}
	}
}