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
724 B

12 months 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);