📄 ir_main.c
字号:
tmpcount++;
}*/
else if (((IrOldCommandbuf == 0x06 ||IrOldCommandbuf == 0x07) )&& OBM_IsOnDtv() && globalState_g != MENUMODE)
{
if (tmpcount >15)
{
info=irOldCommand; // IrOldCommandbuf
irState = 100;
tmpcount = 0;
break;
}
tmpcount++;
}
else if (IrOldCommandbuf != 0x05)
//Aend7-5
{
info=irOldCommand; //kent_20060216
irState = 100;
tmpcount = 0;
break;
}
}
/*
{
info=irOldCommand; //kent_20060216
irState = 100;
break;
}
*/
return;
case aC8:
if ((captnew > T2MIN) && (captnew < T4MAX))//kent test&& irActiveCounter_g > 20 ) //18 good
{
if(captnew > T4MIN)
info=(info<<1)|1;
else
info=(info<<1)&0xfffe;
{
uint8_t hight_value;
uint8_t low_value;
hight_value = (info >> 8) & 0xff;
low_value = info & 0xff;
if(hight_value != ~low_value)
{
irState= 0;
SET_IR_INT_FALLING_EDGE;
IR_InitSsu();
irOldCommand = 0xFFFF;
IrOldCommandbuf = 0xFFFF;
irMessage_g.param1 = 0;
return;
}
}
irActiveCounter_g = 0; // allow next 108+13.5ms scean
break;
}
return; //kent_20060215
default: //bit '0' or '1'
if((captnew > T2MIN) && (captnew < T4MAX))
{ // process one bit
irState++;
if (irState > aS8)
{
if(captnew > T4MIN)
info=(info<<1)|1;
else
info=(info<<1)&0xfffe;
//az.060818:+
if(irState == C1)
{
systemcode = info&0xffff;
if(systemcode != 0x10EF) //proview: 0001 0000 1110 1111
{
irState= 0;
SET_IR_INT_FALLING_EDGE;
IR_InitSsu();
irOldCommand = 0xFFFF;
IrOldCommandbuf = 0xFFFF;
irMessage_g.param1 = 0;
return;
}
}
} /** prepare next state */
else
{
if(captnew > T4MIN)
info=(info<<1)|1;
else
info=(info<<1)&0xfffe;
}
return;//kent_20060215
}
else
{ /** E R R O R ! invalid pulses, activate SSU again */
irState= 0;
SET_IR_INT_FALLING_EDGE;
IR_InitSsu();
}
}
LEDCounter_g = 0; /* Reload flash-time register. */
// if(ConvertSingalBlack_t) // wxk 060822
// return; TEST
irMessage_g.cmd=info; //kent_20060215
if (!CORE_PeekMsg(INFRARED))
{
if (irState == 100)
{
if (irMessage_g.param2++ == 255) /* counter repeated command */
irMessage_g.param2 = 200; //200 /* don't set to 0 */
irMessage_g.param1 = BUTTONPRESSED; /* = 2 -> repeat command */
buttonDown = FALSE;
}
else /* prepare new command */
{
irMessage_g.param2 = 1; /* init counter */
irMessage_g.param1 = BUTTONDOWN; /* = 1 -> first command */
buttonDown = TRUE;
/* new command received, then allow menu left/right functions */
waitForFirstCommand_g = 0;
irOldCommand = info; //kent_20060216 /* save for compare */
}
//kent_20060306 }
irOpenCounter_g = 0;
bCom1 = (info >>8)&0xFF;
// bCom2 = info & 0xFF;
irMessage_g.cmd=0;
/*
for (n=0;n<8;n++)
{
tempbit = bCom1 & ShiftBit;
ShiftBit << 1;
irMessage_g.cmd |= tempbit;
irMessage_g.cmd << 1;
}
*/
for (n=0;n<7;n++)
{irMessage_g.cmd=irMessage_g.cmd|((bCom1&0x01));
irMessage_g.cmd=irMessage_g.cmd<<1;
bCom1=bCom1>>1;
}
irMessage_g.cmd=irMessage_g.cmd|((bCom1&0x01));
// irMessage_g.cmd=irMessage_g.cmd<<7
// irOldCommand = irMessage_g.cmd; /* save for compare */
IrOldCommandbuf=irMessage_g.cmd;//wzh2006-03-31
if (info != 0x3FF) /* exclude EOT and execute only if EOT received */
{
#ifdef ENOX
if(CTRL_GetBacklightONOFF() == SYS_OFF && irMessage_g.param1 == BUTTONDOWN)
{
CTRL_SetBacklightONOFF(SYS_ON) ;
return;
}
#endif
if(I2C_Debugging_t||PIP_Vctp_GetbKeyTrashy()) // wxk 060822
return;
//if(!CTRL_GetBurnInModeActive())
if(CTRL_GetfactorymodeState_g()==FALSE)
{
/* get event from conversion table: */
#ifdef __DVB_T__
/*
if(OBM_IsOnDtv() && (irMessage_g.cmd == 0x41 || irMessage_g.cmd == 0x43) && (DTV_State == OBM_STATUS_DTVMENU || DTV_State == OBM_STATUS_MHEG5SHOW))
CTRL_Wait(250);
else if(OBM_IsOnDtv() && (irMessage_g.cmd == 0x06 || irMessage_g.cmd == 0x07) && (DTV_State == OBM_STATUS_DTVMENU || DTV_State == OBM_STATUS_MHEG5SHOW))
CTRL_Wait(100);
else if(OBM_IsOnDtv() && (irMessage_g.cmd == 0x02 || irMessage_g.cmd == 0x03))
CTRL_Wait(250);
else if(OBM_IsOnDtv() && globalState_g != MENUMODE && irMessage_g.cmd != 0x1f && irMessage_g.cmd != 0x42)
CTRL_Wait(50);
else if(OBM_IsOnDtv() && irMessage_g.cmd == ENTKEY)
CTRL_Wait(50);
*/
#endif
{
/*************************wzh2007-04-05**********************/
// if(irMessage_g.cmd == 31 && OBM_IsOnDtv() == SYS_TRUE && pipVctpOn_g == SYS_TRUE)
// CurrentSource_DTV = SYS_FALSE;
/*************************wzh2007-04-05 end**********************/
convertNECMessage(&irMessage_g.cmd);
if(menu_g.Id == MENU_TUNING_ON)
{
if(irMessage_g.cmd == CURDOWN || irMessage_g.cmd == CURUP || irMessage_g.cmd == CURLEFT || irMessage_g.cmd == CURRIGHT || irMessage_g.cmd == OKKEY || irMessage_g.cmd == STBYKEY || irMessage_g.cmd == MENUKEY )
;
else
return;
}
if(DTVSourceSelectFlag != 1)
CORE_PostMsg(INFRARED, &irMessage_g);
if(irMessage_g.cmd == MENUKEY)
MenuOnIr = SYS_TRUE;
}
CTRL_SetfactorymodeState_g(FALSE);//wzh2006-02-28
}
else if(!CTRL_GetBurnInModeActive())
{
#ifdef __NEC__
if(irMessage_g.cmd==0x05)
#endif
#ifdef __RSTEP__
if(irMessage_g.cmd==0x16)
#endif
CTRL_SetfactorymodeState_g(FALSE);//wzh2006-02-28
else
{
/* get event from conversion table: */
convertNECMessage(&irMessage_g.cmd);
CORE_PostMsg(INFRARED, &irMessage_g);
MAIN_ResetOffTime();
}
}
else if(CTRL_GetBurnInModeActive())
{
#ifdef __NEC__ //|| irMessage_g.cmd==0x1A
if(irMessage_g.cmd==0x05 || globalState_g==SERVICEMODE)
#endif
#ifdef __RSTEP__
if(irMessage_g.cmd==0x16 || globalState_g==SERVICEMODE)
#endif
{
/* get event from conversion table: */
convertNECMessage(&irMessage_g.cmd);
CORE_PostMsg(INFRARED, &irMessage_g);
MAIN_ResetOffTime(); /* reset Off-Timer to 180 minutes*/
//kent_20060306 }
}
}
}
}
// IEN1 = 0;
// EX1 = 0;
}
#endif
/******************************************************************************/
/**
* @brief Decodes the infrared remote control commands, translates them into
* independent user commands and passes them to the message queue.
*
* @param --
*
* @return --
******************************************************************************/
#ifdef __IR60__ /* infrared detection of IR60 code with TVText */
void IR_InterruptInfrared(void)
{
uint16_t data captnew;
captnew = (CRT_CAPH << 8) + CRT_CAPL;
/* difference = real value (elapsed time since last ir event): */
captnew -= RELOADMAXSSU;
if (irState == START1)
{ /* switch to capture compare mode */
SET_IR_INT_CHANGING_EDGE; /* EXT Interrupt activated by
falling and rising edge */
CRT_CON1 &= 0xFE; /* bit 0: START: stop SSU */
INTSOURCE = 0; /* IRQ source is selected port pin for INT0 ( not SSU ) */
captnew = TNOM; /* start bit is 1. int. so save start bit immediately */
captold = 0; /* reset half bit time */
irState++; /* and skip to 1. Group bit state */
info = 0; /* prepare new decoding */
}
/* test if interrupt in the middle of bit time: */
if ((captnew > THALFMIN) && (captnew < THALFMAX))
{
if (!captold)
{
captold = captnew; /* store half bit time */
return;
}
else
{
captnew += captold; /* two half bit times? -> continue */
captold = 0; /* reset half bit time */
}
}
/* test if interrupt is bit time, valid bits have to be read and stored */
if ((captnew > TMIN) && (captnew < TMAX))
{
irState++; /* prepare next state */
info >>= 1; /* shift previous bits */
if (API_Tvt_GetInfraredPort())
info |= 0x0200; /* set actual bit */
}
else
{ /* E R R O R ! invalid pulses, activate SSU again */
SET_IR_INT_RISING_EDGE; /* set EXT Int. active edge */
IR_InitSsu();
return;
}
if (irState != COMEND) /* all bits received */
return;
/* ---------------------------- end ir receiver ---------------------------- */
//sl37 start
#if 0
if (globalState_g != STANDBYMODE) /* Start LED flashing */
API_Tvt_SetLed(SYS_ON);
else
API_Tvt_SetLed(SYS_OFF);
#endif
//sl37 end
LEDCounter_g = 0; /* Reload flash-time register. */
if (info >> 1 != 0x3FF)
irOpenCounter_g = 0; /* keep zero while IR commands are received */
if (!CORE_PeekMsg(INFRARED)) /* prev. command executed and EOT received? */
{
/* Set Group and Command to message struct */
irMessage_g.cmd = info >> 1;
{
/* same command again? */
if (info != 0x3FF && irOldCommand == irMessage_g.cmd)
{
if (irMessage_g.param2++ == 255) /* counter repeated command */
irMessage_g.param2 = 200; /* don't set to 0 */
irMessage_g.param1 = BUTTONPRESSED; /* = 2 -> repeat command */
}
else /* prepare new command */
{
irMessage_g.param2 = 1; /* init counter */
irMessage_g.param1 = BUTTONDOWN; /* = 1 -> first command */
/* new command received, then allow menu left/right functions */
waitForFirstCommand_g = SYS_FALSE;
}
}
irOldCommand = irMessage_g.cmd; /* save for compare */
if (info != 0x3FF) /* exclude EOT and execute only if EOT received */
{
/* get event from conversion table: */
convertIR60Message(&irMessage_g.cmd);
CORE_PostMsg(INFRARED, &irMessage_g);
MAIN_ResetOffTime(); /* reset Off-Timer to 180 minutes*/
}
}
}
#endif /* of __IR60__*/
/******************************************************************************/
/**
* @brief Decodes the infrared remote control commands, translates them into
* independent user commands and passes them to the message queue.
*
* @param --
*
* @return --
******************************************************************************/
#ifdef __RC5__ /* infrared detection of RC5 code with TVText */
void IR_InterruptInfrared(void)
{
uint8_t data com;
uint8_t data group;
uint16_t data toggle;
uint16_t data captnew;
captnew = (CRT_CAPH << 8) + CRT_CAPL;
/* difference = real value (elapsed time since last ir event) */
captnew -= RELOADMAXSSU;
if (irState == START1)
{ /* switch to capture compare mode */
SET_IR_INT_CHANGING_EDGE; /* set both edges activ */
CRT_CON1 &= 0xFE; /* bit 0: START: stop SSU */
INTSOURCE = 0; /* IRQ source is selected port pin for INT0 ( not SSU ) */
captold = 0; /* clear half bit time */
irState++; /* prepare next state */
info = 0; /* prepare new decoding */
}
/* test if interrupt in the middle of bit time */
if ((captnew > THALFMIN) && (captnew < THALFMAX))
{
if (!captold)
{
captold = captnew; /* store half bit time */
return;
}
else
{
captnew += captold; /* two half bit times? -> continue */
captold = 0; /* reset half bit time */
}
}
/* test if interrupt is bit time, valid bits have to be read and stored */
if ((captnew > TMIN) && (captnew < TMAX))
{
irState++; /* prepare next state */
/* shift previous bits and set actual bit */
info = info << 1 | !API_Tvt_GetInfraredPort();
}
else
{
/* E R R O R ! invalid pulses, activate SSU again */
SET_IR_INT_CHANGING_EDGE; /* EX1 activated by falling edge at Port */
IR_InitSsu();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -