📄 key.h
字号:
//----------------------------------------------------------------------------------------------------
// ID Code : Key.h No.0000
// Update Note :
//
//----------------------------------------------------------------------------------------------------
//--------------------------------------------------
// Definitions of Key Repeat Start Time (Unit in sec)
//--------------------------------------------------
#define _KEY_REPEAT_START_TIME 0.35//0.5
//--------------------------------------------------
// Definitions of Key Mask
//--------------------------------------------------
#if (_PCB_TYPE == _PCB_PTX23A21)
#define _POWER_KEY_MASK 0x01
#define _MENU_KEY_MASK 0x02
#define _RIGHT_KEY_MASK 0x04
#define _LEFT_KEY_MASK 0x08
#define _EXIT_KEY_MASK 0x10
#define _UP_KEY_MASK 0x20
#define _DOWN_KEY_MASK 0X40
#define _IR_KEY_MASK 0x80
#define _POWER_RIGHT_KEY_MASK (_POWER_KEY_MASK | _RIGHT_KEY_MASK)
#define _POWER_MENU_KEY_MASK (_POWER_KEY_MASK | _MENU_KEY_MASK)
#define _POWER_LEFT_RIGHT_KEY_MASK (_POWER_KEY_MASK | _LEFT_KEY_MASK | _RIGHT_KEY_MASK)
//--------------------------------------------------
// Definitions of Key Message
//--------------------------------------------------
#define _MENU_KEY_MESSAGE 0
#if (_CUSTOM_TYPE == _CUSTOM_HAOZHEN)
#define _RIGHT_KEY_MESSAGE 1
#define _LEFT_KEY_MESSAGE 2
#else
#define _RIGHT_KEY_MESSAGE 2
#define _LEFT_KEY_MESSAGE 1
#endif
#define _EXIT_KEY_MESSAGE 3
#define _5_KEY_MESSAGE 4
#define _6_KEY_MESSAGE 5
#define _7_KEY_MESSAGE 6
#define _NONE_KEY_MESSAGE 7
#define _KEY_AMOUNT 4
#elif ( _PCB_TYPE == _PCB_PV013BA1 || \
_PCB_TYPE == _PCB_RIGHTECH_A || \
_PCB_TYPE == _PCB_PV023BC1 ||\
_PCB_TYPE==_PCB_JIALUHUA)
#define _POWER_KEY_MASK 0x01 // Power
#define _MENU_KEY_MASK 0x02 // Menu
#define _RIGHT_KEY_MASK 0x04 // Right
#define _LEFT_KEY_MASK 0x08 // Left
#define _UP_KEY_MASK 0x20//////////////////////
#define _DOWN_KEY_MASK 0x28 ///////////////////
#if (_SOURCE_KEY_TYPE == _SOURCE_KEY_ONEKEY)
#define _SOURCE_KEY_MASK 0x10 // source
#define _EXIT_KEY_MASK 0X40 // unuse
#endif
#if (_SOURCE_KEY_TYPE == _SOURCE_KEY_MULTIKEY)
#define _VIDEO1_KEY_MASK 0x10 // source
#define _VIDEO2_KEY_MASK 0X20 // unuse
#endif
#if (_SOURCE_KEY_TYPE == _SOURCE_KEY_MIXKEY)
#define _SOURCE_KEY_MASK 0x10 // source switch by IR
#define _VIDEO1_KEY_MASK 0x20 // source switch by keypad V1
#define _VIDEO2_KEY_MASK 0X40 // source switch by keypad V2
#define _EXIT_KEY_MASK 0X100 // unuse
#endif
#define _IR_KEY_MASK 0x80 // IR
#define _POWER_RIGHT_KEY_MASK (_POWER_KEY_MASK | _RIGHT_KEY_MASK)
#define _POWER_MENU_KEY_MASK (_POWER_KEY_MASK | _MENU_KEY_MASK)
#define _POWER_LEFT_RIGHT_KEY_MASK (_POWER_KEY_MASK | _LEFT_KEY_MASK | _RIGHT_KEY_MASK)
//--------------------------------------------------
// Definitions of Key Message
//--------------------------------------------------
#define _MENU_KEY_MESSAGE 0
#define _LEFT_KEY_MESSAGE 1
#define _RIGHT_KEY_MESSAGE 2
#define _EXIT_KEY_MESSAGE 5 // 3///
#if (_SOURCE_KEY_TYPE == _SOURCE_KEY_ONEKEY)
#define _SOURCE_KEY_MESSAGE 4
#define _7_KEY_MESSAGE 5
#define _NONE_KEY_MESSAGE 6
#define _KEY_AMOUNT 4
#endif //end of #if (_SOURCE_KEY_TYPE == _SOURCE_KEY_ONEKEY)
#if (_SOURCE_KEY_TYPE == _SOURCE_KEY_MULTIKEY)
#define _VIDEO1_KEY_MESSAGE 4
#define _VIDEO2_KEY_MESSAGE 5
#define _7_KEY_MESSAGE 6
#define _NONE_KEY_MESSAGE 7
#define _KEY_AMOUNT 4
#endif //end of #if (_SOURCE_KEY_TYPE == _SOURCE_KEY_MULTIKEY)
#if (_SOURCE_KEY_TYPE == _SOURCE_KEY_MIXKEY)
#define _SOURCE_KEY_MESSAGE 4
#define _VIDEO1_KEY_MESSAGE 5
#define _VIDEO2_KEY_MESSAGE 6
#define _NONE_KEY_MESSAGE 7
#define _KEY_AMOUNT 4
#endif //end of #if (_SOURCE_KEY_TYPE == _SOURCE_KEY_MIXKEY)
#endif
//-------------------------------------------------
// Definitions of OSD process
//-------------------------------------------------
#define _SELECTED_MESSAGE 0
#define _ITEM_UP_MESSAGE 1
#define _ITEM_DOWN_MESSAGE 2
#define _VALUE_UP_MESSAGE 3
#define _VALUE_DOWN_MESSAGE 4
#define _EXIT_MESSAGE 5
#define _SWITCH_MESSAGE 6
#define _IR_MESSAGE 7
#define _NONE_MESSAGE 8
#define _MESSAGE_AMOUNT 8
//----------------------------------------------------------------------------------------------------
#ifdef __KEY__
//--------------------------------------------------
// Global Variables
//--------------------------------------------------
BYTE idata ucKeyControl;
BYTE idata ucKeyMessage;
BYTE idata ucKeyStatePrev;
BYTE idata ucKeyStateCurr;
WORD idata usKeyMenuDelay = 0;
WORD idata usKeyLRDelay = 0;
//--------------------------------------------------
// Function Prototypes
//--------------------------------------------------
void CKeyHandler(void);
void CKeyCheckPowerKey(void);
void CKeyInitial(void);
bit CKeyScanReady(void);
void CKeyScanReadyTimerEvent(void);
void CKeyRepeatEnableTimerEvent(void);
void CKeyMessageConvert(BYTE ucKeyMask, BYTE ucKeyMsg);
BYTE CKeyScan(void);
void CKeyPowerKeyMix(void);
bit CKeyPowerKeyProc(void);
void CKeyMessageProc(void);
bit CKeySourceKeyProc(void);
#else
//--------------------------------------------------
// Extern Global Variables
//--------------------------------------------------
extern BYTE idata ucKeyControl;
extern BYTE idata ucKeyMessage;
extern WORD idata usKeyMenuDelay;
extern WORD idata usKeyLRDelay;
//--------------------------------------------------
// Extern Function Prototypes
//--------------------------------------------------
extern void CKeyHandler(void);
extern void CKeyCheckPowerKey(void);
extern void CKeyInitial(void);
extern bit CKeySourceKeyProc(void);
extern void CKeyRepeatEnableTimerEvent(void);
//x.hu, for source switch
extern BYTE CSourceGetNext(void);
#endif
//----------------------------------------------------------------------------------------------------
//--------------------------------------------------
// Macro of Key Scan Ready Flag
//--------------------------------------------------
#define GET_KEYSCANREADY() ((bit)(ucKeyControl & _BIT0))
#define SET_KEYSCANREADY() (ucKeyControl |= _BIT0)
#define CLR_KEYSCANREADY() (ucKeyControl &= ~_BIT0)
//--------------------------------------------------
// Macro of Key Scan Start Flag
//--------------------------------------------------
#define GET_KEYSCANSTART() ((bit)(ucKeyControl & _BIT1))
#define SET_KEYSCANSTART() (ucKeyControl |= _BIT1)
#define CLR_KEYSCANSTART() (ucKeyControl &= ~_BIT1)
//--------------------------------------------------
// Macro of Key Repeat Start
//--------------------------------------------------
#define GET_KEYREPEATSTART() (bit)(ucKeyControl & _BIT2)
#define SET_KEYREPEATSTART() ucKeyControl |= _BIT2
#define CLR_KEYREPEATSTART() ucKeyControl &= ~_BIT2
//--------------------------------------------------
// Macro of Key Repeat Function Enable
// If you want to use repeat function, please set this flag. If not, please clear it.
//--------------------------------------------------
#define GET_KEYREPEATENABLE() (bit)(ucKeyControl & _BIT3)
#define SET_KEYREPEATENABLE() ucKeyControl |= _BIT3
#define CLR_KEYREPEATENABLE() ucKeyControl &= ~_BIT3
//----------------------------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -