Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions adi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
from adi.ada4961 import ada4961
from adi.adaq8092 import adaq8092
from adi.adar1000 import adar1000, adar1000_array
from adi.adf4030 import adf4030
from adi.adf4159 import adf4159
from adi.adf4355 import adf4355
from adi.adf4371 import adf4371
Expand Down Expand Up @@ -98,6 +99,7 @@
from adi.adxl355 import adxl355
from adi.adxl380 import adxl380
from adi.adxrs290 import adxrs290
from adi.axi_aion_trig import axi_aion_trig
from adi.cn0511 import cn0511
from adi.cn0532 import cn0532
from adi.cn0554 import cn0554
Expand All @@ -115,6 +117,7 @@
from adi.fmcomms5 import FMComms5
from adi.fmcomms11 import FMComms11
from adi.gen_mux import genmux
from adi.hmc7044 import hmc7044
from adi.lm75 import lm75
from adi.ltc2314_14 import ltc2314_14
from adi.ltc2387 import ltc2387
Expand Down
36 changes: 34 additions & 2 deletions adi/ad9084.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from adi.context_manager import context_manager
from adi.obs import obs, remap, tx_two
from adi.rx_tx import rx_tx
from adi.sync_start import sync_start
from adi.sync_start import sync_start, sync_start_b


def _map_to_dict(paths, ch):
Expand Down Expand Up @@ -56,7 +56,7 @@ def ignorealt(w):
return chans_names_out


class ad9084(rx_tx, context_manager, sync_start):
class ad9084(rx_tx, context_manager, sync_start, sync_start_b):
"""AD9084 Mixed-Signal Front End (MxFE)"""

_complex_data = True
Expand Down Expand Up @@ -188,6 +188,7 @@ def __init__(

rx_tx.__init__(self)
sync_start.__init__(self)
sync_start_b.__init__(self)
self.rx_buffer_size = 2 ** 16

def _get_iio_attr_str_single(self, channel_name, attr, output):
Expand Down Expand Up @@ -281,6 +282,22 @@ def rx_main_nco_phases(self, value):
self._rx_coarse_ddc_channel_names, "main_nco_phase", False, value,
)

@property
def rx_main_tb1_6db_digital_gain_en(self):
"""main_tb1_6db_digital_gain_en: Receive path coarse DDC NCO phases"""
return self._get_iio_attr_vec(
self._rx_coarse_ddc_channel_names, "main_tb1_6db_digital_gain_en", False
)

@rx_main_tb1_6db_digital_gain_en.setter
def rx_main_tb1_6db_digital_gain_en(self, value):
self._set_iio_attr_int_vec(
self._rx_coarse_ddc_channel_names,
"main_tb1_6db_digital_gain_en",
False,
value,
)

@property
def rx_test_mode(self):
"""rx_test_mode: NCO Test Mode"""
Expand Down Expand Up @@ -459,6 +476,21 @@ def tx_ddr_offload(self):
def tx_ddr_offload(self, value):
self._set_iio_debug_attr_str("pl_ddr_fifo_enable", str(value * 1), self._txdac)

@property
def tx_b_ddr_offload(self):
"""tx_b_ddr_offload: Enable DDR offload

When true the DMA will pass buffers into the BRAM FIFO for data repeating.
This is necessary when operating at high DAC sample rates. This can reduce
the maximum buffer size but data passed to DACs in cyclic mode will not
underflow due to memory bottlenecks.
"""
return self._get_iio_debug_attr("pl_ddr_fifo_enable", self._txdac2)

@tx_b_ddr_offload.setter
def tx_b_ddr_offload(self, value):
self._set_iio_debug_attr_str("pl_ddr_fifo_enable", str(value * 1), self._txdac2)

@property
def rx_sample_rate(self):
"""rx_sampling_frequency: Sample rate after decimation"""
Expand Down
110 changes: 110 additions & 0 deletions adi/adf4030.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright (C) 2025 Analog Devices, Inc.
#
# SPDX short identifier: ADIBSD


from adi.attribute import attribute
from adi.context_manager import context_manager


class adf4030(context_manager, attribute):
"""
This class provides an interface to the ADF4030 device via the IIO framework.

Args:
uri (str, optional): URI of the IIO context. Defaults to "".

Attributes:
_device_name (str): Name of the IIO device ("adf4030").
_ctrl: Reference to the IIO device controller.
_attrs (list): List of supported channel attributes.

Properties:
in_temp0_input (float): Returns the temperature sensor input value.

Dynamic Channel Properties:
For each channel with an ID starting with "altvoltage", the following
properties are dynamically created (where <name> is the channel label
or ID):

<name>_duty_cycle (float): Duty cycle of the channel.
<name>_frequency (float): Frequency of the channel.
<name>_label (str): Label of the channel.
<name>_output_enable (bool): Output enable status of the channel.
<name>_phase (float): Phase of the channel.
<name>_reference_channel (int): Reference channel index.
<name>_autoalign_iteration (int): Auto-align iteration value.
<name>_autoalign_threshold (float): Auto-align threshold value.
<name>_autoalign_threshold_en (bool): Enable/disable auto-align threshold.
<name>_background_serial_alignment_en (bool): Enable/disable background serial alignment.
<name>_oversampling_ratio (int): Oversampling ratio.
<name>_oversampling_ratio_available (list): List of available oversampling ratios.

Raises:
Exception: If the ADF4030 device is not found in the IIO context.

Methods:
_make_channel_property(channel, attr): Creates a property for a given channel and attribute.
_add_channel_properties(): Adds dynamic properties for each supported channel and attribute.

Example:
>>> from adi.hmc7044 import adf4030
>>> dev = adf4030(uri="ip:192.168.2.1")
>>> print(dev.in_temp0_input)
>>> dev.altvoltage0_frequency = 10000000
>>> print(dev.altvoltage0_frequency)
"""

_device_name = "adf4030"

def __init__(self, uri=""):
context_manager.__init__(self, uri, self._device_name)
self._ctrl = self._ctx.find_device(self._device_name)
if not self._ctrl:
raise Exception("ADF4030 device not found")
self._add_channel_properties()

@property
def in_temp0_input(self):
return self._get_iio_attr("temp0", "input", False, self._ctrl)

def _make_channel_property(self, channel, attr):
def getter(self):
return self._get_iio_attr(channel, attr, True, self._ctrl)

def setter(self, value):
self._set_iio_attr(channel, attr, True, value, self._ctrl)

return property(getter, setter)

# List of channels and their attributes
_attrs = [
"duty_cycle",
"frequency",
"label",
"output_enable",
"phase",
"reference_channel",
"autoalign_iteration",
"autoalign_threshold",
"autoalign_threshold_en",
"background_serial_alignment_en",
"oversampling_ratio",
"oversampling_ratio_available",
]

def _add_channel_properties(self):
for ch in self._ctrl.channels:
if not ch._id.startswith("altvoltage"):
continue

if "label" in ch.attrs:
name = ch.attrs["label"].value
else:
name = ch._id

for attr in self._attrs:
prop_name = f"{name}_{attr}"
setattr(
self.__class__, prop_name, self._make_channel_property(ch._id, attr)
)
95 changes: 95 additions & 0 deletions adi/axi_aion_trig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright (C) 2025 Analog Devices, Inc.
#
# SPDX short identifier: ADIBSD


from adi.attribute import attribute
from adi.context_manager import context_manager


class axi_aion_trig(context_manager, attribute):
"""axi_aion_trig IIO Device Interface

This class provides an interface to the 'axi_aion_trig' IIO device, allowing
control and monitoring of its voltage channels and associated attributes.

Parameters
----------
uri : str, optional
URI of the IIO context to connect to. Defaults to an empty string.

Attributes (per voltage channel)
--------------------------------
For each voltage channel (e.g., voltage0, voltage1, ...), the following
properties are dynamically created:

- trig{N}_en : bool
Enable or disable the trigger for channel N.
- trig{N}_phase : int
Phase setting for channel N.
- trig{N}_status : int
Status of the trigger for channel N.
- trig{N}_frequency : int
Frequency setting for channel N.
- trig{N}_internal_bsync_enable : bool
Enable or disable internal bsync for channel N.
- trig{N}_output_enable : bool
Enable or disable output for channel N.
- trig{N}_trigger_now : bool
Trigger an immediate event on channel N.
- trig{N}_trigger_select_gpio_enable : bool
Enable or disable GPIO selection for trigger on channel N.

Raises
------
Exception
If the 'axi_aion_trig' device is not found in the IIO context.

Examples
--------
>>> trig = axi_aion_trig("ip:192.168.1.100")
>>> trig.trig0_en = True
>>> print(trig.trig0_status)
"""

_device_name = "axi_aion_trig"

def __init__(self, uri=""):
context_manager.__init__(self, uri, self._device_name)
self._ctrl = self._ctx.find_device(self._device_name)
if not self._ctrl:
raise Exception("axi_aion_trig device not found")
self._add_channel_properties()

def _make_channel_property(self, channel, attr):
def getter(self):
return self._get_iio_attr(channel, attr, False, self._ctrl)

def setter(self, value):
self._set_iio_attr(channel, attr, False, value, self._ctrl)

return property(getter, setter)

# Attributes for in_voltage channels and device properties
_attrs = [
"en",
"phase",
"status",
"frequency",
"internal_bsync_enable",
"output_enable",
"trigger_now",
"trigger_select_gpio_enable",
]

def _add_channel_properties(self):
for ch in self._ctrl.channels:
if not ch._id.startswith("voltage"):
continue
name = ch._id.replace("voltage", "")

for attr in self._attrs:
prop_name = f"trig{name}_{attr}"
setattr(
self.__class__, prop_name, self._make_channel_property(ch._id, attr)
)
Loading
Loading