summaryrefslogtreecommitdiff
path: root/decoders/i2c.py
diff options
context:
space:
mode:
authorGareth McMullin <gareth@blacksphere.co.nz>2011-11-27 19:17:13 +1300
committerGareth McMullin <gareth@blacksphere.co.nz>2011-11-27 19:48:01 +1300
commit3643fc3fe053bf531b4a7618d02c3d92c29f924b (patch)
treecb4abf3d968d7c1940804b49bd6d255141def583 /decoders/i2c.py
parentf39d2404acb54461f61b676ab164d42e9e76e3fa (diff)
downloadlibsigrokdecode-3643fc3fe053bf531b4a7618d02c3d92c29f924b.tar.gz
libsigrokdecode-3643fc3fe053bf531b4a7618d02c3d92c29f924b.zip
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.
Diffstat (limited to 'decoders/i2c.py')
-rw-r--r--decoders/i2c.py10
1 files changed, 5 insertions, 5 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