📄 keyremo.c
字号:
//
// KeyRemo.h
// Default function for Key Input and Remocon Input
//
//=============================================================================
// Operation Key Mapping
//=============================================================================
#include "config.h"
#include "typedefs.h"
#include "keyremo.h"
#include "measure.h"
#include "audio.h"
#include "dispinfo.h"
#include "main.h"
#include "i2c.h"
#include "osdmenu.h"
#include "cpu.h"
#include "printf.h"
#include "regmap.h"
#include "reg.h"
#ifdef SUPPORT_TV
#include "Tuner.h"
#endif
extern bit OnChangingValue;
extern bit RepeatKey;
#ifdef SUPPORT_DEBUG
extern bit Debug_On;
#endif
extern IDATA BYTE PcMode;
extern WORD OSDLastKeyInTime; // in ms
extern bit DisplayInputHold;
extern DATA WORD tic_pc;
extern bit KeyReady;
extern DATA BYTE Key;
extern IDATA BYTE RemoDataReady,RemoSystemCode, RemoDataCode;
extern bit ChannelEdit_Flag;
extern bit ChannelEdit_on;
#if (defined SUPPORT_TV)
BYTE ToNumber( BYTE chncode )
{
switch( chncode ) {
case REMO_NUM0: return 0;
case REMO_NUM1: return 1;
case REMO_NUM2: return 2;
case REMO_NUM3: return 3;
case REMO_NUM4: return 4;
case REMO_NUM5: return 5;
case REMO_NUM6: return 6;
case REMO_NUM7: return 7;
case REMO_NUM8: return 8;
case REMO_NUM9: return 9;
default: return 0xff;
}
}
#endif
void RemoMenu_MenuKey(void)
{
if( GetDisplayedOSD() & MENU ) OSDHighMenu();
else OpenOSDMenu();
}
void RemoChnUp_UpKey(void)
{
#ifdef SUPPORT_DEBUG
if( Debug_On ) {
DebugWindowData(UP);
return;
}
else
#endif
if( GetDisplayedOSD() & MENU )
#ifdef PAL_TV
if( ChannelEdit_Flag) {
if( ChannelEdit_on ) ChannelEdit_Char(UP);
else {
UpDownTVChannel(DN);
ChannelEdit_display();
}
}
else
#endif
OSDCursorMove(UP);
#ifdef SUPPORT_PC
else if( GetInputSelection()==PC ) AutoAdjust();
#endif
#ifdef SUPPORT_TV
else if( GetInputSelection() == TV )
UpDownTVChannel(UP);
#endif
else
return;
}
void RemoChnDn_DnKey(void)
{
#ifdef SUPPORT_DEBUG
if( Debug_On ) {
DebugWindowData(DN);
return;
}
else
#endif
if( GetDisplayedOSD() & MENU ) {
#ifdef PAL_TV
if( ChannelEdit_Flag){
if( ChannelEdit_on ) ChannelEdit_Char(DN);
else {
UpDownTVChannel(UP);
ChannelEdit_display();
}
}
else
#endif
OSDCursorMove(DN);
}
#ifdef SUPPORT_TV
else if( GetInputSelection() == TV ) UpDownTVChannel(DN);
#endif
else
#ifdef SUPPORT_LINE_OSDDEMO
DisplayLineOSD();
#endif
return;
}
void RemoVolUp_RightKey(void)
{
#ifdef SUPPORT_DEBUG
if( Debug_On ) {
DebugWindowCursor(UP);
return;
}
else
#endif
if( GetDisplayedOSD() & MENU ) {
if( OnChangingValue ) OSDValueUpDn(UP );
#ifdef PAL_TV
else if( ChannelEdit_Flag ) ChannelEdit_Cursor (UP);
#endif
else OSDSelect();
}
else
{
ChangeVol(1);
DisplayVol();
}
}
void RemoVolDn_LeftKey(void)
{
#ifdef SUPPORT_DEBUG
if( Debug_On ) {
DebugWindowCursor(DN);
return;
}
else
#endif
if( GetDisplayedOSD() & MENU ) {
if( OnChangingValue ) OSDValueUpDn(DN );
#ifdef PAL_TV
else if( ChannelEdit_Flag ) ChannelEdit_Cursor (DN);
#endif
else OSDHighMenu();
}
else
{
ChangeVol(-1);
DisplayVol();
}
}
//=============================================================================
//
//=============================================================================
BYTE ActionRemo(BYTE _RemoDataCode, BYTE AutoKey)
{
SetOSDLastKeyInTime();
/*
#if (defined SUPPORT_PC) || (defined SUPPORT_DTV)
if( (PcMode==EE_PC_NO_SIGNAL) && (GetInputSelection()==PC || GetInputSelection()==DTV) ) {
if( PcMode==EE_PC_NO_SIGNAL ) {
switch (_RemoDataCode) {
case REMO_INPUT:
//case REMO_STANDBY:
break;
default:
tic_pc = 0;
return 1;
}
}
}
#endif // SUPPORT_PC
*/
switch(_RemoDataCode) {
case REMO_STANDBY: // power
#ifdef DEBUG_KEYREMO
dPrintf("\r\nSTANDBY Mode, Autokey:%02x", AutoKey);
#endif
OSDLastKeyInTime = 0xffff;
if( AutoKey ) return 1;
return 0; // power off
case REMO_MUTE:
#ifdef DEBUG_KEYREMO
dPrintf("\r\nMUTE Mode, Autokey:%02x", AutoKey);
#endif
if( AutoKey ) return 1;
ToggleAudioMute();
if( IsAudioMuteOn() ) DisplayMuteInfo();
else{
ClearMuteInfo();
if( DisplayInputHold ) DisplayInput();
}
break;
case REMO_INPUT:
#ifdef DEBUG_KEYREMO
dPrintf("\r\nChange INPUT, Autokey:%02x", AutoKey);
#endif
ChangeInput(GetNextInputSelection());
return 1;
case REMO_INFO:
#ifdef DEBUG_KEYREMO
dPrintf("\r\nINFO display, Autokey:%02x", AutoKey);
#endif
if( GetDisplayedOSD() & INPUTINFO ) ClearInput();
else DisplayInput();
return 1;
case REMO_NUM0:
case REMO_NUM1:
case REMO_NUM2:
case REMO_NUM3:
case REMO_NUM4:
case REMO_NUM5:
case REMO_NUM6:
case REMO_NUM7:
case REMO_NUM8:
case REMO_NUM9:
#ifdef DEBUG_KEYREMO
dPrintf("\r\nNumber %02x Key Pressed, Autokey:%02x", (_RemoDataCode-0x30), AutoKey);
#endif
if( AutoKey ) return 1;
#ifdef SUPPORT_TV
else if( GetInputSelection() == TV ) EditTVChn( ToNumber(_RemoDataCode) );
#endif
else return 1;
break;
case REMO_CHNUP:
#ifdef DEBUG_KEYREMO
dPuts("\r\nChannel UP");
#endif
RemoChnUp_UpKey();
break;
case REMO_CHNDN:
#ifdef DEBUG_KEYREMO
dPuts("\r\nChannel DOWN");
#endif
RemoChnDn_DnKey();
break;
case REMO_SELECT:
#ifdef DEBUG_KEYREMO
dPrintf("\r\nSELECT key pressed, Autokey:%02x", AutoKey);
#endif
if( AutoKey ) return 1;
if( GetDisplayedOSD() & MENU ) {
OSDSelect();
}
break;
case REMO_VOLUP:
#ifdef DEBUG_KEYREMO
dPuts("\r\nVolumn UP");
#endif
RemoVolUp_RightKey();
break;
case REMO_VOLDN:
#ifdef DEBUG_KEYREMO
dPuts("\r\nVolumn DOWN");
#endif
RemoVolDn_LeftKey();
break;
case REMO_MENU:
#ifdef DEBUG_KEYREMO
dPrintf("\r\nMENU display, Autokey:%02x", AutoKey);
#endif
if( AutoKey ) return 1;
RemoMenu_MenuKey();
break;
case REMO_EXIT:
#ifdef DEBUG_KEYREMO
dPuts("\r\n EXIT");
#endif
if( GetDisplayedOSD() & MENU )
DoAction(EXITMENU);
break;
#ifdef SUPPORT_PC
case REMO_AUTO:
#ifdef DEBUG_KEYREMO
dPuts("\r\n AUTO mode adjust for PC input");
#endif
if( GetInputSelection()==PC )
AutoAdjust();
break;
#endif
#ifdef WIDE_SCREEN
case REMO_ASPECT:
#ifdef DEBUG_KEYREMO
dPuts("\r\n Screen Aspect Ratio change to WIDE");
#endif
SetItemValue(WIDESCREEN,UP);
break;
#endif
}
#ifdef PAL_TV
if(ChannelEdit_Flag) {
switch(_RemoDataCode) {
case REMO_TTXRED: ChannelEdit_Move(UP); break;
case REMO_TTXGREEN: ChannelEdit_Move(DN); break;
case REMO_TTXYELLOW: ChannelEdit_Skip(); break;
case REMO_TTXCYAN: ChannelEdit_Edit(); break;
}
}
#endif
#ifdef SUPPORT_DEBUG
switch(_RemoDataCode) {
case REMO_DEBUG: DebugWindowControl(); break;
case REMO_READ: Debug_Read(); break;
case REMO_WRITE: Debug_Write();
Debug_Read(); // Read back
break;
}
#endif
return 1;
}
BYTE CheckKeyIn(void)
{
BYTE ret=1, ikey;
// if( (ikey = keyIn()) ) {
if( (ikey = GetKey(1)) ) {
#ifdef DEBUG
switch (ikey) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -