📄 lcd_msg.c
字号:
#define __MESSAGE__
#include "reg52.h"
#include "Header\MAIN_DEF.H"
#include "Header\CONFIG.H"
#include "Header\ACCESS.H"
#include "Header\LCD_FUNC.H"
#include "Header\LCD_MSG.H"
#include "Header\LCD_MAIN.H"
#include "Header\LCD_OSD.H"
#include "Header\MTV512.H"
#include "Header\OSD.H"
#include "Header\FONT.H"
#include "Header\SRC_CTRL.H"
#include "Header\FRAME_SYNC.H"
#include "Header\rgb_echo.H"
unsigned char GetKeyState(void)
{
/* //anson 050519
#if(MCU_TYPE == MCU_WINBOND)
unsigned char ucKeyState;
#if (BOARD_TYPE == QA_PCB || BOARD_TYPE == DEMO_LVDS_A || KINGMICE)
ucKeyState = bPOWER_KEY ? P3 | (IR_KEY_MASK | POWER_KEY_MASK) : (P3 | IR_KEY_MASK) & (0xff ^ POWER_KEY_MASK);
#elif(BOARD_TYPE == DEMO1_PCB)
ucKeyState = bPOWER_KEY ? P1 | (IR_KEY_MASK | POWER_KEY_MASK) : (P1 | IR_KEY_MASK) & (0xff ^ POWER_KEY_MASK);
#else
ucKeyState = (P3 & 0x40) | (P1 & 0x1b) | IR_KEY_MASK;
#endif
#if (IRPOLLING)
{
// unsigned char ucIR_Curr;
// You cannot respond to ucIR_Cmd[0] when IR command decoding (1 < ucIR_State).
// Because ucIR_Cmd[0] is not a constant during command decoding.
Data[0] = (1 < ucIR_State) ? 0 : ucIR_Cmd[0];
if (Data[0])
{
switch (Data[0])
{
#if (POWER_KEY_TYPE == TYPE_ONE_TOUCH)
// Only when power-key is one-touch style, you can use IR remote controller to switch power on/off
case IR_POWER_KEY : ucKeyState &= (0xff ^ POWER_KEY_MASK); break;
#endif
// Use IR to implement standard key
case IR_LEFT_KEY : ucKeyState &= (0xff ^ LEFT_KEY_MASK); break;
case IR_RIGHT_KEY : ucKeyState &= (0xff ^ RIGHT_KEY_MASK); break;
case IR_ENTER_KEY : ucKeyState &= (0xff ^ ENTER_KEY_MASK); break;
// Other IR function key
default :
ucKeyState &= (0xff ^ IR_KEY_MASK);
#if (TV_CHIP != TV_NONE)
switch (Data[0])
{
case IR_FUNC_SOURCE : Data[0] = NOTIFY_IR_SOURCE; break;
case IR_FUNC_DISP : Data[0] = NOTIFY_IR_DISP; break;
case IR_FUNC_JUMP : Data[0] = NOTIFY_IR_JUMP; break;
case IR_FUNC_CHDEC : Data[0] = NOTIFY_IR_CHDEC; break;
case IR_FUNC_CHINC : Data[0] = NOTIFY_IR_CHINC; break;
case IR_FUNC_VOLINC : Data[0] = NOTIFY_IR_VOLINC; break;
case IR_FUNC_VOLDEC : Data[0] = NOTIFY_IR_VOLDEC; break;
case IR_FUNC_MENU : Data[0] = NOTIFY_IR_MENU; break;
case IR_FUNC_ENTER : Data[0] = NOTIFY_IR_ENTER; break;
case IR_FUNC_MUTE : Data[0] = NOTIFY_IR_MUTE; break;
case IR_FUNC_NUM0 : Data[0] = NOTIFY_IR_NUM0; break;
case IR_FUNC_NUM1 : Data[0] = NOTIFY_IR_NUM1; break;
case IR_FUNC_NUM2 : Data[0] = NOTIFY_IR_NUM2; break;
case IR_FUNC_NUM3 : Data[0] = NOTIFY_IR_NUM3; break;
case IR_FUNC_NUM4 : Data[0] = NOTIFY_IR_NUM4; break;
case IR_FUNC_NUM5 : Data[0] = NOTIFY_IR_NUM5; break;
case IR_FUNC_NUM6 : Data[0] = NOTIFY_IR_NUM6; break;
case IR_FUNC_NUM7 : Data[0] = NOTIFY_IR_NUM7; break;
case IR_FUNC_NUM8 : Data[0] = NOTIFY_IR_NUM8; break;
case IR_FUNC_NUM9 : Data[0] = NOTIFY_IR_NUM9; break;
default : ucKeyState |= IR_KEY_MASK; break;
}
#endif
break;
}
}
}
#endif
return ((ucKeyState & ALL_KEY_MASK) | KEY_DISABLED) ^ ALL_KEY_MASK;
#else
*/ //anson 050519
unsigned char ucKeyState=0;
if(!bRIGHT_KEY)
ucKeyState=ucKeyState|RIGHT_KEY_MASK;
if(!bLEFT_KEY)
ucKeyState=ucKeyState|LEFT_KEY_MASK;
if(!bENTER_KEY)
ucKeyState=ucKeyState|ENTER_KEY_MASK;
// if(!bMENU_KEY)
// ucKeyState=ucKeyState|MENU_KEY_MASK;
if(!bPOWER_KEY)
ucKeyState=ucKeyState|POWER_KEY_MASK;
if(!bAUTO_KEY)
ucKeyState=ucKeyState|AUTO_KEY_MASK;
return ucKeyState;
//#endif //anson 050519
}
// Key_Trans() is used for generating key related messages, including OSD timout message.
// You can just issue the message or execute system default function, like changing input source.
// BE CAREFUL !! YOU CANNOT CHANGE ANY OSD STATUS REGISTERS OR CALL ANY OSD PROCESS HERE !!
// You should not expect OSD_Proc() can always receive your message.
// Because main program will shield OSD process from been triggered when input signal isn't stable,
// and terminate OSD process when input source is changed.
unsigned char Key_Trans()
{
static unsigned char idata ucP3_Prev = 0;
static unsigned char idata ucP3_Curr = 0;
static unsigned char idata ucKey_Repeat = 0;
unsigned char ucNotify = NOTIFY_NONE;
// Save the previous key status
ucP3_Prev = ucP3_Curr;
// Sample the current key status
ucP3_Curr = GetKeyState();
#if (POWER_KEY_TYPE == TYPE_TWO_STATE)
// We MUST handle power-key first.
if (bPower_Status)
{
if (ucP3_Curr & POWER_KEY_MASK)
ucP3_Curr ^= POWER_KEY_MASK; // Go further to handle other keys (and mask power-key)
else
{
Delay_Xms(20);
ucP3_Prev = ucP3_Curr;
ucP3_Curr = GetKeyState();
if (ucP3_Curr & POWER_KEY_MASK)
ucP3_Curr ^= POWER_KEY_MASK; // Go further to handle other keys (and mask power-key)
else
return NOTIFY_POWERDOWN;
}
}
else
{
if (ucP3_Curr & POWER_KEY_MASK)
{
ucKey_Issued = 0;
Delay_Xms(20);
ucP3_Prev = ucP3_Curr;
ucP3_Curr = GetKeyState();
if (ucP3_Curr & POWER_KEY_MASK)
return NOTIFY_POWERUP;
else
return NOTIFY_NONE;
}
else
return NOTIFY_NONE;
}
#else // POWER_KEY_TYPE is TYPE_ONE_TOUCH
if (bPower_Status)
{
if (POWER_KEY_MASK & ucP3_Curr)
{
if ((ucP3_Prev ^ ucP3_Curr) & POWER_KEY_MASK)
{
Delay_Xms(20);
ucP3_Curr = GetKeyState();
if ((ucP3_Prev ^ ucP3_Curr) & POWER_KEY_MASK)
{
if(((stGUD3.TV_SETTING & 0x08)==0x08) || ((stGUD3.TV_SETTING & 0x20)==0x20 )) //anson
{
stGUD3.TV_SETTING &= 0xF7 ; //anson Factory bit=0
Save_GUD3(); //anson
}
return NOTIFY_POWERDOWN;
}
else
return NOTIFY_NONE;
}
}
}
else
{
if ((RIGHT_KEY_MASK| POWER_KEY_MASK ) == ucP3_Curr) //anson
{
stGUD3.TV_SETTING |= 0x08;//Factory mode
Save_GUD3();
return NOTIFY_POWERUP;
}
else if ((MODE_NOSIGNAL == ucMode_Curr) &&((LEFT_KEY_MASK | POWER_KEY_MASK) == ucP3_Curr)) //anson
{ //ucNotify = NOTIFY_BURNIN_KEY;
stGUD3.TV_SETTING = stGUD3.TV_SETTING | 0x20; //Burning Mode
Save_GUD3();
return NOTIFY_POWERUP;
}
else if (POWER_KEY_MASK & ucP3_Curr)
{
if ((ucP3_Prev ^ ucP3_Curr) & POWER_KEY_MASK)
{
ucKey_Issued = 0;
Delay_Xms(20);
ucP3_Curr = GetKeyState();
if ((ucP3_Prev ^ ucP3_Curr) & POWER_KEY_MASK)
return NOTIFY_POWERUP;
else
return NOTIFY_NONE;
}
else
return NOTIFY_NONE;
}
}
#endif
// Generate Key Messages
switch (ucP3_Curr)
{
///////////////////////////////////////////////////////////////////////////////////
//anson
///////////////////////////////////////////////////////////////////////////////////
case FACTORY_KEY_MASK : //anson 0921
if ((ucP3_Prev ^ ucP3_Curr) & FACTORY_KEY_MASK)
{
do
{
ucP3_Curr = GetKeyState();
}while(ucP3_Curr != 0x00);
ucKey_Issued = 0;
ucNotify = NOTIFY_FACTORY_KEY;
}
break;
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
case AUTO_KEY_MASK :
if ((ucP3_Prev ^ ucP3_Curr) & AUTO_KEY_MASK)
{
ucKey_Issued = 0;
ucNotify = NOTIFY_AUTO_KEY;
}
break;
/*
case MENU_KEY_MASK :
if ((ucP3_Prev ^ ucP3_Curr) & MENU_KEY_MASK)
{
if (ucOSD_Page_Index)
{
ucKey_Issued = 0;
// ucNotify = NOTIFY_MENU_KEY; //default , now mask for exit function
ucNotify = NOTIFY_EXIT_KEY;
}
else
{
bStable = 0;
return NOTIFY_POWERUP;
}
}
break;
*/
case ENTER_KEY_MASK :
if ((ucP3_Prev ^ ucP3_Curr) & ENTER_KEY_MASK)
{
ucKey_Issued = 0;
//usOSD_Timer = (unsigned int)stGUD1.OSD_TIMEOUT << 9; // Reset OSD timeout timer
usOSD_Timer = (unsigned int)stGUD1.OSD_TIMEOUT * 51;
ucNotify = NOTIFY_ENTER_KEY; // Post enter-key pressed message
ucKey_Repeat = KEY_REPEAT_COUNT * 8;
}
else
{
if (ucKey_Repeat)
ucKey_Repeat -= 1;
else
{
if (ucOSD_Page_Index)
{
usOSD_Timer = 0;
ucNotify = NOTIFY_CLEAR_OSD;
}
}
}
break;
case RIGHT_KEY_MASK :
case LEFT_KEY_MASK:
//usOSD_Timer = (unsigned int)stGUD1.OSD_TIMEOUT << 9; // Reset OSD timeout timer
//----------------------------------echo add begin
if (ucOSD_Page_Index)
{
usOSD_Timer = (unsigned int)stGUD1.OSD_TIMEOUT * 51;
}
else
{
if (b_rgb_VOLUME_STATUS)
usOSD_Timer = (unsigned int)stGUD1.OSD_TIMEOUT * 4;
}
//----------------------------------echo add end;
if ((ucP3_Prev ^ ucP3_Curr) & ucP3_Curr)
{
ucKey_Issued = 0;
ucNotify = (ucP3_Curr == RIGHT_KEY_MASK) ? NOTIFY_RIGHT_KEY : NOTIFY_LEFT_KEY; // Post right-key pressed message
ucKey_Repeat = KEY_REPEAT_COUNT;
}
else
{
if (ucKey_Repeat)
ucKey_Repeat -= 1;
else
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -