X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fdcf77%2Fdcf77.py;h=eabceeeeecca4c8cc2cc45f3a50add51873719a7;hp=53795926177345ffd9e22ad59586e12d9497e7c8;hb=2b7160383cc189f721600c04be17a980e216dfd6;hpb=decde15ecb51b3326b31019af61e0a729b9c61d0 diff --git a/decoders/dcf77/dcf77.py b/decoders/dcf77/dcf77.py index 5379592..eabceee 100644 --- a/decoders/dcf77/dcf77.py +++ b/decoders/dcf77/dcf77.py @@ -18,25 +18,11 @@ ## 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 -# States -WAIT_FOR_RISING_EDGE = 0 -GET_BIT = 1 - # Annotation feed formats ANN_ASCII = 0 @@ -57,7 +43,7 @@ class Decoder(srd.Decoder): probes = [ {'id': 'data', 'name': 'DATA', 'desc': 'DATA line'}, ] - extra_probes = [ + optional_probes = [ {'id': 'pon', 'name': 'PON', 'desc': 'TODO'}, ] options = {} @@ -67,7 +53,7 @@ class Decoder(srd.Decoder): ] def __init__(self, **kwargs): - self.state = WAIT_FOR_RISING_EDGE + self.state = 'WAIT FOR RISING EDGE' self.oldval = None self.samplenum = 0 self.bit_start = 0 @@ -218,7 +204,7 @@ class Decoder(srd.Decoder): self.samplenum += 1 # FIXME. Use samplenum. Off-by-one? - if self.state == WAIT_FOR_RISING_EDGE: + if self.state == 'WAIT FOR RISING EDGE': # Wait until the next rising edge occurs. if not (self.oldval == 0 and val == 1): self.oldval = val @@ -272,7 +258,7 @@ class Decoder(srd.Decoder): self.handle_dcf77_bit(bit) self.bitcount += 1 - self.state = WAIT_FOR_RISING_EDGE + self.state = 'WAIT FOR RISING EDGE' else: raise Exception('Invalid state: %d' % self.state)