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

📄 kbd_drv.h

📁 ATMEL 89c51sndc mp3外接硬盘源码
💻 H
字号:
/*H**************************************************************************
* NAME:         kbd_drv.h         
*----------------------------------------------------------------------------
* Copyright (c) 2002 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      snd1c-demo-hdd-0_2_0      
* REVISION:     1.6     
*----------------------------------------------------------------------------
* 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 */

/*----- 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)

#define KBD_REP_MASK    (Byte)0x40
#define KBD_LREP_MASK   (Byte)0x80


/*----- Macro-command -----*/


/*_____ D E F I N I T I O N ________________________________________________*/


/*_____ D E C L A R A T I O N ______________________________________________*/

bit     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_event()         ((KBSTA & MSK_LINE) != 0)
#define Kbd_key_locked()        (LOCK_ROW == 0)


#endif  /* _KBD_DRV_H_ */

⌨️ 快捷键说明

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