hal_uart.h 707 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __hal_uart_H__
  2. #define __hal_uart_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include "main.h"
  7. #ifdef __cplusplus
  8. }
  9. #endif
  10. typedef enum {
  11. UART_T_HEART = 0,
  12. UART_NUM_OF_T,
  13. }UART_T_n;
  14. typedef enum {
  15. UART_R_HEART = 0,
  16. UART_NUM_OF_R,
  17. }UART_R_n;
  18. typedef struct _UART UART_t;
  19. typedef void (*UART_Callback)(UART_t*);
  20. struct _UART{
  21. uint8_t id;
  22. uint8_t cmd;
  23. uint8_t* pDat;
  24. uint8_t datLen;
  25. UART_Callback cb;
  26. struct _UART* next;
  27. };
  28. //void DF_Rx_Regist(DF_t* handle,uint8_t cmd,DF_Callback cb);
  29. int UART_Regist(uint8_t id,uint8_t cmd,UART_Callback cb);
  30. void UART_Send(unsigned char cmd,unsigned char *pDat,unsigned char datLen);
  31. void UART_Process(void);
  32. #endif /* __DF_H */