console.h 928 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * uart_util.h
  3. *
  4. * Created on: 2025年7月30日
  5. * Author: wulianwei
  6. */
  7. #ifndef UITL_UART_UTIL_H_
  8. #define UITL_UART_UTIL_H_
  9. #define UART_RECV_SIZE 1024 //
  10. typedef enum recv_status_en
  11. {
  12. REV_WAIT,//接收未完成
  13. REV_OK //接收完成
  14. } recv_status_e;
  15. recv_status_e recv_status;
  16. typedef struct uart_recv_st
  17. {
  18. unsigned char buf[UART_RECV_SIZE]; //缓存大小
  19. unsigned int len; //接收长度
  20. recv_status_e recv_flag; //接收完成标志
  21. char* start_addr; //字符开始地址
  22. } uart_recv_t; //串口接收缓存
  23. void ConsoleDeviceInit(void);
  24. unsigned int ConsolePuts(char *pTxBuffer, int numBytesToWrite);
  25. void ConsolePrintf(char *fmt,...);
  26. void LogPrintf(const char *pcString, ...);
  27. void ConsoleRecvFill(unsigned char data);
  28. void ConsoleRecvClear();
  29. void ConsoleRecvWait(int timeout);
  30. recv_status_e ConsoleRecvFlag();
  31. unsigned char* ConsoleRecvData();
  32. int ConsoleRecvLen();
  33. #endif /* UITL_UART_UTIL_H_ */