keyevent.c
来自「ucOS 模拟环境」· C语言 代码 · 共 152 行
C
152 行
//这个是pc版本
#include "typedef.h"
#include "draw.h"
#ifndef PCVER
#include "skb.h"
#include "lcd.h"
#include "biostest.h"
#else
#include "keydef.h"
#include "keyEvent.h"
#endif
extern Bool HasPCKey();
extern uchar GetPCKey ();
extern void ClearPCKey(void);
/*extern "c"
{
KEYCODE bi_GetKeyEvent( void );
KEYCODE bi_ScanKeyEvent( void );
void bi_ClrKeyEvent( void );
H bi_ChkKeyBuff( void );
void bi_KeyResetCodeOn( H mode );
}
*/
void ClearKey()
{
#ifdef PCVER
ClearPCKey();
#endif
}
//=====================================================================================
// Function Name: uchar GetKey ()
// Purpose :
// Parameter :
// Return : key id
// Remarks : Get a key from queue
// Change Log :
// Author Date Description
// -----------------------------------------------
//=====================================================================================
ulong GetKey (short event)
{
KEYCODE Key;
ulong temp_key;
#ifndef PCVER
while(1)
{
Key = GetKeyEvent(&event);
if(IsInvalidRepeat(Key))
continue;
else
break;
}
Key.D &= 0x0000ffff;
if(!(Key.D & 0x000000ff))
{
Key.D = ((Key.D >> 8) & 0x000000ff);
}
temp_key = Key.D ;
//_Print( "\n%d", Key.D );
#else
extern void SuspendTask(void );
while(1)
{
if(HasPCKey())
{
temp_key = GetPCKey();
ClearKey();
break;
}
SuspendTask();
}
#endif
return temp_key;
}
//======================================================================
// Function : uchar KeyWait (void)
// Parameter: None
// Return : Key value
// Remarks : Reduce the power cousumption, and wait a key
//======================================================================
/*uchar KeyWait (void)
{
uchar Key;
// No Key pressing now.
Key = UCHAR_N1;
Wakeup = 0;
// loop:
while(1)
{
// Disable interrupt.
di();
#ifndef PCVER
AutoTest (AT_READY);
if (GetCoverStatus()==COVER_OFF) Sleep ();
#endif
// Check key buffer, if there is key in it, read it and return.
Key = ReadKey ();
if (Key != 0xff)
break;
// Enable interrupt.
// Halt the microprocessor until interrupts request to wake it.
#ifndef PCVER
if(!IsKeyPressing && !gucTime3Cnt) //---add by zsz for scankey
SYSCR1 = SYSCR1 | 0x02; //Fc/4 6MHz
NOP16();
#endif
halt ();
#ifndef PCVER
di(); //2002.06.28 patch bug that sometimes cover open then halt
NOP16();
SYSCR1 = 0;
Wait100us();
if(Wakeup==1)
{
IsBattLow();
Wakeup = 0;
}
#endif
}
ei ();
// Return key code.
return Key;
}*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?