Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""This module provides Python bindings for DGILib."""
DLLError, DeviceIndexError, DeviceConnectionError) DGILibInterfaceCommunication)
"""Python bindings for DGILib.
DGILib is a Dynamic-Link Library (DLL) to help software applications communicate with Data Gateway Interface (DGI) devices. See the Data Gateway Interface user guide for further details. DGILib handles the low-level USB communication and adds a level of buffering for minimizing the chance of overflows. The library helps parse data streams of high complexity. The timestamp interface is parsed and split into separate buffers for each data source. The power interface is optionally parsed and calibrated using an auxiliary API.
:Example:
>>> with DGILib() as dgilib: ... dgilib.get_major_version() 5 """
# Add modules # Discovery # discovery = DGILibDiscovery
# Housekeeping # housekeeping = DGILibHousekeeping
# Interface Communication # interface_communication = DGILibInterfaceCommunication
# Auxiliary # auxiliary = DGILibAuxiliary
"""__init__.
Parameters ---------- dgilib_path : str Path to dgilib.dll (More info at: https://www.microchip.com/developmenttools/ProductDetailsATPOWERDEBUGGER)
device_index : int or None Index of the device to use, only useful if multiple devices are connected (default is `None`, will resolve to `0`)
device_sn : str or None The serial number of the device to use. Has higher priority than device_index (default is `None`, will resolve to serial number of device `0`)
verbose : int Set to a positive number to print more status messages (default is `0`)
Raises ------- DLLError TODO: `Not documented yet.`
""" # Load the dgilib.dll "dgilib_path", args[0] if args else "dgilib.dll") [getcwd(), dgilib_path], [getenv( "programfiles(x86)"), "Atmel", "Studio", "7.0", "Extensions", "Application", "dgilib.dll"]): else: f"Could not find dgilib.dll. If you install Atmel Studio in " + f"the default location (" + path.join( getenv("programfiles(x86)"), "Atmel", "Studio", "7.0") + f") it should get loaded automatically. Alternatively you " + f"can download it from https://www.microchip.com/mplab/avr-" + f"support/data-visualizer (download DGIlib dll, unzip the " + f"files and put the dll in {getcwd()}) or specify the path " + f"as the first argument or as a keyword argument " + f"(dgilib_path). Got dgilib_path={dgilib_path}.")
# Argument parsing
# Instantiate modules # self.discovery(self) # self.housekeeping(self) # self.interface_communication(self) # self.auxiliary(self)
"""__enter__
For usage in ``with DGILib() as dgilib:`` syntax.
""" # Discovery
f"Discovered {device_count} devices so could not select " f"device with index {self.device_index}." )
# UNTESTED: # if self.is_msd_mode(self.device_sn): # res = self.set_mode(self.device_sn, 1) # print(f"\t{res} set_mode 1")
# Housekeeping self.dgi_hndl = self.connect(self.device_sn) c_status = self.connection_status() if c_status: f"Could not connect to device. Connection status: {c_status}.")
# Interface communication
# Auxiliary
return self
"""__exit__
For usage in ``with DGILib() as dgilib:`` syntax.
""" # Discovery
# Housekeeping self.disconnect()
# Interface communication
# Auxiliary |