29 lines
736 B
Python
29 lines
736 B
Python
import struct
|
|
import sys, os
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'pybusmonitor1553')))
|
|
from Grifo_E_1553lib.messages.tws_status_and_targets import TwsStatusAndTargets0102
|
|
|
|
|
|
def dump_message_words(msg):
|
|
b = bytes(msg)
|
|
nwords = len(b)//2
|
|
le = struct.unpack("<%dH" % nwords, b)
|
|
be = struct.unpack(">%dH" % nwords, b)
|
|
print(f"msg len={len(b)} bytes, words={nwords}")
|
|
print("LE words:", [hex(x) for x in le])
|
|
print("BE words:", [hex(x) for x in be])
|
|
return le, be
|
|
|
|
|
|
def main():
|
|
m = TwsStatusAndTargets0102()
|
|
try:
|
|
m.track_priority_01_04.raw = 0x0F
|
|
except Exception:
|
|
pass
|
|
dump_message_words(m)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|