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

📄 dual_key.h

📁 realtek LCD monitor, TV开发源代码
💻 H
字号:
//**********************************************************************************************************
//  The  Software  is  proprietary,  confidential,  and  valuable to Realtek Semiconductor
//  Corporation  ("Realtek").  All  rights, including but not limited  to  copyrights,
//  patents,  trademarks, trade secrets, mask work rights, and other similar rights and interests,
//  are reserved to Realtek. Without  prior  written  consent  from  Realtek,  copying, reproduction,
//  modification,  distribution,  or  otherwise  is strictly prohibited. The Software  shall  be
//  kept  strictly  in  confidence,  and  shall  not be  disclosed to or otherwise accessed by
//  any third party. @ <2003> - <2008>   The Software is provided "AS IS" without any warranty of any kind,
//  express, implied, statutory or otherwise.
//**********************************************************************************************************
//----------------------------------------------------------------------------------------------------
// ID Code      : Key.h No.0000
// Update Note  :
//----------------------------------------------------------------------------------------------------
//#if(_OSD_TYPE == _DUAL_OSD)
//--------------------------------------------------
// Definitions of Key Repeat Start Time (Unit in sec)
//--------------------------------------------------
#define _KEY_REPEAT_START_TIME      0.5

//--------------------------------------------------
// Definitions of Key Mask
//--------------------------------------------------
#define _POWER_KEY_MASK             0x01
#define _ENTER_KEY_MASK             0x02
#define _RIGHT_KEY_MASK             0x04
#define _LEFT_KEY_MASK              0x08
#define _AUTO_KEY_MASK              0x20
#define _EXIT_KEY_MASK              0x40
#define _INPUT_KEY_MASK             0x10

//#define _KEY6_MASK                  0x40
//#define _KEY7_MASK                  0x80

#define _BURNINOFF_KEY_MASK         (_ENTER_KEY_MASK  | _RIGHT_KEY_MASK)
#define _FACTORY_KEY_MASK           (_POWER_KEY_MASK | _ENTER_KEY_MASK |_EXIT_KEY_MASK)
#define _SERVICE_KEY_MASK           (_POWER_KEY_MASK | _EXIT_KEY_MASK)

//--------------------------------------------------
// Definitions of Key Message
//--------------------------------------------------

#define _ENTER_KEY_MESSAGE          0

#define _LEFT_KEY_MESSAGE           1
#define _RIGHT_KEY_MESSAGE          2

#define _EXIT_KEY_MESSAGE           3
#define _NONE_KEY_MESSAGE           4
#define _AUTO_KEY_MESSAGE           5



//----------------------------------------------------------------------------------------------------

#ifdef __KEY__

//--------------------------------------------------
// Global Variables
//--------------------------------------------------
BYTE xdata ucKeyControl;
BYTE xdata ucKeyMessage;
BYTE xdata ucKeyStatePrev;
BYTE xdata ucKeyStateCurr;



//--------------------------------------------------
// 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);

#if(_TOUCH_SENSOR == _ON)
bit CKeyOneTouchSensorWrite(WORD usAddr, WORD Value);
bit CKeyOneTouchSensorRead(WORD usAddr,  BYTE *pReadArray);
void CKeyOneTouchSensorLedOn(void);
void CKeyOneTouchSensorLedOff(void);
void CKeyBuzzerBeep(void);
#endif


#else

//--------------------------------------------------
// Extern Global Variables
//--------------------------------------------------
extern BYTE xdata ucKeyControl;
extern BYTE xdata ucKeyMessage;


//--------------------------------------------------
// Extern Function Prototypes
//--------------------------------------------------
extern void CKeyHandler(void);
extern void CKeyCheckPowerKey(void);
extern void CKeyInitial(void);
extern void CKeyKeyPadLedControl(void);
#if(_TOUCH_SENSOR == _ON)
extern bit CKeyOneTouchSensorWrite(WORD usAddr, WORD Value);
extern bit CKeyOneTouchSensorRead(WORD usAddr,  BYTE *pReadArray);
extern void CKeyOneTouchSensorLedOn(void);
extern void CKeyOneTouchSensorLedOff(void);
extern void CKeyBuzzerBeep(void);
#endif


#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)



#if(_TOUCH_SENSOR == _ON)

#define _KEY_TOURCH_SENSOR_SLAVE_ADDRESS   0x58
#define _ONE_TOUCH_SENSOR_CR_0000  0x0000
#define _ONE_TOUCH_SENSOR_CR_0001  0x0001
#define _ONE_TOUCH_SENSOR_CR_0002  0x0002
#define _ONE_TOUCH_SENSOR_CR_0004  0x0004
#define _ONE_TOUCH_SENSOR_CR_0008  0x0008
#define _ONE_TOUCH_SENSOR_CR_000E  0x000E
#define _ONE_TOUCH_SENSOR_CR_0010  0x0010
#define _ONE_TOUCH_SENSOR_CR_0011  0x0011
#define _ONE_TOUCH_SENSOR_CR_0012  0x0012
#define _ONE_TOUCH_SENSOR_CR_0013  0x0013
#define _ONE_TOUCH_SENSOR_CR_0014  0x0014
#define _ONE_TOUCH_SENSOR_CR_0015  0x0015
#define _ONE_TOUCH_SENSOR_CR_0022  0x0022
#define _ONE_TOUCH_SENSOR_CR_0023  0x0023
#define _ONE_TOUCH_SENSOR_CR_0024  0x0024
#define _ONE_TOUCH_SENSOR_DR_0106  0x0106
#define _ONE_TOUCH_SENSOR_DR_0107  0x0107
#define _ONE_TOUCH_SENSOR_DR_0108  0x0108
#define _ONE_TOUCH_SENSOR_DR_0109  0x0109
#define _ONE_TOUCH_SENSOR_RESET_0300 0x0300

#endif
//----------------------------------------------------------------------------------------------------
//#endif  //End of #if(_OSD_TYPE == _DUAL_OSD)

⌨️ 快捷键说明

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