HW_UART_ATY.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * @file HW_UART_ATY.h
  3. *
  4. * @param Project DEVICE_GENERAL_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2023 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief Familiar functions of uart for STC51
  20. *
  21. * @version
  22. * - 1_01_221231 > ATY
  23. * -# Preliminary version, first Release
  24. ********************************************************************************
  25. */
  26. #ifndef __HW_UART_ATY_H
  27. #define __HW_UART_ATY_H
  28. #include "INCLUDE_ATY.h"
  29. #include "stdio.h"
  30. // #include "stdlib.h"
  31. // #include "string.h"
  32. /******************************* For user *************************************/
  33. /******************************************************************************/
  34. // #define UART_RX_MAX_LEN (9 + (15 * 4))
  35. #define UART_RX_MAX_LEN (254)
  36. #define PRINTF_RX_MAX_LEN 254
  37. // #define UART_RX_MAX_LEN 16
  38. typedef struct _uartMsgStruct{
  39. uint8_t rx[UART_RX_MAX_LEN];
  40. uint8_t tx;
  41. uint8_t rxCount;
  42. uint8_t txCount;
  43. uint8_t busyFlag;
  44. uint32_t overCount;
  45. uint8_t rcvOverFlag;
  46. } uartMsgStruct;
  47. extern struct _uartMsgStruct uartMsgStruct_t;
  48. void UartInit(void);
  49. void UartSendByte(uint8_t byte);
  50. void UartSendBytes(uint8_t* bytes, uint16_t len);
  51. void UartSendStr(uint8_t* buf);
  52. void UartSendFloat(float dataFloat);
  53. void UartSendFloatStr(float dataFloat);
  54. void UartReceiveProcess(void);
  55. void UartReceiveProcess_User(struct _uartMsgStruct* ptr);
  56. #endif /* __HW_UART_ATY_H */
  57. /******************************** End Of File *********************************/