src/main.cpp
uint16_t crc_update(uint16_t crc, uint8_t byte, uint8_t bits)
{
  crc = crc ^ (byte << 8);
  while(bits--)
    if((crc & 0x8000) == 0x8000) crc = (crc << 1) ^ 0x1021;
    else crc = crc << 1;
  crc = crc & 0xFFFF;
  return crc;
}
// Update a CRC16-CCITT with 1-8 bits from a given byte
Update a CRC16-CCITT with 1-8 bits from a given byte
Update a CRC16 - CCITT with 1 - 8 bits from a given byte
uint16_t crc_update(uint16_t crc, uint8_t byte, uint8_t bits)
{
  crc = crc ^ (byte << 8);
  while(bits--)
    if((crc & 0x8000) == 0x8000) crc = (crc << 1) ^ 0x1021;
    else crc = crc << 1;
  crc = crc & 0xFFFF;
  return crc;
}
uint16_t crc_update ( uint16_t crc , uint8_t byte , uint8_t bits ) { crc = crc ^ ( byte << 8 ) ; while ( bits -- ) if ( ( crc & 0x8000 ) == 0x8000 ) crc = ( crc << 1 ) ^ 0x1021 ; else crc = crc << 1 ; crc = crc & 0xFFFF ; return crc ; }
Update a CRC16-CCITT with 1-8 bits from a given byte
Update a CRC16 - CCITT with 1 - 8 bits from a given byte