更新UCD-API库及文档
This commit is contained in:
51
docs/UCD-API文档/examples/work_with_pdc_dpam.py
Normal file
51
docs/UCD-API文档/examples/work_with_pdc_dpam.py
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# 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)
|
||||
|
||||
# Get and print current DP Alt Mode status
|
||||
print(role.pdcrx.dp_alt_mode.status)
|
||||
|
||||
# Enter to 4 lane (C and E) DP Alt Mode
|
||||
role.pdcrx.dp_alt_mode.enter_4_lane()
|
||||
|
||||
# Enable flag DP to Type-C adapter mode
|
||||
# role.pdcrx.dp_alt_mode.dp_to_type_c_cable_adapter_mode(enable=True)
|
||||
|
||||
# Get and Set UFP Pin Assignment
|
||||
ufp_pin_assignment = role.pdcrx.dp_alt_mode.ufp_caps
|
||||
dfp_caps = role.pdcrx.dp_alt_mode.dfp_caps
|
||||
ufp_pin_assignment.c_4_lanes = True
|
||||
ufp_pin_assignment.d_2_lanes = False
|
||||
role.pdcrx.dp_alt_mode.ufp_caps = ufp_pin_assignment
|
||||
print("UFP:\n", ufp_pin_assignment)
|
||||
print("DFP:\n", dfp_caps)
|
||||
|
||||
# If was selected UCD-500, may use DP 2.1 DPAM
|
||||
# role.pdcrx.dp_alt_mode.enable_dp21(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