#ifndef DRV_USART1_H
#define DRV_USART1_H

#define TX_BUFFER_SIZE 256//128
#define RX_BUFFER_SIZE 256//128

#define UART_0_IDAR   (0)
#define USART_0_BAUND    (USART_BAUND)
extern DELAY_COMMON uart1_tout;


__inline void Uart1_Time_Out(void)
{
	//uart1
	if(uart1_tout.set)
	{
		if(uart1_tout.count)
			uart1_tout.count--;
		else
		{
			g_event |= RS485_RECEIVE_END_EVENT;
			uart1_tout.set = 0;
			uart1_tout.count = 0;
		}
	}
}

unsigned char CheckSum(unsigned char *dat, unsigned char num);

void Usart1_Initial(void);

int8_t Send_Data_RS485(uint8_t*data,uint16_t size);


uint16_t Get_RS485_Data(uint8_t * dbuf,uint16_t dbuf_len);



#endif

