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

📄 irfunc.c

📁 主要用于液晶电视解码,内置51单片机,全部代码用C编写,编译环境为KEILC
💻 C
字号:
/******************************************************************************
 Copyright (c) 2003 MStar Semiconductor, Inc.
 All rights reserved.

 [Module Name]: IrFunc.c
 [Date]:        05-Feb-2004
 [Comment]:
   Remote control function routines.
 [Reversion History]:
*******************************************************************************/

#define _IRFUNC_C_

#include <intrins.h>
#include "types.h"
#include "keypaddef.h"
#include "global.h"
#include "ir.h"
#include "UserPref.h"
#include "menu.h"
#include "irfunc.h"
#include "msosd.h"
#include "tv.h"
#include "debug.h"
#include "power.h"
/*
BYTE IRKeyToNumber( BYTE ucCode )
{
    switch( ucCode )
    {
        case IRKEY_0:   return 0;
        case IRKEY_1:   return 1;
        case IRKEY_2:   return 2;
        case IRKEY_3:   return 3;
        case IRKEY_4:   return 4;
        case IRKEY_5:   return 5;
        case IRKEY_6:   return 6;
        case IRKEY_7:   return 7;
        case IRKEY_8:   return 8;
        case IRKEY_9:   return 9;
    }
    return 0xFF;
}
*/

void irDecodeCommand(void)
{
    BYTE ucRepeatFlag = 0;
    BYTE ucirkeypad = 0xFF;

    if (!_testbit_(g_bIrDetect))
        return ;

#if (IR_FORMAT == IR_RC5 )
	if(!g_bIrCommand)
		return;
#endif

   // ucTmp = IRKeyToNumber( g_ucIrCode );
    switch (g_ucIrCode)
    {
        case IRKEY_0:
            ucirkeypad=KEY_IR_0;
            break;
        case IRKEY_1:
            ucirkeypad=KEY_IR_1;
            break;
        case IRKEY_2:
            ucirkeypad=KEY_IR_2;
            break;
        case IRKEY_3:
            ucirkeypad=KEY_IR_3;
            break;
        case IRKEY_4:
            ucirkeypad=KEY_IR_4;
            break;
        case IRKEY_5:
            ucirkeypad=KEY_IR_5;
            break;
        case IRKEY_6:
            ucirkeypad=KEY_IR_6;
            break;
        case IRKEY_7:
            ucirkeypad=KEY_IR_7;
            break;
        case IRKEY_8:
            ucirkeypad=KEY_IR_8;
            break;
        case IRKEY_9:
            ucirkeypad=KEY_IR_9;
            break;

        case IRKEY_100:
            ucirkeypad=KEY_IR_100;
            break;

        case IRKEY_OSD_MENU:
            ucirkeypad=KEY_MENU;
	        ucRepeatFlag=_BIT0;
            break;
        case IRKEY_OSD_LEFT:
            ucirkeypad=KEY_LEFT;
	        ucRepeatFlag=_BIT0;
            break;
        case IRKEY_OSD_RIGHT:
            ucirkeypad=KEY_RIGHT;
	        ucRepeatFlag=_BIT0;
            break;
        case IRKEY_OSD_UP:
            ucirkeypad=KEY_UP;
	        ucRepeatFlag=_BIT0;
            break;
        case IRKEY_OSD_DOWM:
            ucirkeypad=KEY_DOWN;
	        ucRepeatFlag=_BIT0;
            break;
        case IRKEY_POWER:
            ucirkeypad=KEY_POWER;
	        ucRepeatFlag=_BIT0;
            break;
        case IRKEY_DISPLAY:
            ucirkeypad=KEY_IR_ShowINFO;
	        ucRepeatFlag=_BIT0;
            break;
        case IRKEY_MUTE:
            ucirkeypad=KEY_IR_MUTE;
	        ucRepeatFlag=_BIT0;
            break;

        #if CALENDAR_ENABLE
    	case IRKEY_CALENDAR:
    		ucirkeypad=KEY_IR_CALENDAR;
    		ucRepeatFlag=_BIT0;
    		break;
        #endif

        #if GAME_ENABLE
    	case IRKEY_GAME:
    		ucirkeypad=KEY_IR_GAME;
    		ucRepeatFlag=_BIT0;
    		break;
        #endif
		
    	default:
    		ucRepeatFlag=_BIT0;
    		break;
    } // End of switch

	if(g_bIrRepeat)
    {
         EventRepeatProcess(ucirkeypad, 2);
    }
    else
    {
        EventProcess(ucirkeypad);
    }

    if(ucRepeatFlag&_BIT0)
    {
        irDecodeRepaeat(IR_DELAY_TIME0);
    }
    else if(ucRepeatFlag&_BIT1)
    {
        irDecodeRepaeat(IR_DELAY_TIME1);
    }
    else
    {
        irDecodeEnd();
    }
}

/////////////////////////////////////////////////////
#if TV_ENABLE
void irDecodeNumKey(void)
{
    if (_testbit_(g_bIrKeyNumEnd))
    {
        //printf("\r\n g_bIrKeyNumEnd = %x", g_bIrKeyNumEnd);
        if (IsTVInUse()) // TV only
        {
            Osd_Hide();
		    Power_TurnOffPanel();
		    Set_InputTimingChangeFlag();
		    Set_ShowSourceFlag();
            TV_SelectChannel( g_ucIrNumKey );
        }
        else // clear key flag
        {
            g_bIrNumKeyStart = 0;
            g_bIrKeyNumEnd = 0;
            g_ucIr100Key = 0;
            ResetOsdTimer();
        }
    } // if IR key end
}
#endif

⌨️ 快捷键说明

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