📄 keyprocess.c
字号:
#pragma interrupt INTTM02 Inter_TM02 //interrupt serve function name
//Inter_TM2.
/*
** Module name: KeyProcess
**
** Description:
** This module processes key value from the remote control reception.
**
** Operation:
** 1. process the key value received;
** 2. transform it to BCD in Chinese or English input method;
** 3. put it respectively to spelling string.
**
*/
#include "MyDefine.h"
#include "MyRemoteReception.h"
//extern sreg Uchar g_RPTCT;
extern bit g_btRPT;
extern bit btkeyPress; //present the status of any keys
extern bit btKeyPressedTooLong;
extern Uchar g_keyFlgCnt;
bit btTwoKeys750ms;
extern bit overTwoKeys750ms;
extern sreg Uchar S_rightKeyCnt;//add new 13
extern sreg Uchar S_leftKeyCnt;
extern sreg Uchar s_dispKeyCnt;
extern sreg Uchar s_enChinKeyCnt;//add new 2
extern sreg Uchar s_capsSwitchKeyCnt;
extern sreg Uchar s_symbolKeyCnt;
extern sreg Uchar S_upKeyCnt;
extern sreg Uchar S_downKeyCnt;
//add new 2
static Uchar s_2ABCkeyCnt;
static sreg Uchar s_preDataCode;
//static bit s_btTM02Start;
//static sreg Uchar s_g_TM02Cnt;
/*
** Function name: Inter_TM02
**
** Description:
** The function is ISR - Interrupt Service Routine of timer2
** interval timer and used for the time when any key is pressed.
**
** Input parameters:
** no
**
** Output parameters:
** no
**
** Return value:
** no
*/
void Inter_TM02()
{
/*
static sreg Uchar s_g_TM02Cnt = 0;
static Uchar s_preKeySymbolCnt;
if((g_keyFlgCnt != 0)&&(g_keyFlgCnt == s_preKeySymbolCnt))
{
s_g_TM02Cnt++;
if(s_g_TM02Cnt >= 250)
{
s_g_TM02Cnt = 0;
btTwoKeys750ms = 1;
}
}
if((g_keyFlgCnt != s_preKeySymbolCnt))
{
s_preKeySymbolCnt = g_keyFlgCnt;
s_g_TM02Cnt = 0;
}
*/
static sreg Uchar s_g_TM02Cnt = 0;
static Uchar s_preKeySymbolCnt;
if((g_keyFlgCnt != s_preKeySymbolCnt))
{
s_preKeySymbolCnt = g_keyFlgCnt;
s_g_TM02Cnt = 0;
//btTwoKeys750ms = 0;
}
if(g_keyFlgCnt == s_preKeySymbolCnt)
{
s_g_TM02Cnt++;
if(s_g_TM02Cnt >= 250)
{
s_g_TM02Cnt = 0;
//s_preDataCode = 0x70;//add new
btTwoKeys750ms = 1;
overTwoKeys750ms = btTwoKeys750ms;
}
}
}
//幈幘幒幆幨 幮鑾紟訋入幍幗if(g_btRMDTSET){..}幹幮
/*
** Function name: getIrKey
**
** Description:
** The function is to obtain key value.
**
** Input parameters:
** dataCode -- the remote input data code
**
** Output parameters:
** no
**
** Return value:
** IR_KEY -- When received the right remote input data code.
** s_preKey -- when repeat code flag comes.
*/
//幈幘幒幆幨 幮鑾紟訋入幍幗if(g_btRMDTSET){..}幹幮
Uchar getIrKey(Uchar dataCode)
{
//be sure to add static sreg as prefix in order to keep the variable
//until the next invocation.
static sreg Uchar s_preDataCode = 0;
static sreg Uchar s_preKey = 0;
static sreg Uchar s_progSelKeyCnt = 0;
static sreg Uchar s_capsSwitchKeyCnt = 0;
static sreg Uchar s_2ABCkeyCnt = 0;
static sreg Uchar s_3DEFkeyCnt = 0;
static sreg Uchar s_4GHIkeyCnt = 0;
static sreg Uchar s_5JKLkeyCnt = 0;
static sreg Uchar s_6MNOkeyCnt = 0;
static sreg Uchar s_7PQRSkeyCnt = 0;
static sreg Uchar s_8TUVkeyCnt = 0;
static sreg Uchar s_9WXYZkeyCnt = 0;
static sreg Uchar s_16_9keyCnt = 0;
static sreg Uchar s_TVAVkeyCnt = 0;
/*
**s_timerFlg - variable which is relevant to key timing
**X X X X X X X X
** | | |__s_timerFlg.0: 幤魩稁瘞稁◣蕩睅器2
** | | 0:
** | | 1:
** | |
** | |____s_timerFlg.1:
** | 0:
** | 1:
** |
** |______s_timerFlg.2:
** 0:
** 1:
*/
//static sreg Uchar s_timerFlg = 0;
Uchar IR_KEY;
//TCE02 = 1; //Timer02 starts.???
//幎幵幱広btkeyPress幬帾幜銕謳畮菐皫
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -