]> sigrok.org Git - libsigrokdecode.git/commitdiff
i2c: fix address handling
authorBert Vermeulen <redacted>
Sun, 8 Jan 2012 19:01:53 +0000 (20:01 +0100)
committerBert Vermeulen <redacted>
Sun, 8 Jan 2012 19:01:53 +0000 (20:01 +0100)
decoders/i2c.py

index 2a10ab7408eb4c8950f27a46ff549a065c2a373a..abe4d7ec7e69c4258f1c380475d77a33f764e80e 100644 (file)
@@ -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: