summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorBert Vermeulen <bert@biot.com>2012-01-08 20:01:53 +0100
committerBert Vermeulen <bert@biot.com>2012-01-08 20:01:53 +0100
commit84b81f1df5a51285e55d808fdfb7968cd70711e9 (patch)
tree1dac779dd147b6efc1e7f15ca31ec1eb6bc15526 /decoders
parent983cb0f5b49167328864d0878148a7407becd1c0 (diff)
downloadlibsigrokdecode-84b81f1df5a51285e55d808fdfb7968cd70711e9.tar.gz
libsigrokdecode-84b81f1df5a51285e55d808fdfb7968cd70711e9.zip
i2c: fix address handling
Diffstat (limited to 'decoders')
-rw-r--r--decoders/i2c.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/decoders/i2c.py b/decoders/i2c.py
index 2a10ab7..abe4d7e 100644
--- a/decoders/i2c.py
+++ b/decoders/i2c.py
@@ -242,9 +242,12 @@ class Decoder(sigrokdecode.Decoder):
self.databyte >>= 1 # Shift out unwanted ACK/NACK bit here.
if self.state == FIND_ADDRESS:
- d = self.databyte & 0xfe
# The READ/WRITE bit is only in address bytes, not data bytes.
- self.wr = 1 if (self.databyte & 1) else 0
+ if self.databyte & 1:
+ self.wr = 0
+ else:
+ self.wr = 1
+ d = self.databyte >> 1
elif self.state == FIND_DATA:
d = self.databyte
else: