|
@@ -240,7 +240,7 @@ class Sink:
|
240
|
240
|
|
241
|
241
|
# Set voltage range
|
242
|
242
|
self.set_vrange(sc.vmin, sc.vmax)
|
243
|
|
-
|
|
243
|
+
|
244
|
244
|
if sc.idim is SinkDimension.CURRENT:
|
245
|
245
|
# Set current
|
246
|
246
|
self.set_i(sc.i)
|
|
@@ -483,6 +483,27 @@ class SrcFixedPDO(namedtuple("SrcFixedPDO", "dual_role_pwr usb_suspend "
|
483
|
483
|
return s
|
484
|
484
|
|
485
|
485
|
|
|
486
|
+class SourcePPSAPDO(namedtuple("SourcePPSAPDO", "vmin vmax i")):
|
|
487
|
+ """A Source Programmable Power Supply APDO
|
|
488
|
+
|
|
489
|
+ ``vmin`` and ``vmax`` are the minimum and maximum voltage in millivolts,
|
|
490
|
+ respectively, and ``i`` is the maximum current in milliamperes.
|
|
491
|
+ """
|
|
492
|
+ __slots__ = ()
|
|
493
|
+
|
|
494
|
+ pdo_type = "pps"
|
|
495
|
+
|
|
496
|
+ def __str__(self):
|
|
497
|
+ """Print the SourcePPSAPDO in the manner of the configuration shell"""
|
|
498
|
+ s = self.pdo_type + "\n"
|
|
499
|
+
|
|
500
|
+ s += "\tvmin: {:.2f} V\n".format(self.vmin / 1000.0)
|
|
501
|
+ s += "\tvmax: {:.2f} V\n".format(self.vmax / 1000.0)
|
|
502
|
+ s += "\ti: {:.2f} A".format(self.i / 1000.0)
|
|
503
|
+
|
|
504
|
+ return s
|
|
505
|
+
|
|
506
|
+
|
486
|
507
|
class TypeCVirtualPDO(namedtuple("TypeCVirtualPDO", "i")):
|
487
|
508
|
"""A Type-C Current Virtual PDO
|
488
|
509
|
|
|
@@ -551,6 +572,21 @@ def read_pdo(text):
|
551
|
572
|
peak_i=peak_i,
|
552
|
573
|
v=v,
|
553
|
574
|
i=i)
|
|
575
|
+ elif pdo_type == SourcePPSAPDO.pdo_type:
|
|
576
|
+ # Load a SourcePPSAPDO
|
|
577
|
+ for line in text[1:]:
|
|
578
|
+ fields = line.split(b":")
|
|
579
|
+ fields[0] = fields[0].strip()
|
|
580
|
+ fields[1] = fields[1].strip()
|
|
581
|
+ if fields[0] == b"vmin":
|
|
582
|
+ vmin = round(1000*float(fields[1].split()[0]))
|
|
583
|
+ if fields[0] == b"vmax":
|
|
584
|
+ vmax = round(1000*float(fields[1].split()[0]))
|
|
585
|
+ if fields[0] == b"i":
|
|
586
|
+ i = round(1000*float(fields[1].split()[0]))
|
|
587
|
+
|
|
588
|
+ # Make the SourcePPSAPDO
|
|
589
|
+ return SourcePPSAPDO(vmin=vmin, vmax=vmax, i=i)
|
554
|
590
|
elif pdo_type == TypeCVirtualPDO.pdo_type:
|
555
|
591
|
# Load a TypeCVirtualPDO
|
556
|
592
|
for line in text[1:]:
|