/*
 * crc.h
 *
 *  Created on: 2020. 8. 3.
 *      Author: parkyj
 */

#ifndef CRC_H_
#define CRC_H_

#include "main.h"

typedef enum{
    CHECKSUM_ERROR = 0,
    NO_ERROR
}etError;

uint16_t CRC16_Generate(uint8_t* buf_ptr, int len);
etError CRC16_Check(uint8_t* buf_ptr, int len,uint16_t checksum);
uint8_t STH30_CreateCrc(uint8_t *data, uint8_t nbrOfBytes);
etError STH30_CheckCrc(uint8_t *data, uint8_t nbrOfBytes, uint8_t checksum);


#define POLYNOMIAL 0x131 // P(x) = x^8 + x^5 + x^4 + 1 = 100110001
#endif /* CRC_H_ */
