CRC.h 538 B

1234567891011121314151617181920212223242526272829
  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, int len);
  15. etError CRC16_Check(uint8_t* buf_ptr, int len,uint16_t checksum);
  16. uint8_t STH30_CreateCrc(uint8_t *data, uint8_t nbrOfBytes);
  17. etError STH30_CheckCrc(uint8_t *data, uint8_t nbrOfBytes, uint8_t checksum);
  18. #define POLYNOMIAL 0x131 // P(x) = x^8 + x^5 + x^4 + 1 = 100110001
  19. #endif /* CRC16_H_ */