?? keyboard.c
字號:
#include "..\inc\44b.h"
#include "..\inc\def.h"
#include "Zlg7289.h"
#include "Keyboard.h"
U16 FunctionKey=0xffff;//功能鍵掃描嗎,0有效
U8 keyBoard_KeyMap[]={'7','4','1',0,'N',0,0,0,'8','5','2','0','/',0,0,0,'9','6','3','D','*','-',0,0,'+',0,'E'};
U32 GetKey()
{
while((rPDATG&ZLG7289_KEY));
return Zlg7289_ReadKey();
}
void SetFunctionKey(U16 Fnkey) //設(shè)定功能鍵掃描碼,1有效 比如ctrl alt
{
FunctionKey&=~Fnkey;
}
int IsKeyDown()
{
return (!(rPDATG&ZLG7289_KEY));
}
void GetKey_poll()
{
static int lastkey=0;
static int count=0;
unsigned int key;
if(rPDATG&ZLG7289_KEY){
lastkey=0;
return;
}
if(lastkey==1)
return;
if((key=Zlg7289_ReadKey())==0xff){
lastkey=0;
return;
}
lastkey=1;
Uart_Printf("%c, ",keyBoard_KeyMap[key]);
count++;
if(count==12){
count=0;
Uart_Printf("\n");
}
}
void Key_Test()
{
int index;
Uart_Printf("\nPress the keyboard.\n");
index=Set_UartLoopFunc(GetKey_poll);
Uart_Getch(0);
Clear_UartLoopFunc(index);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -