#ifndef __KEY_H
#define __KEY_H	 
#include "sys.h"

#define USE_BUZZER  0

#define POWER_CTRL  PAout(4)
#define KEYPWR  PAin(1)	



#define KE_1  PBin(8)	
#define KE_2  PBin(5)	
#define KE_3  PAin(11)	
#define KE_4  PAin(8)	




#define KEY_1  0x01	
#define KEY_2  0x02	
#define KEY_PWR 0x04	

#define POWER_ON  	POWER_CTRL=1
#define POWER_OFF		POWER_CTRL=0


#define	KEYDOWNMINTIME		10000	//短按键时间1s
#define	KEYDOWNLONGTIME		30000	//长按键3s

#define		KEYUNKNOW			0 	//按键状态
#define		KEYSHORTDOWN	1
#define		KEYLONGDOWN		2



extern volatile u8 KEY_TYPE;//按键标志
extern volatile u8 KEY_STATE;//按键状态
extern volatile u8 KEY_Mark;//标记



u8 Power_ON(void);	//按键开机检测
void KEY_Init(void);	
void KEY_NVIV_Init(void); //中断初始化
void Key_Scan(void);
void Change_Mode(void);

void KE_IO_Init(); //拨码开关

#endif
