## 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
return (b & 0x0f) + ((b >> 4) * 10)
class Decoder(srd.Decoder):
+ api_version = 1
id = 'dcf77'
name = 'DCF77'
longname = 'DCF77 time protocol'
probes = [
{'id': 'data', 'name': 'DATA', 'desc': 'DATA line'},
]
+ optional_probes = [
+ {'id': 'pon', 'name': 'PON', 'desc': 'TODO'},
+ ]
options = {}
annotations = [
# ANN_ASCII
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?
self.state = WAIT_FOR_RISING_EDGE
else:
- raise Exception('Invalid state: %s' % self.state)
+ raise Exception('Invalid state: %d' % self.state)
self.oldval = val