📄 system_operation.c
字号:
LoadFilter(3);
OSDLogo();
OSDInit();
I2CWriteByte(TW101,INT_MASK,0xF0);
/*Contrast_volume =10;
Contrast_volume_control();
Brightness_volume =10;
Brightness_volume_control();
Chroma_volume =10;
Chroma_volume_control();*/
//-----------------------------------
//-----------------------------------
Open_TFT_high_power;
SetBit(System_flag2,Display_on_flag);
Change_system_mode();
Audio_total_volume_control();
System_mute_off();
}
/******************************************************************
Function:Detect the ACC on or off and process the system
******************************************************************/
void Detect_ACC(void)
{
unsigned char i;
if(ValBit(PF_DR,ACC_ID)) /*Check ACC*/
/*Sleep mode*/
{
if(ValBit(System_flag,ACC_on_flag) ||!ValBit(System_flag3,In_to_halt_mode_flag)) /*From acc on to acc off*/
{
System_mute_on();
System_off();
SPI1_CR = 0; /* Disable SPI */
SCI_SCCR2 = 0; /* Disable SCI */
ADC_CR = 0x00; /* ADC Off */
}
//Hardware_enable_mute_system;
//Hardware_enable_mute_BACK_CON;
Close_TV_tuner_power;
Close_Radio_tuner_power;
Close_DVD_5v_power;
Close_system_9v_5v_DVD12v_power;
Close_TFT_12v_power;
Close_TFT_high_power;
ACC_off_setting_IO();
ClrBit(System_flag,Key_flag);
ClrBit(System_flag,IR_flag);
ClrBit(System_flag,ACC_on_flag);
SetBit(System_flag3,In_to_halt_mode_flag);
SetBit(MCCSR,1);
SetBit(MCCSR,2);
SetBit(MCCSR,3);
asm HALT;
}
else
/*Run mode*/
{
ClrBit(System_flag3,In_to_halt_mode_flag);
if(ValBit(System_flag,ACC_on_flag))
return;
else
{/*From ACC off to ACC on*/
SetBit(System_flag,ACC_on_flag);
if(ValBit(System_flag,ACC_on_flag))
Init_IO_port();
else
return;
Close_TV_tuner_power;
Close_Radio_tuner_power;
Close_DVD_5v_power;
Close_system_9v_5v_DVD12v_power;
Close_TFT_12v_power;
Close_TFT_high_power;
if(ValBit(System_flag,ACC_on_flag))
WAIT_100ms();
else
return;
if(ValBit(System_flag1,ST_BY_flag))
{
return;
}
if(ValBit(System_flag,ACC_on_flag))
System_on();
else
return;
if(System_mode == DVD_mode)
{
WAIT_1s();
WAIT_1s();
}
System_mute_off();
}
}
}
/******************************************************************
Function:Process the system
*******************************************************************/
void Process_KEY_IR_system(void)
{
unsigned char i;
unsigned char Temp_code_number;
if(ValBit(System_flag,Key_flag) ||ValBit(System_flag,IR_flag))
{
if(ValBit(System_flag,Key_flag))
ClrBit(System_flag,Key_flag);
if(ValBit(System_flag,IR_flag))
{
Code_number = IR_Code_number;
if(Code_number == Remote_power)
Code_number = Key_power;
ClrBit(System_flag,IR_flag);
}
if(ValBit(System_flag1,ST_BY_flag) && Code_number != Key_power )
return; /*In stby state then others key can not active*/
Set_bell_sound_time(10);
Keep_key_code = Code_number;
if(!ValBit(System_flag2,Display_on_flag))
//Display from off to on
{
SetBit(System_flag2,Display_on_flag);
Open_TFT_high_power;
return;
}
Clear_OSD_delay = 500; //The OSD will display 5 minute
if(System_mode == Radio_mode && !ValBit(Radio_tuner_flag,AutoSearchOK_flag))
{
SetBit(Radio_tuner_flag,AutoSearchOK_flag);
return;
}
if(System_mode == TV_mode && !ValBit(TV_tuner_flag,TVsearchOK))
{
SetBit(TV_tuner_flag,TVsearchOK);
return;
}
i = 0;
while( ((Function_list *)Total_menu_function_list[System_mode])[i].Code)
{
if(Code_number == ((Function_list *)Total_menu_function_list[System_mode])[i].Code)
{
UICCFuncPtr=((Function_list *)Total_menu_function_list[System_mode])[i].Do_function;
Old_do_item = Do_item;
Do_item = ((Function_list *)Total_menu_function_list[System_mode])[i].Menu_item;
(*UICCFuncPtr) ();
return;
}
i++;
}
switch(Code_number)
{
case Key_open:
Short_open_key_open_close_panel_process();
break;
case Long_key_open:
Long_open_key_close_panel_process();
break;
case Remote_open:
case Long_key_play_pause:
Remote_open_key_process();
break;
case Remote_close_panel:
Close_panel_sometime_process();
break;
case Remote_open_panel:
Open_panel_sometime_process();
break;
case Long_Remote_close_panel:
Long_open_key_close_panel_process();
break;
case Long_Remote_open_panel:
Remote_open_key_process();
break;
case Key_power:
case Remote_power:
Power_key_process();
break;
case Key_mode:
case Remote_mode:
Mode_key_process();
break;
case Key_menu:
case Remote_function:
Active_select_osd_item_process();
break;
case Key_slow_back:
case Remote_slow_back:
Select_the_prev_osd_item_process();
break;
case Key_fast_front:
case Remote_fast_front:
Select_the_next_osd_item_process();
break;
case Remote_setup:
case Remote_1:
case Remote_2:
case Remote_3:
case Remote_4:
case Remote_5:
case Remote_6:
case Remote_7:
case Remote_8:
case Remote_9:
case Remote_10_adding:
case Remote_0:
case Remote_title_pbc:
case Remote_stop:
case Remote_play_pause: /*>||*/
case Remote_left:
case Remote_right:
case Remote_up:
case Remote_down:
case Remote_enter:
case Remote_l_r:
case Remote_menu:
case Remote_repeat:
Only_DVD_function_key_process();
break;
case Remote_display:
Remote_display_key_process();
break;
case Remote_osd:
case Long_key_mute:
Remote_osd_key_process();
break;
case Long_time_key:
case Long_Remote_time:
Enable_disable_back_block_process();
break;
#ifdef Quest_500_a4
case Key_DVD:
Switch_to_DVD_mode();
break;
case Key_TV:
Switch_to_TV_mode();
break;
case Key_FM:
Switch_to_Radio_FM_mode();
break;
case Key_AM:
Switch_to_Radio_AM_mode();
break;
case Key_CDC:
Switch_to_CDC_mode();
break;
case Key_stop:
Stop_key_process();
break;
#endif
}
}
}
/******************************************************
Function:Every key's function process
******************************************************/
static void Short_open_key_open_close_panel_process(void)
{
Detect_panel_state();
if(ValBit(System_flag1,Panel_activeing_flag))
return;
if(ValBit(System_flag1,Panel_close_flag))
{
Open_panel(); //If now the panel is close state then open the panel
SetBit(System_flag1,Panel_activeing_flag);
WAIT_100ms();
WAIT_100ms();
Protect_motor_delay = 500;
}
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
WAIT_100ms();
WAIT_100ms();
}
}
}
//---------------------------------------------------------------------------------------------
static void Long_open_key_close_panel_process(void)
{
Detect_panel_state();
if(ValBit(System_flag1,Panel_close_flag))
return;
if(ValBit(System_flag1,Panel_activeing_flag))
return;
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_flag1,Panel_activeing_flag);
WAIT_100ms();
WAIT_100ms();
Protect_motor_delay = 500;
}
}
//---------------------------------------------------
void Mute_key_process(void)
{
if(!ValBit(System_flag1,Mute_flag))
{
System_mute_on();
cColor = High_light_color;
SetBit(System_flag1,Mute_flag);
}
else
{
System_mute_off();
cColor = Default_color;
ClrBit(System_flag1,Mute_flag);
}
#ifndef No_touch_system
if(System_mode == DVD_mode)
return;
#endif
if(System_mode == TV_mode)
return;
UICCFuncPtr=((MENU_LIST *)Total_menu_list[System_mode])[Do_item-DEFAULT_MENU_ITEM].DisplayPicture;
Head_colume =((MENU_LIST *)Total_menu_list[System_mode])[Do_item-DEFAULT_MENU_ITEM].Pos_color.x;
Head_row = ((MENU_LIST *)Total_menu_list[System_mode])[Do_item-DEFAULT_MENU_ITEM].Pos_color.y;
(*UICCFuncPtr) ();
}
//----------------------------------------------------
static void Power_key_process(void)
{
if(!ValBit(System_flag1,ST_BY_flag))
{
//Into stby state
System_off();
SetBit(System_flag1,ST_BY_flag);
WAIT_100ms();
WAIT_100ms();
WAIT_100ms();
}
else
{
//Unchain stby state
System_on();
ClrBit(System_flag1,ST_BY_flag);
SetBit(System_flag,ACC_on_flag);
System_mute_off();
}
}
//-----------------------------------------------------
static void Mode_key_process(void)
{
System_mute_on();
ClrBit(System_flag2,Default_light_item_flag);
ClrBit(System_flag2,Close_high_light_item_flag); //Why must clear this two flag? >From one mode to other mode sometime will outside the new mode's max number! so if not clear this two flag then sometime will display error or error power off!
if(System_mode == DVD_mode || System_mode == TV_mode || System_mode == CDC_mode || System_mode == AV_mode || System_mode == Radio_mode)
Old_system_mode = System_mode;
if(System_mode == DVD_mode)
{
DVD_command = DVD_command_POWER;
SetBit(System_flag,Send_command_to_dvd_flag);
}
if(System_mode == CDC_mode)
{
ClrBit(System_flag3,CDC_play_pause_flag);
Send_command_to_CDC(C_STOP);
}
System_mode++;
if(System_mode >=SETTING_mode)
System_mode = DVD_mode;
Change_system_mode();
System_mute_off();
}
//---------------------------------------------------
void Active_select_osd_item_process(void)
{
if(ValBit(System_flag1,OSD_on_flag))
{
UICCFuncPtr=((MENU_LIST *)Total_menu_list[System_mode])[Select_item - DEFAULT_MENU_ITEM].EnterOperate;
Keep_key_code = Code_number;
Old_do_item = Do_item; //Save the old do item
Do_item = ((MENU_LIST *)Total_menu_list[System_mode])[Select_item-DEFAULT_MENU_ITEM].item;
(*UICCFuncPtr) ();
}
else
{
//If OSD not on then return to the main menu mode
if(System_mode == DVD_mode || System_mode == TV_mode || System_mode == CDC_mode || System_mode == AV_mode || System_mode == Radio_mode)
Old_system_mode = System_mode;
System_mode = Main_menu_mode;
//System_mute_on();
Change_system_mode();
System_mute_off();
}
}
//---------------------------------------------------
void Select_the_prev_osd_item_process(void)
{
if(!ValBit(System_flag1,OSD_on_flag))
return;
Select_item = ((MENU_LIST *)Total_menu_list[System_mode])[Select_item -DEFAULT_MENU_ITEM ].prev;
Display_one_mode_all_osd_item();
}
//---------------------------------------------------
void Select_the_next_osd_item_process(void)
{
if(!ValBit(System_flag1,OSD_on_flag))
return;
Select_item = ((MENU_LIST *)Total_menu_list[System_mode])[Select_item - DEFAULT_MENU_ITEM].next;
Display_one_mode_all_osd_item();
}
//---------------------------------------------------
void Force_to_main_menu_mode(void)
{
if(System_mode == Main_menu_mode)
return;
//If not in main menu mode this key use to change to the main menu mode
if(System_mode == DVD_mode || System_mode == TV_mode || System_mode == CDC_mode || System_mode == AV_mode || System_mode == Radio_mode)
Old_system_mode = System_mode;
System_mode = Main_menu_mode;
//System_mute_on();
Change_system_mode();
System_mute_off();
}
//------------------------------------------------------
void Remote_open_key_process(void)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -