/* Computes the CRC checksum for a data buffer.  */
uint8_t AD717X_ComputeCRC8(uint8_t *pBuf, uint8_t bufSize)
/* Computes the CRC checksum for a data buffer.  */
uint8_t AD717X_ComputeCRC8(uint8_t *pBuf, uint8_t bufSize)
{
        uint8_t i   = 0;
        uint8_t crc = 0;
        while(bufSize) {
                for(i = 0x80; i != 0; i >>= 1) {
                        if(((crc & 0x80) != 0) != ((*pBuf & i) != 0)) {
                                crc <<= 1;
                                crc ^= AD717X_CRC8_POLYNOMIAL_REPRESENTATION;
                        } else {
                                crc <<= 1;
                        }
                }
                pBuf++;
                bufSize--;
        }
        return crc;
}