##
-## This file is part of the sigrok project.
+## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
## Copyright (C) 2013 Matt Ranostay <mranostay@gmail.com>
self.months = -1
self.years = -1
- def start(self, metadata):
- self.out_ann = self.add(srd.OUTPUT_ANN, 'ds1307')
-
- def report(self):
- pass
+ def start(self):
+ self.out_ann = self.register(srd.OUTPUT_ANN)
def putx(self, data):
self.put(self.ss, self.es, self.out_ann, data)
def decode(self, ss, es, data):
cmd, databyte = data
- # Store the start/end samples of this I2C packet.
+ # Store the start/end samples of this I²C packet.
self.ss, self.es = ss, es
# State machine.
if self.state == 'IDLE':
- # Wait for an I2C START condition.
+ # Wait for an I²C START condition.
if cmd != 'START':
return
self.state = 'GET SLAVE ADDR'
# TODO: Check for NACK!
elif cmd == 'STOP':
# TODO: Handle read/write of only parts of these items.
- d = '%02d.%02d.%02d %02d:%02d:%02d' % (self.days, self.date,
- self.months, self.years, self.hours, self.minutes,
- self.seconds)
+ d = '%s, %02d.%02d.%02d %02d:%02d:%02d' % (
+ days_of_week[self.days - 1], self.date, self.months,
+ self.years, self.hours, self.minutes, self.seconds)
self.put(self.block_start_sample, es, self.out_ann,
[0, ['Written date/time: %s' % d]])
self.state = 'IDLE'
self.reg += 1
# TODO: Check for NACK!
elif cmd == 'STOP':
- d = '%02d.%02d.%02d.%02d %02d:%02d:%02d' % (self.days,
- self.date, self.months, self.years, self.hours,
- self.minutes, self.seconds)
+ d = '%s, %02d.%02d.%02d %02d:%02d:%02d' % (
+ days_of_week[self.days - 1], self.date, self.months,
+ self.years, self.hours, self.minutes, self.seconds)
self.put(self.block_start_sample, es, self.out_ann,
[0, ['Read date/time: %s' % d]])
self.state = 'IDLE'