- refactored
- added claude.md
This commit is contained in:
+5
-4
@@ -1,6 +1,8 @@
|
||||
import struct
|
||||
|
||||
UBX_SYNC_WORD = b'\xb5\x62'
|
||||
from ubx.msg_types import *
|
||||
|
||||
UBX_SYNC_WORD = struct.pack('BB', UBX_SYNC1, UBX_SYNC2)
|
||||
|
||||
def checksum(data: bytes) -> bytes:
|
||||
ck_a = 0
|
||||
@@ -11,14 +13,13 @@ def checksum(data: bytes) -> bytes:
|
||||
|
||||
return struct.pack("BB", ck_a, ck_b)
|
||||
|
||||
def frame_create(_class: int, _id: int, _data: bytes) -> bytes:
|
||||
_sync = b'\xb5\x62'
|
||||
def frame_create(_class: int, _id: int, _data: bytes = b'') -> bytes:
|
||||
_hdr = struct.pack('B', _class)
|
||||
_hdr += struct.pack('B', _id)
|
||||
_hdr += struct.pack('<H', len(_data))
|
||||
_check = checksum(_hdr + _data)
|
||||
|
||||
return _sync + _hdr + _data + _check
|
||||
return UBX_SYNC_WORD + _hdr + _data + _check
|
||||
|
||||
class Hdr:
|
||||
def __init__(self, _class: int, _id: int, _length: int):
|
||||
|
||||
Reference in New Issue
Block a user