I've got a frame build like this : {0x00, 0x00, 0x00, 0x00, 0x00}.
C# script to calculate crc8
u8 Crc(u8 *buffer, u8 length)
{
u8 crc = 0, idx;
while ( length-- != 0 )
{
crc = crc ^ *buffer++;
for ( idx = 0; idx < 8; ++idx )
{
if ( crc & 0x01 ) crc = (crc >> 1) ^ 0x8C;
else crc >>= 1;
}
}
return crc;
}
can someone show me how to write it correctly in Python?