#ifndef _MAIN_H_
#define _MAIN_H_

#ifdef _MAIN_C_
#define _MAIN_C_
#else
#define _MAIN_C_		extern
#endif
/**********************************************************************/


#define cTx_Statue			0X10 //


//-----------------------------------------------------------------------------
// 变量声明
//-----------------------------------------------------------------------------


uint8 D_value[5];
uint8 Tx_Rx_Choice_Bak;
uint8 Tx_phase;
uint8 Contbak;
uint8 Sx1276Statue;
uint8 SX1276_GetStatue_Cout;
uint8 ContBak=0xff;
uint8 Sx1276VerNO ;
uint8 TxTimeCout;
uint8 Trg;
uint8 Cont;
uint8 gz8_RXbuffer[85];
uint8 KeyScanCnt;	
uint8 Chargcout;
uint8 Tx_TimeCout;
uint8 Rx_phase;
uint8 RxPakCout;
uint8 PER_phase;
UU16  PacketNuNow;
UU16  PacketNuStart;
uint8 PER;
uint8 RxPacketCout;
uint8 PER_phase;
UU16  PacketNuNow;
UU16  PacketNuStart;
uint8 PER;
uint8 RxPacketCout;
//uint8 Flg_RxFinish;

uint8 Rf_phase;
int16 Rssi=0;
uint8 Uart_count=0;
uint8 Flg_1=0;
uint8 Flg_2=0;
uint8 Flg_2_1=0;
const uint8 PingMsg[] = "PING";
const uint8 PongMsg[] = "PONG";
u8 Uart_Buffer[] = "haha";
extern u8  gb_RxData[254]; //Receive data buffer

__root const u8  cPerStart[] = {"--------StartCout PER--------\x0D\x0A"};
__root const u8  cPERDON[] = {"PER DON..."};
__root const u8  cGET[] = {"Rec_Packet:"};
__root const u8  cLost[] =  {"    Lost_Packet:"};
__root const u8  cToatl[] = {"    Toatl_Packet:"};
__root const u8  cPer[] =  {"    PER="};
__root const u8  cRssi[] =  {"    Rssi="};
__root const u8  cdBm[] =  {" dBm"};



union 
  {
    unsigned char Flg;
    struct
      {unsigned char  Flg_S_BW10:1,
                      Flg_S_BW62:1,
                      Flg_S_BW125:1,
                      Flg_S_FSK :1,
                      Flg_S_Tx_Rx:1, //LSB
                      Flg_SX1276_RXorTX:1,
                      Flg_RFSleep:1,
                      Flg_RFDown:1;
       };
  };

typedef enum
{
	SetTx_Parameters,		// 接收模式光标PER_phase
	Write_FIFO_AndTx,		// 设置模式光标
	Wait_Tx_Finish,
	Wait_NextTx,
        Rx_Parameters_Set,		
	Wait_RxFinish		
}TX_STATE;

typedef enum
{
	PerStart,		
	PerGoOn,
	PerDone//
}PER_PHASE;

//-----------------------------------------------------------------------------
// 子程序声明
//-----------------------------------------------------------------------------
#endif
