📄 kbd_drv.h
字号:
/*H**************************************************************************
* $RCSfile: kbd_drv.h,v $
*----------------------------------------------------------------------------
* Copyright (c) 2002 Atmel.
*----------------------------------------------------------------------------
* RELEASE: $Name: DEMO_FAT_1_9_9 $
* REVISION: $Revision: 1.3 $
* FILE_CVSID: $Id: kbd_drv.h,v 1.3 2002/05/24 09:51:13 njourdan Exp $
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains the keyboard driver definition
*****************************************************************************/
#ifndef _KBD_DRV_H_
#define _KBD_DRV_H_
/*_____ I N C L U D E S ____________________________________________________*/
/*_____ M A C R O S ________________________________________________________*/
/*----- Hardware Definition -----*/
#define P_KBD P1 /* keyboard port P1 */
#define COL2 P1_5 /* col 3 set to 0 */
#define COL1 P1_4
#define COL0 P1_3
#define MSK_PKB ((Byte)0x3F) /* mask for unused bit of P_KBD */
#define MSK_COL ((Byte)0x38) /* mask for columns: 00111000 */
#define MSK_LINE ((Byte)0x07) /* mask for KBSTA lines */
/*----- Standart Keyboard Behavior -----*/
#define KB_STD_LVL ((Byte)0x80) /* level KINL2-KINL0 = 0, others = 1 */
#define KB_STD_MSK ((Byte)0x08) /* mask IT KINM2-KINM0 = 0, others = 1 */
#define KB_STD (KB_STD_LVL | KB_STD_MSK) /* standard keyboard conf. */
#define MSK_STD ((Byte)0xC7) /* mask for columns: 11000111 */
/*----- Locked Keyboard Behavior -----*/
#define KB_LCK_LVL ((Byte)0x40) /* level KINL2 = 1, others = 0 */
#define KB_LCK_MSK ((Byte)0x0B) /* mask IT KINM2 = 0, others = 1 */
#define KB_LCK (KB_LCK_LVL | KB_LCK_MSK) /* locked keyboard conf. */
#define MSK_LCK ((Byte)0xFF) /* locked; mask for columns: 11111111 */
/*----- Key Decoding Mask -----*/
#define NO_KEY ((Byte)0x3F)
#define NK_COL0 ((Byte)0x07)
#define NK_COL1 ((Byte)0x0F)
#define NK_COL2 ((Byte)0x1F)
#define NK_COL3 ((Byte)0x3F)
/*----- Key Definition -----*/
#define KEY_0_0 ((Byte)0x06)
#define KEY_0_1 ((Byte)0x0E)
#define KEY_0_2 ((Byte)0x1E)
#define KEY_0_3 ((Byte)0x3E)
#define KEY_1_0 ((Byte)0x05)
#define KEY_1_1 ((Byte)0x0D)
#define KEY_1_2 ((Byte)0x1D)
#define KEY_1_3 ((Byte)0x3D)
#define KEY_2_0 ((Byte)0x03)
#define KEY_2_1 ((Byte)0x0B)
#define KEY_2_2 ((Byte)0x1B)
#define KEY_2_3 ((Byte)0x3B)
/*----- Macro-command -----*/
/*_____ D E F I N I T I O N ________________________________________________*/
/*_____ D E C L A R A T I O N ______________________________________________*/
void kbd_init (void);
Byte kbd_decode (void);
#define Kbd_enable_int() (IEN1 |= MSK_EKB)
#define Kbd_disable_int() (IEN1 &= ~MSK_EKB)
#define Kbd_enable_pd_exit() (KBSTA |= MSK_KPDE)
#define Kbd_disable_pd_exit() (KBSTA &= ~MSK_KPDE)
#define Kbd_key_pressed() ((KBSTA & MSK_LINE & ~KBCON) != 0)
#endif /* _KBD_DRV_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -