#define NO_REMOTE 0x00
#define USE_REMOTE 0x01
//#define CONTROL_MODE NO_REMOTE
#define CONTROL_MODE USE_REMOTE
//00 7F XX
#define BUTTON_0 0x14
#define BUTTON_1 0x04
#define BUTTON_2 0x10
#define BUTTON_3 0x11
#define BUTTON_4 0x01
#define BUTTON_5 0x19
#define BUTTON_6 0x1D
#define BUTTON_7 0x55
#define BUTTON_8 0x56
#define BUTTON_9 0x57
#define BUTTON_INPUT 0x53
#define BUTTON_OUTPUT 0x47
#define BUTTON_SWITCH 0x0A
#define BUTTON_VGA 0x5D
#define REMOTE_START_CMD1 0x00
#define REMOTE_START_CMD2 0x7F
if(UartTick == 3)
{
if((UartCmds[0] == REMOTE_START_CMD1)&&(UartCmds[1] == REMOTE_START_CMD2))
{
UartDetected = TRUE;
ES = 0;
}
}
#elif(CONTROL_MODE==USE_REMOTE)
/* for(cTick=0;cTick<UartCmds[cTick];cTick++)
{
if(UartCmds[cTick]==Botton_SWITCH)
Remote_SwitchPort();
else if(UartCmds[cTick]==Botton_RESET)
Remote_Detect();
else if
Remote_Detect();
}
*/
if(UartDetected == TRUE) //UartDetected,处理
{
Remote_Detect();
UartDetected = FALSE; //UartDetect继续接收
ES = 1;
UartTick =0;
}
#endif
}
void Remote_Detect(void)
{ //BYTE Input1,Input2,Output1,Output2;
BYTE Remote_Buffer[10];
BYTE Remote_State;
printf("\r\nKeycode=%d",UartCmds[2]);
switch(UartCmds[2])
{
case BUTTON_VGA: Remote_Index=0; break;
case BUTTON_INPUT: Remote_State=Remote_Input;break;
case BUTTON_OUTPUT: Remote_State=Remote_Output;break;
case BUTTON_SWITCH:
case BUTTON_0: NumInput=1;{if(Remote_State=Remote_Input)Input=0x00;else if(Remote_State=Remote_Output)Output=0x00;}
case BUTTON_1: Input=0x00;
case BUTTON_2: Input=0x00;
case BUTTON_3: Input=0x00;
case BUTTON_4: Input=0x00;
case BUTTON_5: Input=0x00;
case BUTTON_6: Input=0x00;
case BUTTON_7: Input=0x00;
case BUTTON_8: Input=0x00;
case BUTTON_9: Input=0x00;
default: break;
}
if(Remote_Index==0)
{
if(Remote_State==Remote_Input)
{
if(NumInput==1)
{
Input=UartCmds[2];
}
}
}