Exemplo n.º 1
0
    def __init__(self, uri="", name="one-bit-adc-dac"):

        try:
            context_manager.__init__(self, uri, self._device_name)
        except Exception:
            raise Exception(f"No device found for {name}")

        self._ctrl = None

        for dev in self._ctx.devices:
            if "label" in dev.attrs and dev.attrs["label"].value == name:
                self._ctrl = dev
                break
            else:
                if dev.name == name:
                    self._ctrl = dev
                    break

        if not self._ctrl:
            raise Exception(f"No device found for {name}")

        for chan in self._ctrl.channels:
            setattr(
                type(self),
                f"gpio_{chan.attrs['label'].value.lower()}",
                _dyn_property("raw",
                              dev=self._ctrl,
                              channel_name=chan.id,
                              output=chan.output),
            )
Exemplo n.º 2
0
    def __init__(self, uri="", device_index=0):

        context_manager.__init__(self, uri, self._device_name)

        compatible_parts = ["ad7124-8", "ad7124-4"]

        self._ctrl = None
        index = 0

        # Selecting the device_index-th device from the 7124 family as working device.
        for device in self._ctx.devices:
            if device.name in compatible_parts:
                if index == device_index:
                    self._ctrl = device
                    self._rxadc = device
                    break
                else:
                    index += 1

        # dynamically get channels and sorting them after the index of the first voltage channel
        self._ctrl.channels.sort(key=lambda x: int(x.id[7 : x.id.find("-")]))

        for ch in self._ctrl._channels:
            name = ch._id
            self._rx_channel_names.append(name)
            self.channel.append(self._channel(self._ctrl, name))
        rx.__init__(self)
Exemplo n.º 3
0
    def __init__(self, uri="", device_name=""):

        context_manager.__init__(self, uri, self._device_name)

        compatible_parts = [
            "ad7605-4",
            "ad7606-4",
            "ad7606-6",
            "ad7606-8",
            "ad7606b",
            "ad7616",
        ]

        self._ctrl = None

        if not device_name:
            device_name = compatible_parts[0]
        else:
            if device_name not in compatible_parts:
                raise Exception("Not a compatible device: " + device_name)

        # Select the device matching device_name as working device
        for device in self._ctx.devices:
            if device.name == device_name:
                self._ctrl = device
                self._rxadc = device
                break

        for ch in self._ctrl._channels:
            name = ch._id
            self._rx_channel_names.append(name)
            self.channel.append(self._channel(self._ctrl, name))

        rx.__init__(self)
Exemplo n.º 4
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._txdac = self._ctx.find_device("axi-ad9144-hpc")

        tx.__init__(self)
Exemplo n.º 5
0
    def __init__(self,
                 uri="",
                 username="******",
                 password="******",
                 disable_jesd_control=False):
        """Initialize AD9371 interface class.
        Args:
            uri (str): URI of target platform with AD9371
            username (str): SSH username for target board. Required for JESD monitoring
            password (str): SSH password for target board. Required for JESD monitoring
            disable_jesd_control (bool): Disable JESD status monitoring over SSH
        """
        context_manager.__init__(self, uri, self._device_name)

        self._ctrl = self._ctx.find_device("ad9371-phy")
        self._rxadc = self._ctx.find_device("axi-ad9371-rx-hpc")
        self._rxobs = self._ctx.find_device("axi-ad9371-rx-obs-hpc")
        self._txdac = self._ctx.find_device("axi-ad9371-tx-hpc")

        if not disable_jesd_control and jesd:
            self._jesd = jesd(uri, username=username, password=password)

        rx_tx.__init__(self)

        self.obs = obs(self._ctx, self._rxobs, self._obs_channel_names)
Exemplo n.º 6
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._rxadc = self._ctx.find_device("cf-ad9467-core-lpc")

        rx.__init__(self)
Exemplo n.º 7
0
    def __init__(self, uri=""):
        """adxl313 class constructor."""
        context_manager.__init__(self, uri)

        compatible_parts = [
            "ADXL312",
            "ADXL313",
            "ADXL314",
        ]

        self._ctrl = None

        # Select the device matching device_name as working device
        for device in self._ctx.devices:
            if device.name in compatible_parts:
                print("Found device {}".format(device.name))
                self._ctrl = device
                self._rxadc = device
                self._device_name = device.name
                break

        if self._ctrl is None:
            raise Exception("No compatible device found")

        self.accel_x = self._channel(self._ctrl, "accel_x")
        self.accel_y = self._channel(self._ctrl, "accel_y")
        self.accel_z = self._channel(self._ctrl, "accel_z")
        self._rx_channel_names = ["accel_x", "accel_y", "accel_z"]
        rx.__init__(self)
Exemplo n.º 8
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._rxadc = self._ctx.find_device("axi-ad9625-hpc")

        rx.__init__(self)
Exemplo n.º 9
0
    def __init__(self, uri="", device_index=0):
        """ADPD188 class constructor."""
        context_manager.__init__(self, uri, self._device_name)

        compatible_parts = ["adpd188"]

        self._ctrl = None
        index = 0

        # Selecting the device_index-th device from the adpd188 family as working device.
        for device in self._ctx.devices:
            if device.name in compatible_parts:
                if index == device_index:
                    self._ctrl = device
                    self._rxadc = device
                    break
                else:
                    index += 1

        # dynamically get channels and sorting them after the color
        # self._ctrl.channels.sort(key=lambda x: str(x.id[14:]))

        for ch in self._ctrl._channels:
            name = ch._id
            self._rx_channel_names.append(name)
            self.channel.append(self._channel(self._ctrl, name))
        rx.__init__(self)
        self.rx_buffer_size = 16
Exemplo n.º 10
0
    def __init__(self, uri="", device_name="ad4630-24"):

        context_manager.__init__(self, uri, self._device_name)

        compatible_parts = ["ad4630-24", "ad4030-24", "ad4630-16"]

        if device_name not in compatible_parts:
            raise Exception(
                "Not a compatible device: "
                + str(device_name)
                + ". Please select from "
                + str(compatible_parts)
            )
        else:
            self._ctrl = self._ctx.find_device(device_name)
            self._rxadc = self._ctx.find_device(device_name)

        _channels = []
        self.output_bits = []
        for ch in self._ctrl.channels:
            self.output_bits.append(ch.data_format.bits)
            self._rx_channel_names.append(ch.id)
            if "differential" in ch.name:
                _channels.append((ch.id, self._diff_channel(self._ctrl, ch.id)))
                if "0" in ch.name:
                    self.chan0 = self._diff_channel(self._ctrl, ch.name)
                if "1" in ch.name:
                    self.chan1 = self._diff_channel(self._ctrl, ch.name)

        rx.__init__(self)
Exemplo n.º 11
0
    def __init__(self, *args: Union[str, iio.Context],
                 **kwargs: Union[str, iio.Context]) -> None:

        # Handle Older API and Newer APIs
        uri_ctx = self.__handle_init_args(args, kwargs)

        # Handle context
        if isinstance(uri_ctx, iio.Context):
            self._ctx = uri_ctx
            self.uri = ""
        elif uri_ctx:
            self.uri = uri_ctx
            context_manager.__init__(self, uri_ctx, self._device_name)
        else:
            required_devices = [
                self._rx_data_device_name, self._control_device_name
            ]
            contexts = iio.scan_contexts()
            self._ctx = None
            for c in contexts:
                ctx = iio.Context(c)
                devs = [dev.name for dev in ctx.devices]
                if all(dev in devs for dev in required_devices):
                    self._ctx = iio.Context(c)
                    break
            if not self._ctx:
                raise Exception("No context could be found for class")

        # Set up devices
        if self._control_device_name:
            self._ctrl = self._ctx.find_device(self._control_device_name)
            if not self._ctrl:
                raise Exception(
                    f"No device found with name {self._control_device_name}")
Exemplo n.º 12
0
    def __init__(self, uri="", device_name=""):
        """Constructor for AD4110 class."""
        context_manager.__init__(self, uri, self._device_name)

        compatible_part = "ad4110"
        self._ctrl = None

        if not device_name:
            device_name = compatible_part
        else:
            if device_name != compatible_part:
                raise Exception(f"Not a compatible device: {device_name}")

        # Select the device matching device_name as working device
        for device in self._ctx.devices:
            if device.name == device_name:
                self._ctrl = device
                self._rxadc = device
                break

        if not self._ctrl:
            raise Exception("Error in selecting matching device")

        if not self._rxadc:
            raise Exception("Error in selecting matching device")

        for ch in self._ctrl.channels:
            name = ch._id
            self._rx_channel_names.append(name)
            self.channel.append(self._channel(self._ctrl, name))

        rx.__init__(self)
Exemplo n.º 13
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)
        self._ctrl = self._ctx.find_device("ad9166")
        self._txdac = self._ctx.find_device("ad9166")
        self._temp_sensor_name = "temp0"
        self._dac0_name = "altvoltage0"
Exemplo n.º 14
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._rxadc = self._ctx.find_device("ada4961")

        rx.__init__(self)
Exemplo n.º 15
0
    def __init__(self, uri="", chip_id="csb1_chip1", context_handle=None):

        # Use the given context if possible, otherwise lookup the context
        if context_handle is not None:
            self._ctx = context_handle
        else:
            context_manager.__init__(self, uri, self._device_name)

        self._ctrl = None
        self._chip_id = chip_id

        # Raise an error if the chip_id is a list. Suggest using the array class
        if isinstance(chip_id, (list, tuple, set)):
            raise Exception(
                '"chip_id" can\'t be an iterable. '
                "Please use the adar1000_array class for instantiating multiple devices"
            )

        # Look for the matching device in the context
        for dev in self._ctx.devices:
            if ("label" in dev.attrs
                    and dev.attrs["label"].value.lower() == chip_id.lower()):
                self._ctrl = dev
                break

        # Raise an exception if the device isn't found
        if not self._ctrl:
            raise Exception(f"Device not found for {chip_id}")
Exemplo n.º 16
0
    def __init__(self, uri="", device_name=""):
        """Constructor for AD719x class."""
        context_manager.__init__(self, uri, self._device_name)

        compatible_parts = ["ad7190", "ad7192", "ad7193", "ad7195"]

        self._ctrl = None

        if not device_name:
            device_name = compatible_parts[0]
        else:
            if device_name not in compatible_parts:
                raise Exception("Not a compatible device: " + device_name)

        # Select the device matching device_name as working device
        for device in self._ctx.devices:
            if device.name == device_name:
                self._ctrl = device
                self._rxadc = device
                break

        if not self._ctrl:
            raise Exception("Error in selecting matching device")

        if not self._rxadc:
            raise Exception("Error in selecting matching device")

        for ch in self._ctrl.channels:
            name = ch._id
            self._rx_channel_names.append(name)
            self.channel.append(self._channel(self._ctrl, name))

        rx.__init__(self)
Exemplo n.º 17
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._ctrl = self._ctx.find_device("ada4961")

        if not self._ctrl:
            raise Exception("ADF4159 device not found")
Exemplo n.º 18
0
    def __init__(self, uri="", username="******", password="******"):

        context_manager.__init__(self, uri, self._device_name)

        self._txdac = self._ctx.find_device("axi-ad9136-tx-hpc")
        self._jesd = jesd(uri, username='******', password=None)

        tx.__init__(self)
Exemplo n.º 19
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._ctrl = self._ctx.find_device("adis16460")
        self._rxadc = self._ctx.find_device("adis16460")
        rx.__init__(self)
        self.rx_buffer_size = 16  # Make default buffer smaller
Exemplo n.º 20
0
    def __init__(self, uri="", username="******", password="******"):

        context_manager.__init__(self, uri, self._device_name)

        self._rxadc = self._ctx.find_device("axi-ad9250-hpc")
        self._jesd = jesd(uri, username=username, password=password)

        rx.__init__(self)
Exemplo n.º 21
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._rxadc = self._ctx.find_device("adpd410x")

        for name in self._rx_channel_names:
            self.channel.append(self._channel(self._rxadc, name))
Exemplo n.º 22
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)
        # Find the device
        self._ctrl = self._ctx.find_device(self._device_name)
        # Raise an exception if the device isn't found
        if not self._ctrl:
            raise Exception("ADF4159 device not found")
Exemplo n.º 23
0
 def __init__(self, uri=""):
     context_manager.__init__(self, uri, self._device_name)
     self._ctrl = self._ctx.find_device("ad9361-phy")
     self._ctrl_b = self._ctx.find_device("ad9361-phy-B")
     self._rxadc = self._ctx.find_device("cf-ad9361-A")
     self._txdac = self._ctx.find_device("cf-ad9361-dds-core-lpc")
     self._rxadc_chip_b = self._ctx.find_device("cf-ad9361-B")
     self._txdac_chip_b = self._ctx.find_device("cf-ad9361-dds-core-B")
     rx_tx.__init__(self)
Exemplo n.º 24
0
    def __init__(self, uri=""):
        context_manager.__init__(self, uri, self._device_name)

        # Find the main and trigger devices
        self._ctrl = self._ctx.find_device("ltc2314-14")

        # Raise an exception if the device isn't found
        if not self._ctrl:
            raise Exception("LTC2314-14 device not found")
Exemplo n.º 25
0
 def __init__(self, uri, phy, rxdev):
     context_manager.__init__(self, uri, self._device_name)
     self._rxadc = self._ctx.find_device(rxdev)
     assert self._rxadc, "Device not found: " + rxdev
     # Set channels
     for chan in self._rxadc.channels:
         if chan.scan_element:
             self._rx_channel_names.append(chan.id)
     rx.__init__(self)
Exemplo n.º 26
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._rxadc = self._ctx.find_device("axi-ad9083-rx-hpc")
        if not self._rxadc:
            raise Exception("Cannot find device axi-ad9083-rx-hpc")

        rx.__init__(self)
Exemplo n.º 27
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._ctrl = self._ctx.find_device("adrv9009-phy")
        self._rxadc = self._ctx.find_device("axi-adrv9009-rx-hpc")
        self._rxobs = self._ctx.find_device("axi-adrv9009-rx-obs-hpc")
        self._txdac = self._ctx.find_device("axi-adrv9009-tx-hpc")

        rx_tx.__init__(self)
Exemplo n.º 28
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._ctrl = self._ctx.find_device("ad9371-phy")
        self._rxadc = self._ctx.find_device("axi-ad9371-rx-hpc")
        self._rxobs = self._ctx.find_device("axi-ad9371-rx-obs-hpc")
        self._txdac = self._ctx.find_device("axi-ad9371-tx-hpc")

        rx_tx.__init__(self, self.rx_enabled_channels, self.tx_enabled_channels)
Exemplo n.º 29
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)

        self._rxadc = self._ctx.find_device("ad7768-1")
        self._ltc2606 = self._ctx.find_device("ltc2606")
        self._gpio = self._ctx.find_device("one-bit-adc-dac")
        self._ltc2308 = self._ctx.find_device("ltc2308")

        rx.__init__(self)
Exemplo n.º 30
0
    def __init__(self, uri=""):

        context_manager.__init__(self, uri, self._device_name)
        self._ctrl = self._ctx.find_device("adxl345")
        self.accel_x = self._channel(self._ctrl, "accel_x")
        self.accel_y = self._channel(self._ctrl, "accel_y")
        self.accel_z = self._channel(self._ctrl, "accel_z")
        self._rxadc = self._ctx.find_device("adxl345")
        self._rx_channel_names = ["accel_x", "accel_y", "accel_z"]
        rx.__init__(self)