Skip to content

Commit

Permalink
read32 may return status codes other than 0x0
Browse files Browse the repository at this point in the history
see #25
  • Loading branch information
chaosmaster committed Apr 27, 2021
1 parent 12f1a17 commit 3320fb9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def read32(self, addr, size=1):
self.echo(addr, 4)
self.echo(size, 4)

self.check(self.dev.read(2), to_bytes(0, 2)) # arg check
assert from_bytes(self.dev.read(2), 2) <= 0xff

for _ in range(size):
data = from_bytes(self.dev.read(4), 4)
result.append(data)

self.check(self.dev.read(2), to_bytes(0, 2)) # status
assert from_bytes(self.dev.read(2), 2) <= 0xff

# support scalar
if len(result) == 1:
Expand Down

1 comment on commit 3320fb9

@adelino7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/device.py

Please sign in to comment.