uint16_t calculate_crc (const uint8_t *ptr, uint16_t count);