]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/miller/pd.py
sdcard_spi: Use SrdIntEnum for annotation classes.
[libsigrokdecode.git] / decoders / miller / pd.py
index 7ccd75eb9c337f9b18d95f997c176f184c88408e..33214b14f600833ac49032eddd2f2c03867b467a 100644 (file)
@@ -34,11 +34,12 @@ class Decoder(srd.Decoder):
     api_version = 3
     id = 'miller'
     name = 'Miller'
-    longname = 'Miller decoder for NFC'
-    desc = 'Decodes (modified) Miller encoding as used in NFC communication.'
+    longname = 'Miller encoding'
+    desc = 'Miller encoding protocol.'
     license = 'gplv2+'
     inputs = ['logic']
-    outputs = ['miller']
+    outputs = []
+    tags = ['Encoding']
     channels = (
         {'id': 'data', 'name': 'Data', 'desc': 'Data signal'},
     )
@@ -50,9 +51,15 @@ class Decoder(srd.Decoder):
         ('bit', 'Bit'),
         ('bitstring', 'Bitstring'),
     )
-    annotation_rows = tuple((u, v, (i,)) for i, (u, v) in enumerate(annotations))
+    annotation_rows = tuple((u + 's', v + 's', (i,)) for i, (u, v) in enumerate(annotations))
+    binary = (
+        ('raw', 'Raw binary'),
+    )
 
     def __init__(self):
+        self.reset()
+
+    def reset(self):
         self.samplerate = None
 
     def metadata(self, key, value):
@@ -176,7 +183,7 @@ class Decoder(srd.Decoder):
 
         numbytes = numbits // 8 + (numbits % 8 > 0)
         bytestring = bitvalue.to_bytes(numbytes, 'little')
-        self.put(int(stringstart), int(stringend), self.out_binary, [1, bytestring])
+        self.put(int(stringstart), int(stringend), self.out_binary, [0, bytestring])
 
     def decode(self):
         while True: