multihid firmware

This commit is contained in:
Devaev Maxim
2020-11-19 23:28:23 +03:00
parent 188de71515
commit a77db72355
17 changed files with 636 additions and 379 deletions

View File

@@ -67,7 +67,7 @@ class _SpiPhyConnection(BasePhyConnection):
assert request[0] == 0x33
deadline_ts = time.monotonic() + self.__read_timeout
dummy = b"\x00" * 8
dummy = b"\x00" * 10
while time.monotonic() < deadline_ts:
if bytes(self.__xfer(dummy)) == dummy:
break
@@ -81,15 +81,15 @@ class _SpiPhyConnection(BasePhyConnection):
deadline_ts = time.monotonic() + self.__read_timeout
found = False
while time.monotonic() < deadline_ts:
for byte in self.__xfer(b"\x00" * (5 - len(response))):
for byte in self.__xfer(b"\x00" * (9 - len(response))):
if not found:
if byte != 0x33:
if byte == 0:
continue
found = True
response.append(byte)
if len(response) == 4:
if len(response) == 8:
break
if len(response) == 4:
if len(response) == 8:
break
else:
get_logger(0).error("SPI timeout reached while responce waiting")