]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/avr_isp/pd.py
avr_isp: Fix a bug resulting in incorrect start samples.
[libsigrokdecode.git] / decoders / avr_isp / pd.py
index 27b511886ecea409cd729a22529c7737b0ff9794..05a46ec541295bfaaa2c88a90f05c1582a61a87b 100644 (file)
@@ -18,8 +18,6 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-# AVR ISP protocol decoder
-
 import sigrokdecode as srd
 from .parts import *
 
@@ -40,8 +38,8 @@ class Decoder(srd.Decoder):
     ]
     options = {}
     annotations = [
-        ['Text', 'Human-readable text'],
-        ['Warnings', 'Human-readable warnings'],
+        ['text', 'Human-readable text'],
+        ['warnings', 'Human-readable warnings'],
     ]
 
     def __init__(self, **kwargs):
@@ -51,11 +49,8 @@ class Decoder(srd.Decoder):
         self.xx, self.yy, self.zz, self.mm = 0, 0, 0, 0
 
     def start(self):
-        # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'avr_isp')
-        self.out_ann = self.add(srd.OUTPUT_ANN, 'avr_isp')
-
-    def report(self):
-        pass
+        # self.out_python = self.register(srd.OUTPUT_PYTHON)
+        self.out_ann = self.register(srd.OUTPUT_ANN)
 
     def putx(self, data):
         self.put(self.cmd_ss, self.cmd_es, self.out_ann, data)
@@ -182,13 +177,13 @@ class Decoder(srd.Decoder):
 
         self.ss, self.es = ss, es
 
+        if len(self.mosi_bytes) == 0:
+            self.cmd_ss = ss
+
         # Append new bytes.
         self.mosi_bytes.append(mosi)
         self.miso_bytes.append(miso)
 
-        if len(self.mosi_bytes) == 0:
-            self.cmd_ss = ss
-
         # All commands consist of 4 bytes.
         if len(self.mosi_bytes) < 4:
             return