📄 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) //设定功能键扫描码,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);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -