Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
flockwave-gps / gps / ubx / utils.py
Size: Mime:
from typing import Sequence, Union


def calculate_ubx_checksum(data: Union[bytes, 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])