key.c
来自「CS8955控制TV软件。用MCU做模拟电视的控制。」· C语言 代码 · 共 131 行
C
131 行
/******************************************************************************\
Project Version: MTKCARDVD()
********************************************************************************
Filename: Key.c
Author: Alan chan
Company: CoreTek/ACT Company
********************************************************************************
File Version: 1.01
File Created: July 2007
Compiled Using: keil uVision2 Version 2.23
********************************************************************************
Files Required:
********************************************************************************
File Description:
********************************************************************************
File History:
--------------------------------------------------------------------------------
Date Name Description
--------------------------------------------------------------------------------
Mar. 2007 Alan chan File Created
\******************************************************************************/
#include "stdio.h"
#include "global.h"
#include "irkey.h"
#include "tv.h"
#include "key.h"
extern void vInitCPU(BIT OnOff);
// Determine is long push key
BIT IsLongPushKey(BYTE key)
{
return ((key==IR_VOLUME_UP)||(key==IR_VOLUME_DOWN));
}
// Determine is long push key or short push key
BIT IsLongPushOrShortKey(BYTE key)
{
return ((key==IR_MODE)||(key==IR_NUM1)||(key==IR_NUM2)
||(key==IR_NUM3)||(key==IR_NUM4)||(key==IR_NUM5)||(key==IR_NUM6));
}
// convert key to IR key
BYTE Key2IR(BIT long_push, BYTE prev_key)
{
BYTE ret_key = prev_key;
if (long_push)
{
switch (prev_key)
{
case IR_MODE:
ret_key = IR_POWER;
break;
case IR_PLAY_PAUSE:
ret_key = IR_MEM1;
break;
case IR_NEXT:
ret_key = IR_MEM2;
break;
case IR_FF:
ret_key = IR_MEM3;
break;
case IR_PREV:
ret_key = IR_MEM4;
break;
case IR_FR:
ret_key = IR_MEM5;
break;
case IR_STOP:
ret_key = IR_MEM6;
break;
// seek-
case IR_LEFT:
ret_key = IR_PREV;
break;
// seek+
case IR_RIGHT:
ret_key = IR_NEXT;
break;
case IR_MUTE:
ret_key = IR_LOUD;
break;
}
}
return ret_key;
}
void KeyProcess()
{
#ifndef MARTIN_MODIFY_UPDATE_DATA //06Jun08
BYTE i, chksum;
#endif
//02Jun08 if (_bIRKey0!=IR_NONE)
if ((_bIRKey0!=IR_NONE)||(bTempIrKey!=IR_NONE))
{ // com=>dvd data
#ifndef MARTIN_MCU_NO_IR //martin 09May08
if (_fgIRKeyValid && (_bRemoteTimer<=5))
#endif
{
vTVKeyPreProc(_bIRKey0);
_bPlaypostKey = _bIRKey0;
//02Jun08 _bPlaypostKey = bTempIrKey;
_bIRKey0 = IR_NONE;
}
}
// mcu task for different keys
if (_bPlaypostKey!=IR_NONE)
{
_bPlaypostKey = vTVKeyState(_bPlaypostKey);
_bPlaypostKey = IR_NONE;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?