]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/dcf77/dcf77.py
srd: PDs: Whitespace and cosmetics.
[libsigrokdecode.git] / decoders / dcf77 / dcf77.py
index b7e029dab8ff3c270a327d1a59d5550179de84b8..ab600eddff400b60ae0fab78c6bb3d8a35de67f5 100644 (file)
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#
 # DCF77 protocol decoder
-#
-# More information:
-# http://en.wikipedia.org/wiki/DCF77
-#
-
-#
-# Protocol output format:
-# TODO
-#
 
 import sigrokdecode as srd
 import calendar
@@ -57,6 +47,9 @@ class Decoder(srd.Decoder):
     probes = [
         {'id': 'data', 'name': 'DATA', 'desc': 'DATA line'},
     ]
+    optional_probes = [
+        {'id': 'pon', 'name': 'PON', 'desc': 'TODO'},
+    ]
     options = {}
     annotations = [
         # ANN_ASCII
@@ -211,7 +204,7 @@ class Decoder(srd.Decoder):
             raise Exception('Invalid DCF77 bit: %d' % c)
 
     def decode(self, ss, es, data):
-        for samplenum, (pon, val) in data: # FIXME
+        for samplenum, (val) in data: # TODO: Handle optional PON.
 
             self.samplenum += 1 # FIXME. Use samplenum. Off-by-one?
 
@@ -272,7 +265,7 @@ class Decoder(srd.Decoder):
                 self.state = WAIT_FOR_RISING_EDGE
 
             else:
-                raise Exception('Invalid state: %s' % self.state)
+                raise Exception('Invalid state: %d' % self.state)
 
             self.oldval = val