Changes to set up the host python app with uv
This commit is contained in:
@@ -183,7 +183,15 @@ class ResponsePacket:
|
||||
@staticmethod
|
||||
def calculate_crc16(data: bytes) -> int:
|
||||
"""Calculate CRC16-CCITT for data validation."""
|
||||
calculator = crc.Calculator(crc.Crc16.CCITT)
|
||||
# CRC-16-CCITT: polynomial 0x1021, init 0xFFFF
|
||||
calculator = crc.Calculator(crc.Configuration(
|
||||
width=16,
|
||||
polynomial=0x1021,
|
||||
init_value=0xFFFF,
|
||||
final_xor_value=0x0000,
|
||||
reverse_input=False,
|
||||
reverse_output=False
|
||||
))
|
||||
return calculator.checksum(data)
|
||||
|
||||
def to_bytes(self) -> bytes:
|
||||
|
||||
Reference in New Issue
Block a user