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

📄 irfunc.c

📁 使用于克隆器
💻 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_

// System
#include <intrins.h>

// Common
#include "board.h"
#include "define.h"
#include "mcu.h"
#include "userdef.h"
// External
#include "global.h"
#include "uart.h"
#include "ir.h"
#include "keypad.h"
#include "i2c.h"
#include "uart.h"
#include "UserPref.h"
#include "Ram.h"

// Internal
#include "irfunc.h"


 void irDecodeCommand( void )
{
#define KEYDELAY1 10
#define KEYDELAY2 0

    BOOL bProcessDefaultIREvent = TRUE;

    g_IrCodeParam[5] = FALSE;

    if ( !_testbit_( g_bIrDetect ) )
        return;

    //printf("\r\n [0x%x]", g_ucIrCode);        //IR Command
    //printf("\r\n [0x%x]", g_IrCodeParam[4]);  // From IR

    if ( !bProcessDefaultIREvent ) // Don't process default IR event
        return;

    irDecodeRepeat( 0 );//KEYDELAY1);

    switch ( g_ucIrCode )
    {
        case IRKEY_0:
        case IRKEY_1:
        case IRKEY_2:
        case IRKEY_3:
        case IRKEY_4:
        case IRKEY_5:
        case IRKEY_6:
        case IRKEY_7:
        case IRKEY_8:
        case IRKEY_9:
            irAdjustNumKey( g_ucIrCode );
            break;

        case IRKEY_TVMENU:
            break;
        case IRKEY_POWER:
             break;
        case IRKEY_INPUT:
             break;
        case IRKEY_VOL_UP:
             break;
        case IRKEY_VOL_DOWN:
             break;
        case  IRKEY_PMODE:
             break;
        case IRKEY_SLEEP:
             break;
        case  IRKEY_SMODE:
             break;
        case IRKEY_CH_UP:
             break;
        case IRKEY_CH_DOWN:
             break;
        case IRKEY_CH_RECALL:
             break;

        case IRKEY_MUTE:
             break;
        case IRKEY_DISPLAY:
            irPullFactoryKey(IRKEY_DISPLAY);
            break;
        case IRKEY_STILL:
             break;
        case IRKEY_AAA:
             break;

            //cx20050713
        case IRKEY_CC:
             break;

        case IRKEY_LOCK:
             break;
        case IRKEY_ATSC:
             break;

        case IRKEY_ASPECT_RATIO:
             break;
        case IRKEY_MTS:
             break;
        case IRKEY_C_SYS:
            break;
        case IRKEY_S_SYS:
             break;
        case IRKEY_22:
             break;
        case IRKEY_24:
             break;
        case IRKEY_NAVI:
             break;
     } // End of switch
}

/////////////////////////////////////////////////////
void irAdjustNumKey( BYTE ucPressNum )
{
    BYTE i;

    if ( g_ucIrNumKeyTimer == 0 )
    {
        for ( i = 0; i < 3; i++ )
        {
            g_IrCodeParam[i] = ' ';
        }
    }
    g_ucIrNumKeyTimer = IR_NUMKEY_DELAY_TIME1;
    g_IrCodeParam[0] = g_IrCodeParam[1];
    g_IrCodeParam[1] = g_IrCodeParam[2];
    //IrCodeParam[2] = ucPressNum + OSD_0_INDEX;
    g_IrCodeParam[2] = ucPressNum ;
    g_IrCodeParam[3] = '\0';
 }

//IRKEY_SLEEP ->IRKEY_DISPLAY ->IRKEY_OSD_MENU ->IRKEY_DISPLAY
//IRKEY_DISPLAY ->IRKEY_PICMODE ->IRKEY_SMODE ->IRKEY_SLEEP
//bit0          bit1                bit2                bit3
void irPullFactoryKey( BYTE ucPressKey )
{
    switch ( ucPressKey )
    {
        case IRKEY_DISPLAY:
            if ( g_ucFacEnterKey == 0 )
                g_ucFacEnterKey |= _BIT0;
            else if ( g_ucFacEnterKey == _BIT0 )
                break;//Not care repeat
            else
                g_ucFacEnterKey = 0;
            break;
        case IRKEY_PMODE:
            if ( g_ucFacEnterKey == ( _BIT0 ) )
                g_ucFacEnterKey |= _BIT1;
            else if ( g_ucFacEnterKey == ( _BIT0 | _BIT1 ) )
                break;//Not care repeat
            else
                g_ucFacEnterKey = 0;
            break;
        case IRKEY_SMODE:
            if ( g_ucFacEnterKey == ( _BIT0 | _BIT1 ) )
                g_ucFacEnterKey |= _BIT2;
            else if ( g_ucFacEnterKey == ( _BIT0 | _BIT1 | _BIT2 ) )
                break;//Not care repeat
            else
                g_ucFacEnterKey = 0;
            break;
        case IRKEY_SLEEP:
            if ( g_ucFacEnterKey == ( _BIT0 | _BIT1 | _BIT2 ) )
                g_ucFacEnterKey |= _BIT3;
            else if ( g_ucFacEnterKey == ( _BIT0 | _BIT1 | _BIT2 | _BIT3 ) )
                break;//Not care repeat
            else
                g_ucFacEnterKey = 0;
            break;
        default:
            break;
    }
}

/////////////////////////////////////////////////////
void irDecodeNumKey( void )
{
    if ( g_ucIrNumKeyTimer )
    {
        g_ucIrNumKeyTimer--;
    }
}


⌨️ 快捷键说明

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