diff options
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/i2c.py | 10 | ||||
-rw-r--r-- | decoders/spi.py | 9 | ||||
-rw-r--r-- | decoders/transitioncounter.py | 9 |
3 files changed, 13 insertions, 15 deletions
diff --git a/decoders/i2c.py b/decoders/i2c.py index a46ba6a..f0b32e7 100644 --- a/decoders/i2c.py +++ b/decoders/i2c.py @@ -154,11 +154,7 @@ class Decoder(): 'address-space': ['Address space (in bits)', 7], } - def __init__(self, unitsize, **kwargs): - # Metadata comes in here, we don't care for now. - # print kwargs - self.unitsize = unitsize - + def __init__(self, **kwargs): self.probes = Decoder.probes.copy() # TODO: Don't hardcode the number of channels. @@ -180,6 +176,10 @@ class Decoder(): self.oldscl = None self.oldsda = None + def start(self, metadata): + self.unitsize = metadata["unitsize"] + + def report(self): pass 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 diff --git a/decoders/transitioncounter.py b/decoders/transitioncounter.py index 1b10518..f401b15 100644 --- a/decoders/transitioncounter.py +++ b/decoders/transitioncounter.py @@ -42,11 +42,7 @@ class Decoder(): probes = {} options = {} - def __init__(self, unitsize, **kwargs): - # Metadata comes in here, we don't care for now. - # print kwargs - self.unitsize = unitsize - + def __init__(self, **kwargs): self.probes = Decoder.probes.copy() # TODO: Don't hardcode the number of channels. @@ -58,6 +54,9 @@ class Decoder(): self.rising = [0] * self.channels self.falling = [0] * self.channels + def start(self, metadata): + self.unitsize = metadata["unitsize"] + def report(self): pass |