]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/sle44xx/pd.py
sle44xx: minor developer comment and style nits
[libsigrokdecode.git] / decoders / sle44xx / pd.py
index a53a1ea18ebc9f543ec4429536e5664450ec0653..775ee3c8a8fb78c9d29aa826a683e480e5da1885 100644 (file)
@@ -83,7 +83,7 @@ class Decoder(srd.Decoder):
     def reset(self):
         self.ss = self.es = self.ss_byte = -1
         self.bits = []
-        self.cmd = 'RESET'
+        self.cmd = None
 
     def metadata(self, key, value):
         if key == srd.SRD_CONF_SAMPLERATE:
@@ -105,14 +105,16 @@ class Decoder(srd.Decoder):
         cls, texts = lookup_proto_ann_txt(self.cmd, {})
         self.putx([cls, texts])
         self.bits = []
-        self.cmd = 'ATR' # Next data bytes will be ATR
+        # Next data bytes will be Answer To Reset.
+        self.cmd = 'ATR'
 
     def handle_command(self, pins):
         rst, clk, io = pins
         self.ss, self.es = self.samplenum, self.samplenum
+        # XXX Is the comment inverted?
         # If I/O is rising -> command START
         # if I/O is falling -> command STOP and response data incoming
-        self.cmd = 'CMD' if (io == 0) else 'DATA'
+        self.cmd = 'CMD' if io == 0 else 'DATA'
         self.bits = []
 
     # Gather 8 bits of data
@@ -153,7 +155,8 @@ class Decoder(srd.Decoder):
             self.put(bit_ss, bit_es, self.out_ann, [cls, texts])
 
         cls, texts = lookup_proto_ann_txt(self.cmd, {'data': databyte})
-        self.putx([cls, texts])
+        if cls:
+            self.putx([cls, texts])
 
         # Done with this packet.
         self.bits = []