?? keyboard16.c
字號:
#include "..\startup\44b.h"#include "..\inc\def.h"#include "..\inc\Keyboard16.h"U16 FunctionKey=0xffff;//功能鍵掃描嗎,0有效U8 keyBoard_KeyMap[]={1,4,7,10,2,5,8,0,3,6,9,11,12,13,14,15};//10-退格,11-*/.,12-↑,13-↓,14-確定,15-取消;U16 GetScanKey(){ U16 key; U32 i,temp; for(i=1;i<0x10;i<<=1){ rPDATE|=0xf0; rPDATE&=~(i<<4); key<<=4; Delay(1); temp=rPDATC; key|=(temp&0xf); } return key;}U32 GetKey(){ int i; U16 key,tempkey=1; static U16 oldkey=0xffff; static U8 keystatus=0; U8 keycnt=0; U32 temp; while(1){ key=0xffff; while(1){ key=GetScanKey(); if((key&FunctionKey)!=FunctionKey)//有按鍵按下 break; Delay(200); oldkey=0xffff; } //Delay(800); Delay(500); if(key!=GetScanKey()) continue; if(oldkey!=key){ keystatus=0; } if(keystatus==0){ //第一次按下此鍵 keycnt=0; keystatus=1; } else if(keystatus==1){ //第二次重復此鍵 keycnt++; if(keycnt==20) keystatus=2; else continue; } oldkey=key; break; } for(i=0;i<16;i++){ //查找按鍵,不包括功能鍵 if((key&tempkey)==0 && (FunctionKey&tempkey)!=0) break; tempkey<<=1; } temp=~(key|FunctionKey); return (temp<<16)|keyBoard_KeyMap[i];}void SetFunctionKey(U16 Fnkey) //設定功能鍵掃描碼,1有效 比如ctrl alt{ FunctionKey&=~Fnkey;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -