ATMEL MCU用于MP3播放系统的控制源代码程序
源代码在线查看: key_drv.h
/*H**************************************************************************
* NAME: kbd_drv.h
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE: snd1c-refd-nf-4_0_3
* REVISION: 1.8
*----------------------------------------------------------------------------
* 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 */
/*----- Key Definition -----*/
#define KEY_3 0x08
#define KEY_2 0x04
#define KEY_1 0x02
#define KEY_0 0x01
#define NO_KEY 0x00
/*----- Macro-command -----*/
#define KEY_PLAY 0x10
#define KEY_NEXT 0x11
#define KEY_PREV 0x12
#define KEY_INC 0x13
#define KEY_DEC 0x14
#define KEY_SOUND 0x15
#define KEY_PARENT 0x16
#define KEY_PAUSE 0x17
#define KEY_REPEAT 0x18
#define KEY_STOP 0x19
#define KEY_BASS 0x20
#define KEY_NOBASS 0x21
/*_____ D E F I N I T I O N ________________________________________________*/
#define MP3_PLAY_MODE ((Byte)0)
#define MP3_VOL_MODE ((Byte)1)
#define MP3_BASS_MODE ((Byte)2)
#define MP3_MED_MODE ((Byte)3)
#define MP3_TRE_MODE ((Byte)5)
#define MP3_OTHER_MODE ((Byte)6)
/*_____ 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_mask_int() (KBCON |= 0x0f)
#define Kbd_unmask_int() (KBCON &= 0xf0)
#define Kbd_low_int() (KBCON &= 0x0f)
#define Kbd_high_int() (KBCON |= 0xf0)
#define Kbd_enable_pd_exit() (KBSTA |= MSK_KPDE)
#define Kbd_disable_pd_exit() (KBSTA &= ~MSK_KPDE)
#define Kbd_key_pressed() ((KBSTA & 0x0f) != 0)
#define Kbd_key_locked() 1//(LOCK_ROW == 0)
void kbd_task_init (void);
void key_task(void);
#endif /* _KBD_DRV_H_ */