From 84b81f1df5a51285e55d808fdfb7968cd70711e9 Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Sun, 8 Jan 2012 20:01:53 +0100 Subject: i2c: fix address handling --- decoders/i2c.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'decoders') 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: -- cgit v1.2.3-70-g09d2