def start(self, metadata):
self.out_ann = self.add(srd.OUTPUT_ANN, 'ddc')
- def decode(self, start_sample, end_sample, i2c_data):
+ def decode(self, ss, es, data):
try:
- cmd, data, ack_bit = i2c_data
+ cmd, data, ack_bit = data
except Exception as e:
raise Exception('malformed I2C input: %s' % str(e)) from e
if cmd == 'DATA_READ':
# There shouldn't be anything but data reads on this
# address, so ignore everything else.
- self.put(start_sample, end_sample, self.out_ann,
- [0, ['0x%.2x' % data]])
+ self.put(ss, es, self.out_ann, [0, ['0x%.2x' % data]])
# TODO: 0-0 sample range for now.
super(Decoder, self).put(0, 0, output_id, data)
- def decode(self, timeoffset, duration, data):
+ def decode(self, ss, es, data):
for samplenum, (scl, sda) in data:
self.samplecnt += 1
self.out += o
- def decode(self, timeoffset, duration, data):
+ def decode(self, ss, es, data):
self.out = []
# Iterate over all SPI MISO/MOSI packets. TODO: HOLD#, WP#/ACC?
def report(self):
pass
- def decode(self, timeoffset, duration, data):
+ def decode(self, ss, es, data):
out = []
o = {}
def report(self):
return 'SPI: %d bytes received' % self.bytesreceived
- def decode(self, timeoffset, duration, data):
+ def decode(self, ss, es, data):
# HACK! At the moment the number of probes is not handled correctly.
# E.g. if an input file (-i foo.sr) has more than two probes enabled.
for (samplenum, (sdata, sck, x, y, z, a)) in data:
# If this is first bit, save timestamp
if self.rxcount == 0:
- self.time = timeoffset # FIXME
+ self.time = ss # FIXME
# Receive bit into our shift register
if sdata:
self.rxdata |= 1 << (7 - self.rxcount)
if self.rxcount != 8:
continue
# Received a byte, pass up to sigrok
- outdata = {'time':self.time,
- 'duration':timeoffset + duration - self.time,
+ outdata = {'time':self.time, # FIXME
+ 'duration':ss + es - self.time, # FIXME
'data':self.rxdata,
'display':('%02X' % self.rxdata),
'type':'spi',
self.scount = 0
self.packet = ''
- def decode(self, timeoffset, duration, data):
+ def decode(self, ss, es, data):
out = []
# FIXME
def report(self):
pass
- def decode(self, timeoffset, duration, data):
+ def decode(self, ss, es, data):
for (samplenum, s) in data:
self.put(self.samplenum, self.samplenum, self.out_ann,
[ANN_ASCII, ['Stop bit', 'Stop', 'P']])
- def decode(self, timeoffset, duration, data): # TODO
+ def decode(self, ss, es, data): # TODO
# for (samplenum, (rx, tx)) in data:
for (samplenum, (rx,)) in data: