⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 system_operation.c

📁 一款车载DVD的车机源程序(正在生成中的哦)
💻 C
📖 第 1 页 / 共 5 页
字号:
	#ifndef No_touch_system
	if(System_mode == DVD_mode)
		{
		Old_do_item = Do_item;
		Do_item = ITEM_DVD_Eject;
		Item_function_on_check_hight_default_light_item();
		}
	#endif
	
	Detect_panel_state();
	
	if(ValBit(System_flag1,Panel_activeing_flag))
		return;
	if(ValBit(System_flag1,Panel_close_flag) ||ValBit(System_flag2,Panel_in_mind_air_flag))
		{
		Open_panel();
		SetBit(System_flag1,Panel_activeing_flag);
		WAIT_100ms();
		WAIT_100ms();	//Must delay this time
		Protect_motor_delay = 500;
		return;
		}
	if(No_disc)
		return;
			
	if(System_mode == DVD_mode)
		{
		DVD_command = DVD_command_OPEN_CLOSE_DISC;
		SetBit(System_flag,Send_command_to_dvd_flag);	//Finish set this flag then will in timer interrupt send the DVD command
		if(Disc_in_window)
			Out_disc_delay = 300;		//Now is close the disc,so only delay 3s then can close the panel
		else
			Out_disc_delay = 700;	//If out the disc then must after 5s then can close the panel
		}
	else
		{
		DVD_close_power_delay = 500;	//Disable in the timer interrupt close the dvd power
		SetBit(System_flag4,Close_dvd_power_flag);
		Open_DVD_5v_power;
		WAIT_1s();
		WAIT_1s();	//After the power normal then can send the command to the dvd player
		DVD_command = DVD_command_OPEN_CLOSE_DISC;
		SetBit(System_flag,Send_command_to_dvd_flag);	//Finish set this flag then will in timer interrupt send the DVD command
		DVD_close_power_delay = 500;	//After 5s then will close the DVD power in the timer interrupt
		SetBit(System_flag4,Close_dvd_power_flag);
		if(Disc_in_window)
			Out_disc_delay = 300;		//Now is close the disc,so only delay 3s then can close the panel
		else
			Out_disc_delay = 700;	//If out the disc then must afer 5s then can close the panel
		}
}
//-----------------------------------------------------
void Close_panel_sometime_process(void)
{
	//First time detect the panel's state
	Detect_panel_state();

	if(ValBit(System_flag1,Panel_activeing_flag))
		ClrBit(System_flag1,Panel_activeing_flag);
	
	if(ValBit(System_flag1,Panel_close_flag))
		return;
	else
		{
		if(Disc_in_window)
			return;
		if(Out_disc_delay != 0)
			return;	//If out the disc must wait 5s then can active close the panel
		if(No_disc ||Have_disc)	//Disc not in the window then close the panel
			{
			Close_panel();
			SetBit(System_flag2,stop_open_close_panel_flag);
			Open_close_panel_delay = 10;	//Active 100ms
			}
		}
}
//-----------------------------------------------------
void Open_panel_sometime_process(void)
{
	//First time detect the panel's state
	Detect_panel_state();

	if(ValBit(System_flag1,Panel_activeing_flag))
		ClrBit(System_flag1,Panel_activeing_flag);
	
	if(ValBit(System_flag2,Panel_open_flag))
		return;
	else
		{
		Open_panel();
		SetBit(System_flag2,stop_open_close_panel_flag);
		Open_close_panel_delay = 10;	//Active 100ms
		}
}
//-----------------------------------------------------
static void Detect_panel_state(void)
{
	if(Panel_in_mind_air)
		{
		SetBit(System_flag2,Panel_in_mind_air_flag);	//Now the panel in mind air
		ClrBit(System_flag1,Panel_close_flag);
		ClrBit(System_flag2,Panel_open_flag);
		}
	else
		{
		ClrBit(System_flag2,Panel_in_mind_air_flag);	//Now the panel must open or close state
		if(Panel_finish_open)
			{
			SetBit(System_flag2,Panel_open_flag);	//Now the panel's state is open
			ClrBit(System_flag1,Panel_close_flag);
			}
		if(Panel_finish_close)
			{
			SetBit(System_flag1,Panel_close_flag);	//Now the panel's state is close
			ClrBit(System_flag2,Panel_open_flag);
			}
		}
}
//-----------------------------------------------------
static void Only_DVD_function_key_process(void)
{	
	if(System_mode == DVD_mode)
		{
		//-----When press on this four comman then close the osd to diaplay the dvd player's osd
		if(Code_number == Remote_menu ||Code_number == Remote_title_pbc || Code_number == Remote_setup || Code_number == Remote_display)
			{
			OSDDisable();
			ClrBit(System_flag1,OSD_on_flag);
			}
		switch(Code_number)
			{
			case Remote_display:
				DVD_command = DVD_command_DISPLAY;
				break;
			case Remote_setup:
				DVD_command = DVD_command_SETUP;
				break;
			case Remote_title_pbc:
				DVD_command = DVD_command_TITLE;
				break;
			case Remote_stop:
				DVD_command = DVD_command_STOP;
				break;
			case Remote_1:
				DVD_command = DVD_command_1;
				break;
			case Remote_2:
				DVD_command = DVD_command_2;
				break;
			case Remote_3:
				DVD_command = DVD_command_3;
				break;
			case Remote_4:
				DVD_command = DVD_command_4;
				break;
			case Remote_5:
				DVD_command = DVD_command_5;
				break;
			case Remote_6:
				DVD_command = DVD_command_6;
				break;
			case Remote_7:
				DVD_command = DVD_command_7;
				break;
			case Remote_8:
				DVD_command = DVD_command_8;
				break;
			case Remote_9:
				DVD_command = DVD_command_9;
				break;
			case Remote_10_adding:
				DVD_command = DVD_command_10Adding;
				break;
			case Remote_0:
				DVD_command = DVD_command_0;
				break;
			case Remote_play_pause:
				if(ValBit(System_flag4,DVD_play_pause_flag))
					{
					DVD_command = DVD_command_PLAY;
					SetBit(System_flag4,DVD_play_pause_flag);
					}
				else
					{
					DVD_command = DVD_command_PAUSE;
					ClrBit(System_flag4,DVD_play_pause_flag);
					}
				break;
			case Remote_left:
				DVD_command = DVD_command_LEFT;
				break;
			case Remote_right:
				DVD_command = DVD_command_RIGHT;
				break;
			case Remote_up:
				DVD_command = DVD_command_UP;
				break;
			case Remote_down:
				DVD_command = DVD_command_DOWN;
				break;
			case Remote_enter:
				DVD_command = DVD_command_ENTER;
				break;
			case Remote_l_r:
				DVD_command = DVD_command_AUDIO;
				break;
			case Remote_menu:
				DVD_command = DVD_command_MENU;
				break;
			case Remote_repeat:
				DVD_command = DVD_command_REPEAT;
				break;
			}
		SetBit(System_flag,Send_command_to_dvd_flag);	//Finish set this flag then will in timer interrupt send the DVD command
		}
}
//-------------------------------------------------
void Remote_osd_key_process(void)
{
	unsigned char i;
	if(ValBit(System_flag1,OSD_on_flag))
		/*Disable the osd*/
		{
		if(System_mode == Main_menu_mode || System_mode == Radio_mode || System_mode == SETTING_mode || System_mode == Video_setting_mode  || System_mode == Csp_setting_mode || System_mode == Time_setting_mode ||!ValBit(System_flag3,Have_video_flag))
			return;
		OSDDisable();
		ClrBit(System_flag1,OSD_on_flag);
		WAIT_100ms();
		WAIT_100ms();
		WAIT_100ms();
		}
	else
		/*Restart the osd picture and enable the osd*/
		{
		Clear_osd();
		OSDPosition(1);
		Display_one_mode_all_osd_item();
		}
}
//-----------------------------------------------------
static void Enable_disable_back_block_process(void)
{
	if(System_mode == BACK_CAR_mode)
		return;
	if(ValBit(System_flag2,Display_on_flag))
		{
		ClrBit(System_flag2,Display_on_flag);
		Close_TFT_high_power;
		}
	else
		{
		SetBit(System_flag2,Display_on_flag);
		Open_TFT_high_power;
		}
}
//-----------------------------------------------------
void Remote_display_key_process(void)
{
	unsigned char Temp_buff[4];
	switch(System_mode)
		{
		case Main_menu_mode:
			if(Chinese_english_system == Chinese_system)
				{
				Chinese_english_system = English_system;
				}
			else
				{
				Chinese_english_system = Chinese_system;
				}
			Change_system_mode();
			Temp_buff[0] = 0xc0;
			Temp_buff[1] = 0xd0;
			Temp_buff[2] = 0xe0;
			Temp_buff[3] = Chinese_english_system;
			AT45DB041B_BufferToMainMemoryPageProgramWithBuilt_inErase(1,1000,0,Temp_buff,4);
			break;
		case TV_mode:
			TV_change_format();
			break;
		case DVD_mode:
			Only_DVD_function_key_process();
			break;
		}
}
/******************************************************************
Function:Display process
******************************************************************/
void Display_process(void)
{
	Check_default_light_item();
	switch(System_mode)
		{
		case Main_menu_mode:
			Main_menu_display_process();
			break;
		case DVD_mode:
			DVD_menu_display_process();
			break;
		case TV_mode:
			TV_menu_display_process();
			asm	nop;
			break;
		case Radio_mode:
			Radio_menu_display_process();
			break;
		case AV_mode:
			AV_menu_display_process();
			break;
		case CDC_mode:
			CDC_menu_display_process();
			break;
		case SETTING_mode:
			Setting_menu_display_process();
			break;
		case GPS_mode:
			asm	nop;
			break;

		case Video_setting_mode:
			Video_setting_menu_display_process();
			break;
		case Csp_setting_mode:
			asm	nop;
			break;
		case Time_setting_mode:
			Display_clock_state();
			break;
		case Passward_setting_mode:
			asm	nop;
			break;
		}
}
/*****************************************************
Function:In Radio mode how to display
******************************************************/
static void Radio_menu_display_process(void)
{
	//Check display the search item
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_SEARCH);
	if(Select_item == ITEM_RADIO_SEARCH)
		cColor = Select_osd_item_color;
	else
		{
		if(!ValBit(Radio_tuner_flag,AutoSearchOK_flag))
			cColor = High_light_color;
		else
			cColor = Default_color;
		}
	(*UICCFuncPtr) ();
	//Check display the time item
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_TIME);
	if(ValBit(System_flag1,Time_on_flag))
		(*UICCFuncPtr) ();
	else
		{
		OSDCleanLine(Head_colume,Head_row,0,5);
		OSDCleanLine(Head_colume,Head_row+1,0,5);
		}
	//Check display the channel item
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_CHANNEL_NUMBER);
	(*UICCFuncPtr) ();
	//Check display the frequence item
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_FM_AM_FREQ);
	if(Select_item == ITEM_RADIO_FM_AM_FREQ)
		cColor = Select_osd_item_color;
	else
		{
		if(ValBit(Radio_tuner_flag,Search_full_mode))	//In full search mode must high light the fraquence
			cColor = High_light_color;
		else
			cColor = Default_color;
		}
	(*UICCFuncPtr) ();
	//Check display the mute item
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_MUTE);
	if(Select_item == ITEM_RADIO_MUTE)
		cColor = Select_osd_item_color;
	else
		{
		if(ValBit(System_flag1,Mute_flag))
			cColor = High_light_color;
		else
			cColor = Default_color;
		}
	(*UICCFuncPtr) ();

	//Display M1~M6
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_M1);
	if(Select_item == ITEM_RADIO_M1)
		cColor = Select_osd_item_color;
	else
		{
	
		if(Radio_channel_high_light_cnt == 0 && !ValBit(Radio_tuner_flag,Search_full_mode))
			cColor = High_light_color;
		else
			cColor = Default_color;
		}
	(*UICCFuncPtr) ();
	asm	nop;
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_M2);
	if(Select_item == ITEM_RADIO_M2)
		cColor = Select_osd_item_color;
	else
		{
		if(Radio_channel_high_light_cnt == 1 && !ValBit(Radio_tuner_flag,Search_full_mode))
			cColor = High_light_color;
		else
			cColor = Default_color;
		}
	(*UICCFuncPtr) ();
	asm	nop;
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_M3);
	if(Select_item == ITEM_RADIO_M3)
		cColor = Select_osd_item_color;
	else
		{
		if(Radio_channel_high_light_cnt == 2 && !ValBit(Radio_tuner_flag,Search_full_mode))
			cColor = High_light_color;
		else
			cColor = Default_color;
		}
	(*UICCFuncPtr) ();
	asm	nop;
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_M4);
	if(Select_item == ITEM_RADIO_M4)
		cColor = Select_osd_item_color;
	else
		{
		if(Radio_channel_high_light_cnt == 3 && !ValBit(Radio_tuner_flag,Search_full_mode))
			cColor = High_light_color;
		else
			cColor = Default_color;
		}
	(*UICCFuncPtr) ();
	asm	nop;
	Find_out_item_Pos_Color_Dis_pointer(ITEM_RADIO_M5);
	if(Select_item == ITEM_RADIO_M5)
		cColor = Select_osd_item_color;
	else
		{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -