98 crc_table = _crc_table;
99 initial_value = _initial_value;
100 current_crc = initial_value;
106 current_crc = ( (current_crc & 0xFF00) >> 8 ) ^ crc_table[ ( current_crc & 0x00FF ) ^ (byte & 0x00FF)];
113 for (
int i=0; i<nb_bytes; i++ )
114 current_crc = ( (current_crc & 0xFF00) >> 8 ) ^ crc_table[ ( current_crc & 0x00FF ) ^ (bytes[i] & 0x00FF)];
127 return current_crc & 0x00ff;
133 return (current_crc >> 8) & 0x00ff;
139 current_crc = initial_value;
156 :
cCRC( crc_table_dsacon32m, 0xffff )
uint8_t UInt8
unsigned integer, size 1 Byte (8 Bit)
cCRC(tCRCValue const *_crc_table, tCRCValue _initial_value)
constructor: create a new cCRC object and initialize the current value of the CRC checksum...
NAMESPACE_SDH_START typedef UInt16 tCRCValue
the data type used to calculate and exchange CRC values with DSACON32m (16 bit integer) ...
tCRCValue current_crc
current value of the CRC checksum
cCRC_DSACON32m(void)
constructor to create a cCRC object suitable for checksumming the communication with a DSACON32m tact...
#define NAMESPACE_SDH_START
tCRCValue initial_value
initial value of the CRC checksum
UInt8 GetCRC_HB()
return the high byte of the current CRC value
tCRCValue const * crc_table
table with precalculated CRC values
tCRCValue Reset()
reset the current CRC value to its initial value and return it;
tCRCValue AddBytes(unsigned char *bytes, int nb_bytes)
insert nb_bytes from bytes into CRC calculation and return the new current CRC checksum ...
A derived CRC class that uses a CRC table and initial value suitable for protecing the binary communi...
#define NAMESPACE_SDH_END
This file contains settings to make the SDHLibrary compile on differen systems:
cCRC_SDH(void)
constructor to create a cCRC object suitable for checksumming the binary communication with SDH ...
A derived CRC class that uses a CRC table and initial value suitable for the Weiss Robotics DSACON32m...
tCRCValue GetCRC()
return the current CRC value
This file contains some basic definitions (defines, macros, datatypes)
tCRCValue AddByte(unsigned char byte)
insert byte into CRC calculation and return the new current CRC checksum
UInt8 GetCRC_LB()
return the low byte of the current CRC value
uint16_t UInt16
unsigned integer, size 2 Byte (16 Bit)
Cyclic Redundancy Code checker class, used for protecting communication against transmission errors...