更新UCD-API库及文档
This commit is contained in:
45
docs/UCD-API文档/examples/work_with_pdc_controls.py
Normal file
45
docs/UCD-API文档/examples/work_with_pdc_controls.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Import UniTAP module.
|
||||
#
|
||||
import UniTAP
|
||||
|
||||
#
|
||||
# To initialize UniTAP library wrapper user should create UniTAP.TsiLib() object.
|
||||
#
|
||||
lUniTAP = UniTAP.TsiLib()
|
||||
|
||||
#
|
||||
# For opening device, please, put serial number of the device as 8 symbol str or put index of device.
|
||||
#
|
||||
# dev = lUniTAP.open("NNNNNNNN")
|
||||
dev = lUniTAP.open(0)
|
||||
|
||||
# After opening device as in UCD Console device role should be selected.
|
||||
# role = dev.select_role(UniTAP.dev.UCD424.USBCSourceUSBCSink)
|
||||
role = dev.select_role(UniTAP.dev.UCD500.USBCSourceUSBCSink)
|
||||
dev.opf_handler = UniTAP.OpfHandlerInternal(port_tx=role.dptx, port_rx=role.dprx)
|
||||
|
||||
# Send PR Swap (Also available FR swap, DR swap and Vconn swap)
|
||||
role.pdcrx.controls.send_pr_swap()
|
||||
|
||||
# Do Reconnect
|
||||
role.pdcrx.controls.reconnect()
|
||||
|
||||
# Do Attach(True)/DeAttach(False)
|
||||
role.pdcrx.controls.attach(True)
|
||||
|
||||
# Change cable control orientation
|
||||
role.pdcrx.controls.orientation(UniTAP.pdc.CableControlOrientation.CC2)
|
||||
|
||||
# Capable communication as PD Source (also available for Sink)
|
||||
role.pdcrx.controls.communication_capable_as_pd_source(capable=True)
|
||||
|
||||
#
|
||||
# Since the 3.5 version, TsiLib and TSIDevice objects have the option to be closed earlier.
|
||||
# TSIDevice can be closed with the TsiLib method close(). TsiLib can be closed with cleanup().
|
||||
# Clean up will close all opened devices and block ability to open any devices
|
||||
# with same TsiLib object.
|
||||
#
|
||||
lUniTAP.close(dev)
|
||||
|
||||
lUniTAP.cleanup()
|
||||
Reference in New Issue
Block a user