console.h 1006 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. void ConsolePutsHexStr(unsigned char *source, unsigned int numBytesToWrite);
  25. unsigned int ConsolePuts(char *pTxBuffer, int numBytesToWrite);
  26. void ConsolePrintf(char *fmt,...);
  27. void LogPrintf(const char *pcString, ...);
  28. void ConsoleRecvFill(unsigned char data);
  29. void ConsoleRecvClear();
  30. void ConsoleRecvWait(int timeout);
  31. recv_status_e ConsoleRecvFlag();
  32. unsigned char* ConsoleRecvData();
  33. int ConsoleRecvLen();
  34. #endif /* UITL_UART_UTIL_H_ */