Repository URL to install this package:
|
Version:
5.0.1 ▾
|
from typing import Sequence
def calculate_ubx_checksum(data: Sequence[int], offset: int = 2) -> bytes:
"""Calculates the checksum of a UBX packet."""
a, b = 0, 0
size = len(data)
for i in range(offset, size):
a += data[i]
b += a
return bytes([a & 0xFF, b & 0xFF])