summaryrefslogtreecommitdiff
path: root/decoders/usb_power_delivery
diff options
context:
space:
mode:
authorPeetz0r <peter@haas-en-berg.nl>2018-08-03 22:08:59 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2018-09-09 14:28:04 +0200
commit603a3c777d621549c9e18a2c46d34024497a6b28 (patch)
tree408f803be68669c47f07d0630b4849b4da9640be /decoders/usb_power_delivery
parenta886ba3b903d2e900020affe743bb486e8880464 (diff)
downloadlibsigrokdecode-603a3c777d621549c9e18a2c46d34024497a6b28.tar.gz
libsigrokdecode-603a3c777d621549c9e18a2c46d34024497a6b28.zip
usb_power_delivery: PPS support
Diffstat (limited to 'decoders/usb_power_delivery')
-rw-r--r--decoders/usb_power_delivery/pd.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/decoders/usb_power_delivery/pd.py b/decoders/usb_power_delivery/pd.py
index 702c22a..d6818c1 100644
--- a/decoders/usb_power_delivery/pd.py
+++ b/decoders/usb_power_delivery/pd.py
@@ -278,11 +278,18 @@ class Decoder(srd.Decoder):
elif t1 == 3:
t2 = (pdo >> 28) & 3
if t2 == 0:
- t_name = 'Programmable'
- p = 'TODO: PPS support'
+ t_name = 'Programmable|PPS'
+ minv = ((pdo >> 8) & 0xff) * 0.1
+ maxv = ((pdo >> 17) & 0xff) * 0.1
+ ma = ((pdo >> 0) & 0xff) * 0.05
+ p = '%g/%gV %gA' % (minv, maxv, ma)
+ if (pdo >> 27) & 0x1:
+ p += ' [limited]'
+ self.stored_pdos[idx] = '%s %g/%gV' % (t_name, minv, maxv)
else:
t_name = 'Reserved APDO: '+bin(t2)
- p = ''
+ p = '[raw: %s]' % (bin(pdo))
+ self.stored_pdos[idx] = '%s %s' % (t_name, p)
flags = ''
for f in sorted(PDO_FLAGS.keys(), reverse = True):
if pdo & f: