HW_UART_ATY.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. /******************************* For user *************************************/
  30. /******************************************************************************/
  31. #define UART_RX_MAX_LEN (9 + (15 * 4))
  32. // #define UART_RX_MAX_LEN 16
  33. typedef struct _uartMsgStruct{
  34. uint8_t rx[UART_RX_MAX_LEN];
  35. uint8_t tx;
  36. uint8_t rxCount;
  37. uint8_t txCount;
  38. uint8_t busyFlag;
  39. uint32_t overCount;
  40. } uartMsgStruct;
  41. extern struct _uartMsgStruct uartMsgStruct_t;
  42. void UartInit(void);
  43. void UartSendByte(uint8_t byte);
  44. void UartSendBytes(uint8_t* bytes, uint16_t len);
  45. void UartSendStr(uint8_t* buf);
  46. void UartSendFloat(float dataFloat);
  47. void UartSendFloatStr(float dataFloat);
  48. void UartReceiveProcess(void);
  49. void UartReceiveProcess_User(struct _uartMsgStruct* ptr);
  50. #endif /* __HW_UART_ATY_H */
  51. /******************************** End Of File *********************************/