#ifndef		__GPS_H_
#define		__GPS_H_
/*H******************************************************************************
* NAME:         GPSConnect.h
*********************************************************************************/

typedef union
{
  u8 Buff[50]; //ModBus寄存器组
	__packed struct 
	{
		u8  GPSNum : 8;
    u8  Cmd      : 8;
	  u8  Len      : 8;
		u16 OHi      : 16;
		u16 OHd      : 16;
		u16 Crc      : 16;
   }Register;
	__packed struct 
	{
		u8  GPSNum   : 8;
    u8  Cmd      : 8;
		u16 Addr     : 16;
		u16 Dat      : 16;
		u16 Crc      : 16;
   }Register_W;
}GPS_RX_Buff_Type;	
	
typedef enum
{
	Edle,
	Bluetooth ,
	GPS  ,
}USARTDriveItem;
//******************************************************************************
//硬件定义

#define GPSCount_TX_DMAAddrSet(x) (DMA2_Stream6->M0AR = x)      //设置流量计发送缓存地址
#define GPSCount_TX_DMALenSet(x)  (DMA2_Stream6->NDTR = x)     //设置流量计DMA发送长度
#define GPSCount_TX_DMAStart()    DMA_Cmd(DMA2_Stream6,ENABLE) ;GPSConnectTXTask_Flag = 0; //开启流量计DMA发送
#define GPSCount_TX_DMAStop()     DMA_Cmd(DMA2_Stream6,DISABLE) //关闭流量计DMA发送

#define GPSCount_RX_DMAAddrSet(x) (DMA2_Stream1->M0AR = x)      //设置流量计接收缓存地址
#define GPSCount_RX_DMALenSet(x)  (DMA2_Stream1->NDTR = x)     //设置流量计DMA接收
#define GPSCount_RX_DMAStart()    DMA_Cmd(DMA2_Stream1,ENABLE)  //开启流量计DMA接收
#define GPSCount_RX_DMAStop()     DMA_Cmd(DMA2_Stream1,DISABLE) //关闭流量计DMA接收
extern volatile u8 GPSConnectTXTask_Flag;//
extern void GPSConnect_DMATX_IRQHandler(void);
extern void GPSConnect_DMARX_IRQHandler(void);
extern u16 mystrstr(u8 *s1,u8 *s2);
extern void StringToHex(u8 *Str,u8 *H,u8 Len);
extern u16 CRC_Check(u8 *puchMsg, u16 usDataLen) ;
extern u16 BigToLittle( u16 BigData);
extern void GPSConnect_Init(void);	
extern void GPSConnect_USART_Configuration(u32 BaudRate);
extern void GPSConnectTast(void);
#endif	//#ifndef		
