MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / crc16

Function crc16

cpp/src/command_classes/CRC16Encap.cpp:41–52  ·  view source on GitHub ↗

CRC-CCITT (0x1D0F)

Source from the content-addressed store, hash-verified

39// CRC-CCITT (0x1D0F)
40//
41uint16 crc16(uint8 const * data_p, uint32 const _length){
42 uint8 x;
43 uint16 crc = 0xF6AF; // 0x1D0F with first byte 0x56;
44 uint32 length = _length;
45
46 while (length--){
47 x = crc >> 8 ^ *data_p++;
48 x ^= x>>4;
49 crc = (crc << 8) ^ ((uint16)(x << 12)) ^ ((uint16)(x <<5)) ^ ((uint16)x);
50 }
51 return crc;
52}
53
54enum CRC16EncapCmd
55{

Callers 1

HandleMsgMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected