📄 get_keys.h
字号:
#define TRUE 1
#define FAULSE 0
uchar key=0;
uchar scan;
/**********************delay*********************************/
void delay(void)
{
int l;
char m;
for (l=0;l<10;l++)
for (m=0;m<1;m++);
}
/****************check if any key pressed*********************/
bit CheckState(void)
{
bit state=0;
P3=0x0F; //scan key
if(P3!=0x0F)state=TRUE; //check if any key pressed
else state=FAULSE;
return(state);
}
/****************** check which key pressed*****************/
uchar GetKeys(void)
{
uchar column,line;
scan=0xFE;
while((scan&0x10)!=0)
{
P3=scan;
if((P3&0xF0)!=0xF0) //current line have key pressed
{
column=~(P3|0x0F);
line=~(scan|0xF0);
key=column+line;
return(key); //return the location of the
//key which is pressed
}
else scan=(scan<<1)|0x01; //if the pressed key is not on the
//current line, scan next line
}
return(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -