CRC16(5287).h 408 B

1234567891011121314151617181920212223242526
  1. /*
  2. * CRC16.h
  3. *
  4. * Created on: 2019. 7. 3.
  5. * Author: parkyj
  6. */
  7. #ifndef CRC16_H_
  8. #define CRC16_H_
  9. #include "main.h"
  10. typedef enum{
  11. CHECKSUM_ERROR = 0,
  12. NO_ERROR
  13. }etError;
  14. uint16_t CRC16_Generate(uint8_t *buf_ptr, int32_t len);
  15. etError CRC16_Check(uint8_t *buf_ptr, int32_t len,uint16_t checksum);
  16. #define POLYNOMIAL 0x131 // P(x) = x^8 + x^5 + x^4 + 1 = 100110001
  17. #endif /* CRC16_H_ */