diff options
author | Bert Vermeulen <bert@biot.com> | 2011-12-04 10:33:02 +0100 |
---|---|---|
committer | Bert Vermeulen <bert@biot.com> | 2011-12-04 17:56:56 +0100 |
commit | b2c19614a6c4eaa0170971d1261a1bb25212e277 (patch) | |
tree | b599e5e3795c0b094cd4514820db0c7e761653fd /decoders | |
parent | 2b7d0e2bf5147025e9d76d14e266b9905503b957 (diff) | |
download | libsigrokdecode-b2c19614a6c4eaa0170971d1261a1bb25212e277.tar.gz libsigrokdecode-b2c19614a6c4eaa0170971d1261a1bb25212e277.zip |
refactored PD framework, now using new sigrok.Decoder object
This uses the new python unified type/class object API to construct
an object for PDs to subclass. The sigrok.Decoder class has a method
put() which is implemented as a C function, and receives the PD's
object instance as its first parameter.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/i2c.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/decoders/i2c.py b/decoders/i2c.py index 16e7491..583c4d0 100644 --- a/decoders/i2c.py +++ b/decoders/i2c.py @@ -126,6 +126,8 @@ # 'signals': [{'SCL': }]} # +import sigrok + # States FIND_START = 0 FIND_ADDRESS = 1 @@ -142,7 +144,7 @@ def sampleiter(data, unitsize): for i in range(0, len(data), unitsize): yield(Sample(data[i:i+unitsize])) -class Decoder(): +class Decoder(sigrok.Decoder): id = 'i2c' name = 'I2C' longname = 'Inter-Integrated Circuit (I2C) bus' @@ -348,9 +350,6 @@ class Decoder(): self.oldsda = sda if out != []: - sigrok.put(out) - -import sigrok + self.put(out) -sigrok.register(Decoder) |