From 3643fc3fe053bf531b4a7618d02c3d92c29f924b Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sun, 27 Nov 2011 19:17:13 +1300 Subject: srd: Pass metadata to decoders only on SR_DF_HEADER. Before this was passed to the decoder's constuctor, but the parameters may not all be known at construction. Decoders now have a method start() which is called at the start of the capture, and metadata is passed as an arg to this function. --- decoders/spi.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'decoders/spi.py') diff --git a/decoders/spi.py b/decoders/spi.py index 7b3d8ab..731c77c 100644 --- a/decoders/spi.py +++ b/decoders/spi.py @@ -43,17 +43,16 @@ class Decoder(): probes = {'sdata':0, 'sck':1} options = {} - def __init__(self, unitsize, **kwargs): - # Metadata comes in here, we don't care for now - #print kwargs - self.unitsize = unitsize - + def __init__(self): self.probes = Decoder.probes.copy() self.oldsck = True self.rxcount = 0 self.rxdata = 0 self.bytesreceived = 0 + def start(self, metadata): + self.unitsize = metadata["unitsize"] + def report(self): return "SPI: %d bytes received" % self.bytesreceived -- cgit v1.2.3-70-g09d2