]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/midi/pd.py
All PDs: Minor whitespace and consistency fixes.
[libsigrokdecode.git] / decoders / midi / pd.py
index 371bcd5a0f3e053e487eaf496e5301bdc56aa3f9..68a8369bc2d7f38053af1282b55edbe49644070e 100644 (file)
@@ -18,8 +18,6 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-# MIDI protocol decoder
-
 import sigrokdecode as srd
 from .lists import *
 
@@ -27,7 +25,7 @@ RX = 0
 TX = 1
 
 class Decoder(srd.Decoder):
-    api_version = 1
+    api_version = 2
     id = 'midi'
     name = 'MIDI'
     longname = 'Musical Instrument Digital Interface'
@@ -35,13 +33,9 @@ class Decoder(srd.Decoder):
     license = 'gplv2+'
     inputs = ['uart']
     outputs = ['midi']
-    probes = []
-    optional_probes = []
-    options = {}
-    annotations = [
-        ['Text (verbose)', 'Human-readable text (verbose)'],
-        # ['Text', 'Human-readable text'],
-    ]
+    annotations = (
+        ('text-verbose', 'Human-readable text (verbose)'),
+    )
 
     def __init__(self, **kwargs):
         self.cmd = []
@@ -52,11 +46,7 @@ class Decoder(srd.Decoder):
         self.es_block = None
 
     def start(self):
-        # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'midi')
-        self.out_ann = self.add(srd.OUTPUT_ANN, 'midi')
-
-    def report(self):
-        pass
+        self.out_ann = self.register(srd.OUTPUT_ANN)
 
     def putx(self, data):
         self.put(self.ss_block, self.es_block, self.out_ann, data)
@@ -216,6 +206,3 @@ class Decoder(srd.Decoder):
             self.handle_syscommon_msg(pdata)
         elif self.state == 'HANDLE SYSREALTIME MSG':
             self.handle_sysrealtime_msg(pdata)
-        else:
-            raise Exception('Invalid state: %s' % self.state)
-