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

📄 kb.h

📁 瑞萨M16C编写的模拟PS2主机与标准键盘通讯程序.完整的工程文件,测试可用.
💻 H
字号:
// Keyboard driver prototypes#ifndef __KB_H#define __KB_H#include "machine.h"
#define kb_init ps2_kb_init// Definitions of special charactersenum {  	KB_LAST_REAL_CHAR = 127,											// last "real" (non special) character	KB_INTERRUPT,																	// interrupt received (CTRL+C)	KB_BACKSPACE,																	// backspace	KB_TAB,																				// horizontal tab		KB_PGUP,																			// page up	KB_FIRST_LARGE_MOVEMENT = KB_PGUP,						// first "large movement" command	KB_PGDOWN,																		// page down	KB_HOME,																			// home	KB_END,																				// end	KB_LAST_LARGE_MOVEMENT = KB_END,							// last "large movement" command		KB_CLRLINE,																		// clear line (CTRL+Y)	KB_CMDMODE,																		// switch to command mode (CTRL+Q)	KB_FIND,																			// find text (CTRL+F)	KB_NL,																				// newline			KB_SAVE,																			// save source (CTRL+S)	KB_GOTO,																			// go to line (CTRL+G)			KB_LEFT,																			// go left	KB_FIRST_MOVEMENT = KB_LEFT,									// first basic movement command	KB_RIGHT,																			// go right	KB_UP,																				// go up	KB_DOWN,																			// go down		KB_LAST_MOVEMENT = KB_DOWN,										// last basic movement command		KB_UNKNOWN																		// unknown key};// Next macro will check if a character is a "real" character or an extended one#define KB_IS_REAL_CHAR( x ) ( ( x ) <= KB_LAST_REAL_CHAR )#define KB_IS_SIMPLE_MOVEMENT( x ) ( ( KB_FIRST_MOVEMENT <= ( x ) ) && ( ( x ) <= KB_LAST_MOVEMENT ) )#define KB_IS_LARGE_MOVEMENT( x ) ( ( KB_FIRST_LARGE_MOVEMENT <= ( x ) ) && ( ( x ) <= KB_LAST_LARGE_MOVEMENT ) )#define KB_IS_MOVEMENT( x ) ( KB_IS_SIMPLE_MOVEMENT( x ) || KB_IS_LARGE_MOVEMENT( x ) )// Structure that holds all the functions implemented by the drivertypedef struct _KBDRV_CTX {   u8 ( *waitchar )( void );											// wait for a character and return it  s8 ( *keypressed )( void );										// returns 1 if a key is available, 0 otherwise  u8 ( *getchar )( void );											// get a character (without timeout)} KBDRV_CTX;// Public interface functionsvoid kb_init( KBDRV_CTX * ); 										// initialize the driver
#endif

⌨️ 快捷键说明

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