⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ps2asc.h

📁 单片机与键盘接口程序
💻 H
字号:
#ifndef __PS2ASC_H
#define __PS2ASC_H

#define  KEYMSGNUM	4
//#define PK_HOME         302    
#define PK_BACKSPACE    0x08
#define PK_TAB          0x09
#define PK_CR           0x0d
#define PK_ESC          0x1b

#define PK_DELETE       300     // delete key
#define PK_INSERT       301     // insert key
#define PK_HOME         302     // home key
#define PK_END          303     // end key
#define PK_PGUP         304     // page up
#define PK_PGDN         305     // page down
#define PK_LNUP         306     // line up
#define PK_LNDN         307     // line down
#define PK_LEFT         308     // left arrow
#define PK_RIGHT        309     // right arrow
#define PK_ALT          310     // alt key 
#define PK_CTRL         311     // control key
#define PK_SHIFT        312     // shift key
#define PK_CAPS         313     // caps lock key
#define PK_NUMLOCK      314     // num lock key
#define PK_SCROLLLOCK   315     // scroll lock key

#define PK_F1           400     // F1 function key
#define PK_F2           401     // F2 function key
#define PK_F3           402     // F3 function key
#define PK_F4           403     // F4 function key
#define PK_F5           404     // F5 function key
#define PK_F6           405     // F6 function key
#define PK_F7           406     // F7 function key
#define PK_F8           407     // F8 function key
#define PK_F9           408     // F9 function key
#define PK_F10          409     // F10 function key
#define PK_F11          410     // F11 function key
#define PK_F12          411     // F12 function key

/*--------------------------------------------------------------------------*/
// For ASCII keys, the driver should place the actual key value (i.e. 'a' or
// 'A' in the message.iData member. The key-modifiers are placed in the
// low byte of the PM_KEY message lData member, according to the following
// format:
/*--------------------------------------------------------------------------*/

//#ifndef PHARLAP             
#define KF_RSHIFT 0x01      // right shift
#define KF_LSHIFT 0x02      // left shift
#define KF_SHIFT  0x03      // either shift
#define KF_CTRL   0x04      // control key
#define KF_ALT    0x08      // alt key
#define KF_SCROLL 0x10      // scroll lock
#define KF_NUML   0x20      // num lock
#define KF_CAPS   0x40      // caps lock
#define KF_INS    0x80      // insert
/*#else

// We re-define the control flags for running with ETS so that flag
// translation is done at compile time, rather than shifting at run time.
// These definitions are masks that can be applied to the lData parameter
// of PM_KEY messages to determine control key status.

#define KF_SHIFT  0x10
#define KF_CTRL   0x0c
#define KF_ALT    0x03
#define KF_SCROLL 0x80
#define KF_NUML   0x20
#define KF_CAPS   0x80

#endif
*/
#define ChBit	0x8000
#define ShiftBit	0x4000
#define CapsBit	0x2000
#define FunBit	0x1000

/*--------------------------------------------------------------------------*/
// Note: for mouse messages, if keyboard modifiers are supported, the key
// modifiers are placed in the mouse message iData member. Keyboard modifiers
// are not required in mouse messages unless your application requires them.
/*--------------------------------------------------------------------------*/

//#endif      // SENTRY if

/*--------------------------------------------------------------------------*/
// The following table is used for PC-AT platforms ONLY. For embedded targets
// based on other platforms you can remove or replace this table as required
// for your input device(s). This table is used to convert AT keyboard
// scan codes into the CTG key values defined above.
//
// This table is only pulled in for x86 targets using the keyboard driver
// provided with CTG integration packages for x86 (Win32, DOS, SMX, 
// ThreadX for x86, and PharLap ETS)
/*--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------*/
// PC-AT keyboard scan code to PM_KEY translation table.
/*--------------------------------------------------------------------------*/
//#ifndef INCLUDE_CTG_KEYTABLE        // defined by keyboard driver file(s)

//#define SEND_ALL_KEYS       // turn this on to send all keys, even things
                            // like the SHIFT and CAPSLOCK keys

#define AT_KEYTABLE_LEN   0x90//0x59
//#endif    
//#endif  // NEED_CTG_KEYTABLE if

extern bit gcScodeFlag;

extern void timer0_init(void);
extern int *Scode_gets(void);
#endif //end of __PS2ASC_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -