drv_usart.h 686 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef DRV_USART1_H
  2. #define DRV_USART1_H
  3. #define TX_BUFFER_SIZE 256//128
  4. #define RX_BUFFER_SIZE 256//128
  5. #define UART_0_IDAR (0)
  6. #define USART_0_BAUND (USART_BAUND)
  7. extern DELAY_COMMON uart1_tout;
  8. __inline void Uart1_Time_Out(void)
  9. {
  10. //uart1
  11. if(uart1_tout.set)
  12. {
  13. if(uart1_tout.count)
  14. uart1_tout.count--;
  15. else
  16. {
  17. g_event |= RS485_RECEIVE_END_EVENT;
  18. uart1_tout.set = 0;
  19. uart1_tout.count = 0;
  20. }
  21. }
  22. }
  23. unsigned char CheckSum(unsigned char *dat, unsigned char num);
  24. void Usart1_Initial(void);
  25. int8_t Send_Data_RS485(uint8_t*data,uint16_t size);
  26. uint16_t Get_RS485_Data(uint8_t * dbuf,uint16_t dbuf_len);
  27. #endif