From b2c19614a6c4eaa0170971d1261a1bb25212e277 Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Sun, 4 Dec 2011 10:33:02 +0100 Subject: 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. --- decoders/i2c.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'decoders') 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) -- cgit v1.2.3-70-g09d2