Checksum Class Reference

#include <RobotAPI/drivers/WeissHapticSensor/Checksum.h>

Static Public Member Functions

static unsigned short Crc16 (unsigned char *data, unsigned int size)
 Calculates the CRC16 checksum of an array by using a table.
 
static unsigned short Update_crc16 (unsigned char *data, unsigned int size, unsigned short crc)
 Calculates the CRC16 checksum of an array by using a table.
 

Member Function Documentation

◆ Crc16()

unsigned short Crc16 ( unsigned char * data,
unsigned int size )
static

Calculates the CRC16 checksum of an array by using a table.

The crc16 polynomial is 0x1021 ( x^16 + x^12 + x^5 + 1 ). This function takes 0xffff as initial value.

Note: The checksum generated by this function is NOT according to CCITT standard!

Parameters
*dataPoints to the byte array from which checksum should be calculated
sizeSize of the byte array
Returns
CRC16 checksum

◆ Update_crc16()

unsigned short Update_crc16 ( unsigned char * data,
unsigned int size,
unsigned short crc )
static

Calculates the CRC16 checksum of an array by using a table.

The crc16 polynomial is 0x1021 ( x^16 + x^12 + x^5 + 1 ).

Note: The checksum generated by this function is NOT according to CCITT standard!

Parameters
*dataPoints to the byte array from which checksum should be calculated
sizeSize of the byte array
crcValue calculated over another array and start value of the crc16 calculation
Returns
CRC16 checksum

The documentation for this class was generated from the following files: