You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
655 B

2 years ago
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. /**
  5. * @brief CRC16У
  6. *
  7. * @param puckMsg ָ
  8. * @param usDataLen ݳ(CRC16)
  9. * @return uint16_t
  10. */
  11. uint16_t modbus_gen_crc16(uint8_t *puckMsg, uint8_t usDataLen);
  12. /**
  13. * @brief CRC16Уӵݰ
  14. *
  15. * @param puckMsg ָԤλøCRC16
  16. * @param packetlen ݳ
  17. */
  18. void modbus_pack_crc_to_packet(uint8_t *puckMsg, uint8_t packetlen);
  19. /**
  20. * @brief CRC16У
  21. *
  22. * @param message ָ
  23. * @param length ݳ(CRC16)
  24. * @return true Уɹ
  25. * @return false Уʧ
  26. */
  27. bool modbus_checkcrc16(uint8_t *message, uint8_t length);