Guide
crc ^= code;
}
return crc;
}
JavaScript
function createCRC(data, size) {
let crc = 0;
for (let i = 0; i < size; ++i) {
let code = crc >>> 8 & 0xFF;
code ^= data[i] & 0xFF;
code ^= code >>> 4;
crc = crc << 8 & 0xFFFF;
crc ^= code;
code = code << 5 & 0xFFFF;
crc ^= code;
code = code << 7 & 0xFFFF;
crc ^= code;
}
return crc;
}
Receiving packets
Here is the process for reading the raw serial byte stream and identifying packets. Once a packet has been successfully
read it can be processed based on its command ID.
LW24/C/RS microLiDARâ„¢ sensor - Product guide | Version 0 | 03 March 2022 Page 22 of 38