summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2016-08-26 15:21:39 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2016-12-07 22:45:47 +0100
commitbc6f82bb2856c0b5175e6858a13dc2e071cf2fee (patch)
treee3b5a10c3329202e87a8cb9367b5114dd4ecfa46 /decoders
parentaf495297728b449832a4f780d1f59c1cea5c295d (diff)
downloadlibsigrokdecode-bc6f82bb2856c0b5175e6858a13dc2e071cf2fee.tar.gz
libsigrokdecode-bc6f82bb2856c0b5175e6858a13dc2e071cf2fee.zip
usb_power_delivery: Convert to PD API version 3.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/usb_power_delivery/pd.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/decoders/usb_power_delivery/pd.py b/decoders/usb_power_delivery/pd.py
index 48db41b..c6d7c6c 100644
--- a/decoders/usb_power_delivery/pd.py
+++ b/decoders/usb_power_delivery/pd.py
@@ -182,7 +182,7 @@ class SamplerateError(Exception):
pass
class Decoder(srd.Decoder):
- api_version = 2
+ api_version = 3
id = 'usb_power_delivery'
name = 'USB PD'
longname = 'USB Power Delivery'
@@ -443,9 +443,7 @@ class Decoder(srd.Decoder):
self.samplerate = None
self.idx = 0
self.packet_seq = 0
- self.samplenum = 0
self.previous = 0
- self.oldpins = [0]
self.startsample = None
self.bits = []
self.edges = []
@@ -527,15 +525,11 @@ class Decoder(srd.Decoder):
# Raw binary data (BMC decoded)
self.put(es, ss, self.out_binary, [0, bytes(self.bits)])
- def decode(self, ss, es, data):
+ def decode(self):
if not self.samplerate:
raise SamplerateError('Cannot decode without samplerate.')
- for (self.samplenum, pins) in data:
- # find edges ...
- if self.oldpins == pins:
- continue
-
- self.oldpins, (cc, ) = pins, pins
+ while True:
+ self.wait({0: 'e'})
# First sample of the packet, just record the start date
if not self.startsample: