#define __COMMTX_H
#include "pic.h"
#define _XTAL_FREQ 16000000UL
/////////////////////
typedef unsigned charuchar;
typedef unsigned intuint;
typedef unsigned short intusint;
typedef unsigned longulong;
///////////////////////////////
//#define LED_STEERING RC2
#define PWR_CON RC3
#define PWR_KEY RC7
#define SendIO RC4
#define En_Talk RA3
#define JD_INT RA5
#define JD_CON RA2
#define KEY_OUT0 RB0
#define KEY_OUT1 RB1
#define KEY_OUT2 RB2
#define KEY_OUT3 RB3
#define KEY_OUT4 RB4
#define KEY_IN5 RB5
#define KEY_IN6 RB6
#define KEY_IN7 RB7
///////////////////////////////
#define g_bFirAlmRunEn T0IE
///////////////////////////////
//按鍵值定義
#define KEY_VAL_NULL 0x00
#define KEY_VAL_HOOTER1 0x02 //Hooter1 //0000 0010
#define KEY_VAL_HOOTER2 0x04 //Hooter2 //0000 0100
#define KEY_VAL_AUTO 0x80 //AUTO //1000 0000
#define KEY_VAL_MICRADIO 0x10 //M1 //0001 0000
#define KEY_VAL_MAN 0x30 //M2 //0011 0000
#define KEY_VAL_YELP 0x20 //Yelp //0010 0000
#define KEY_VAL_WAIL 0x40 //Wail //0100 0000
#define KEY_VAL_HILOW 0x50 //Hilow //0101 0000
#define KEY_VAL_TOOL 0x60 //Tool //0110 0000
#define KEY_VAL_Steering 0x08 //SteCh //0000 1000
#define KEY_VAL_LAMP 0x01//燈控 //0000 0001
#define KEY_VAL_TALK 0xaa //TALK
#define KEY_VAL_TALKBACK 0xbb
#define KEY_VAL_RADIO 0xCC //RADDIO
#define key_effect_time 200
///////////////////////////////////////////
void System_Init(void);
void USART_Init(void);
void USART_SendByte(uchar TXData);
uchar GetKey(void);
void Power_Manage(void);
void key_input();
void LampA_Control(void);
void LampB_Control(void);
void KeyDelayTime(uint x);
void Send_byte2();
void KeyCode();
void LampC_Control(void);
void JD_SEND(void);
uchar SendDat;
uchar HORNBuf,SIRENBuf,AUTOBuf,LAMPBuf,ModeBuf,STEERINGBuf,TALKBuf,DatBuf,ToolBuf;
uchar AUTOFlag,STEERINGFlag,LAMPFlag,TALKFlag,RADIOFlag,MICRADIOFlag,MANFlag,ToolFlag;
#endif