X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fi2c.py;h=659ea553b6c77949684c849ab1337749d303e45c;hp=583c4d0d07a0953e6216c8c0c449a3d41ba03891;hb=1b1c914fe5c1b88db6e0b8e49bee896428d483cb;hpb=b2c19614a6c4eaa0170971d1261a1bb25212e277 diff --git a/decoders/i2c.py b/decoders/i2c.py index 583c4d0..659ea55 100644 --- a/decoders/i2c.py +++ b/decoders/i2c.py @@ -240,12 +240,12 @@ class Decoder(sigrok.Decoder): # We received 8 address/data bits and the ACK/NACK bit. self.databyte >>= 1 # Shift out unwanted ACK/NACK bit here. - ack = (sda == 1) and 'N' or 'A' + ack = 'N' if (sda == 1) else 'A' if self.state == FIND_ADDRESS: d = self.databyte & 0xfe # The READ/WRITE bit is only in address bytes, not data bytes. - self.wr = (self.databyte & 1) and 1 or 0 + self.wr = 1 if (self.databyte & 1) else 0 elif self.state == FIND_DATA: d = self.databyte else: @@ -352,4 +352,3 @@ class Decoder(sigrok.Decoder): if out != []: self.put(out) -