diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2016-08-26 15:11:16 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2016-12-07 22:45:46 +0100 |
commit | 86e7c29c4c80fe20d5e75db129f5e12398dfefb3 (patch) | |
tree | 729e664773bb30a385b902a1acbb3adab5a70df1 /decoders | |
parent | b6bac00c20f2da8da1b6795fa8c6a5ea83ceb4da (diff) | |
download | libsigrokdecode-86e7c29c4c80fe20d5e75db129f5e12398dfefb3.tar.gz libsigrokdecode-86e7c29c4c80fe20d5e75db129f5e12398dfefb3.zip |
aud: Convert to PD API version 3.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/aud/pd.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/decoders/aud/pd.py b/decoders/aud/pd.py index a5330f9..15fce85 100644 --- a/decoders/aud/pd.py +++ b/decoders/aud/pd.py @@ -26,7 +26,7 @@ import sigrokdecode as srd class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'aud' name = 'AUD' longname = 'Advanced User Debugger' @@ -51,8 +51,6 @@ class Decoder(srd.Decoder): self.nmax = 0 self.addr = 0 self.lastaddr = 0 - self.samplenum = 0 - self.oldclk = 0 self.ss = 0 def start(self): @@ -61,15 +59,7 @@ class Decoder(srd.Decoder): def putx(self, data): self.put(self.ss, self.samplenum, self.out_ann, data) - def find_clk_edge(self, clk, sync, datapins): - # Ignore sample if there's no edge. - if clk == self.oldclk: - return - self.oldclk = clk - # Ignore falling edges. - if clk == 0: - return - + def handle_clk_edge(self, clk, sync, datapins): # Reconstruct nibble. nib = 0 for i in range(4): @@ -106,9 +96,10 @@ class Decoder(srd.Decoder): self.addr |= nib << (self.ncnt * 4) self.ncnt += 1 - def decode(self, ss, es, data): - for (self.samplenum, pins) in data: + def decode(self): + while True: + pins = self.wait({0: 'r'}) clk = pins[0] sync = pins[1] d = pins[2:] - self.find_clk_edge(clk, sync, d) + self.handle_clk_edge(clk, sync, d) |