]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/i2c.py
srd: Add MX25Lxx05D SPI chip decoder.
[libsigrokdecode.git] / decoders / i2c.py
index 583c4d0d07a0953e6216c8c0c449a3d41ba03891..659ea553b6c77949684c849ab1337749d303e45c 100644 (file)
@@ -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)
 
-