-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ad353xr.py driver Add example code, test script Update index.rst, init.py, supported_parts.md files Add xml emu context file Update hardware_map.yml file for test emulation Signed-off-by: SGudla <Saikiran.Gudla@analog.com>
1 parent
39a62ea
commit 2c83b70
Showing
9 changed files
with
448 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,305 @@ | ||
# Copyright (C) 2025 Analog Devices, Inc. | ||
# | ||
# SPDX short identifier: ADIBSD | ||
# Copyright (C) 2025 Analog Devices, Inc. | ||
# | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without modification, | ||
# are permitted provided that the following conditions are met: | ||
# - Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# - Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in | ||
# the documentation and/or other materials provided with the | ||
# distribution. | ||
# - Neither the name of Analog Devices, Inc. nor the names of its | ||
# contributors may be used to endorse or promote products derived | ||
# from this software without specific prior written permission. | ||
# - The use of this software may or may not infringe the patent rights | ||
# of one or more patent holders. This license does not release you | ||
# from the requirement that you obtain separate licenses from these | ||
# patent holders to use this software. | ||
# - Use of the software either in source or binary form, must be run | ||
# on or directly connected to an Analog Devices Inc. component. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
# INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A | ||
# PARTICULAR PURPOSE ARE DISCLAIMED. | ||
# | ||
# IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY | ||
# RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
from decimal import Decimal | ||
|
||
from adi.attribute import attribute | ||
from adi.context_manager import context_manager | ||
from adi.rx_tx import tx | ||
|
||
|
||
class ad353xr(tx, context_manager): | ||
""" AD353xr DAC """ | ||
|
||
_complex_data = False | ||
channel = [] # type: ignore | ||
_device_name = "" | ||
|
||
def __init__(self, uri="", device_name=""): | ||
"""Constructor for AD353xr class.""" | ||
context_manager.__init__(self, uri, self._device_name) | ||
|
||
compatible_parts = ["ad3530r"] | ||
|
||
self._ctrl = None | ||
|
||
if not device_name: | ||
device_name = compatible_parts[0] | ||
else: | ||
if device_name not in compatible_parts: | ||
raise Exception( | ||
f"Not a compatible device: {device_name}. Supported device names " | ||
f"are: {','.join(compatible_parts)}" | ||
) | ||
|
||
# Select the device matching device_name as working device | ||
for device in self._ctx.devices: | ||
if device.name == device_name: | ||
self._ctrl = device | ||
self._txdac = device | ||
break | ||
|
||
if not self._ctrl: | ||
raise Exception("Error in selecting matching device") | ||
|
||
if not self._txdac: | ||
raise Exception("Error in selecting matching device") | ||
|
||
self.output_bits = [] | ||
for ch in self._ctrl.channels: | ||
name = ch.id | ||
self.output_bits.append(ch.data_format.bits) | ||
self._tx_channel_names.append(name) | ||
self.channel.append(self._channel(self._ctrl, name)) | ||
|
||
tx.__init__(self) | ||
|
||
### Add device attributes here ### | ||
|
||
@property | ||
def sampling_frequency(self): | ||
"""AD353xr sampling frequency config""" | ||
return self._get_iio_dev_attr_str("sampling_frequency") | ||
|
||
@sampling_frequency.setter | ||
def sampling_frequency(self, value): | ||
self._set_iio_dev_attr_str("sampling_frequency", value) | ||
|
||
@property | ||
def all_ch_operating_mode_avail(self): | ||
"""AD353xr all channels operating mode available""" | ||
return self._get_iio_dev_attr_str("all_ch_operating_mode_available") | ||
|
||
@property | ||
def all_ch_operating_mode(self): | ||
"""AD353xr all channels operating mode config""" | ||
return self._get_iio_dev_attr_str("all_ch_operating_mode") | ||
|
||
@all_ch_operating_mode.setter | ||
def all_ch_operating_mode(self, value): | ||
if value in self.all_ch_operating_mode_avail: | ||
self._set_iio_dev_attr_str("all_ch_operating_mode", value) | ||
else: | ||
raise ValueError( | ||
"Error: Operating mode not supported \nUse one of: " | ||
+ str(self.all_ch_operating_mode_avail) | ||
) | ||
|
||
@property | ||
def all_ch_input_registers(self): | ||
"""AD353xr all input registers config""" | ||
return self._get_iio_dev_attr_str("all_ch_input_registers") | ||
|
||
@all_ch_input_registers.setter | ||
def all_input_registers(self, value): | ||
self._set_iio_dev_attr_str("all_ch_input_registers", value) | ||
|
||
@property | ||
def all_ch_raw(self): | ||
"""AD353xr all dac registers config""" | ||
return self._get_iio_dev_attr_str("all_ch_raw") | ||
|
||
@all_ch_raw.setter | ||
def all_ch_raw(self, value): | ||
self._set_iio_dev_attr_str("all_ch_raw", value) | ||
|
||
@property | ||
def reference_select_available(self): | ||
"""AD353xr reference voltage available""" | ||
return self._get_iio_dev_attr_str("reference_select_available") | ||
|
||
@property | ||
def reference_select(self): | ||
"""AD353xr reference voltage config""" | ||
return self._get_iio_dev_attr_str("reference_select") | ||
|
||
@reference_select.setter | ||
def reference_select(self, value): | ||
if value in self.reference_select_available: | ||
self._set_iio_dev_attr_str("reference_select", value) | ||
else: | ||
raise ValueError( | ||
"Error: Reference select not supported \nUse one of: " | ||
+ str(self.reference_select_available) | ||
) | ||
|
||
@property | ||
def sw_ldac_trigger_avail(self): | ||
"""AD353xr sw_ldac_trigger available""" | ||
return self._get_iio_dev_attr_str("sw_ldac_trigger_available") | ||
|
||
@property | ||
def sw_ldac_trigger(self): | ||
"""AD353xr software ldac trigger config""" | ||
return self._get_iio_dev_attr_str("sw_ldac_trigger") | ||
|
||
@sw_ldac_trigger.setter | ||
def sw_ldac_trigger(self, value): | ||
if value in self.sw_ldac_trigger_avail: | ||
self._set_iio_dev_attr_str("sw_ldac_trigger", value) | ||
else: | ||
raise ValueError( | ||
"Error: Trigger value not supported \nUse one of: " | ||
+ str(self.sw_ldac_trigger_avail) | ||
) | ||
|
||
@property | ||
def hw_ldac_trigger_avail(self): | ||
"""AD353xr hw_ldac_trigger available""" | ||
return self._get_iio_dev_attr_str("hw_ldac_trigger_available") | ||
|
||
@property | ||
def hw_ldac_trigger(self): | ||
"""AD353xr hardware ldac trigger config""" | ||
return self._get_iio_dev_attr_str("hw_ldac_trigger") | ||
|
||
@hw_ldac_trigger.setter | ||
def hw_ldac_trigger(self, value): | ||
if value in self.hw_ldac_trigger_avail: | ||
self._set_iio_dev_attr_str("hw_ldac_trigger", value) | ||
else: | ||
raise ValueError( | ||
"Error: Trigger value not supported \nUse one of: " | ||
+ str(self.hw_ldac_trigger_avail) | ||
) | ||
|
||
@property | ||
def range_avail(self): | ||
"""AD353xr range available""" | ||
return self._get_iio_dev_attr_str("range_available") | ||
|
||
@property | ||
def range(self): | ||
"""AD353xr range config""" | ||
return self._get_iio_dev_attr_str("range") | ||
|
||
@range.setter | ||
def range(self, value): | ||
if value in self.range_avail: | ||
self._set_iio_dev_attr_str("range", value) | ||
else: | ||
raise ValueError( | ||
"Error: Range option not supported \nUse one of: " | ||
+ str(self.range_avail) | ||
) | ||
|
||
@property | ||
def mux_out_select_avail(self): | ||
"""AD353xr mux_out_select available""" | ||
return self._get_iio_dev_attr_str("mux_out_select_available") | ||
|
||
@property | ||
def mux_out_select(self): | ||
"""AD353xr mux out select""" | ||
return self._get_iio_dev_attr_str("mux_out_select") | ||
|
||
@mux_out_select.setter | ||
def mux_out_select(self, value): | ||
if value in self.mux_out_select_avail: | ||
self._set_iio_dev_attr_str("mux_out_select", value) | ||
else: | ||
raise ValueError( | ||
"Error: Mux output option not supported \nUse one of: " | ||
+ str(self.mux_out_select_avail) | ||
) | ||
|
||
############################################################################ | ||
|
||
class _channel(attribute): | ||
"""AD353xr channel""" | ||
|
||
def __init__(self, ctrl, channel_name): | ||
self.name = channel_name | ||
self._ctrl = ctrl | ||
|
||
### Add channel attributes here ### | ||
@property | ||
def input_register(self): | ||
"""AD353xr channel input register value""" | ||
return self._get_iio_attr(self.name, "input_register", True) | ||
|
||
@input_register.setter | ||
def input_register(self, value): | ||
self._set_iio_attr(self.name, "input_register", True, str(int(value))) | ||
|
||
@property | ||
def raw(self): | ||
"""AD353xr channel raw value""" | ||
return self._get_iio_attr(self.name, "raw", True) | ||
|
||
@raw.setter | ||
def raw(self, value): | ||
self._set_iio_attr(self.name, "raw", True, str(int(value))) | ||
|
||
@property | ||
def offset(self): | ||
"""AD353xr channel offset""" | ||
return self._get_iio_attr(self.name, "offset", True) | ||
|
||
@offset.setter | ||
def offset(self, value): | ||
self._set_iio_attr(self.name, "offset", True, str(Decimal(value).real)) | ||
|
||
@property | ||
def scale(self): | ||
"""AD353xr channel scale""" | ||
return self._get_iio_attr(self.name, "scale", True) | ||
|
||
@scale.setter | ||
def scale(self, value): | ||
self._set_iio_attr(self.name, "scale", True, str(Decimal(value).real)) | ||
|
||
@property | ||
def operating_mode_avail(self): | ||
"""AD353xr channel operating mode settings""" | ||
return self._get_iio_attr_str(self.name, "operating_mode_available", True) | ||
|
||
@property | ||
def operating_mode(self): | ||
"""AD353xr channel operating mode""" | ||
return self._get_iio_attr_str(self.name, "operating_mode", True) | ||
|
||
@operating_mode.setter | ||
def operating_mode(self, value): | ||
if value in self.operating_mode_avail: | ||
self._set_iio_attr(self.name, "operating_mode", True, value) | ||
else: | ||
raise ValueError( | ||
"Error: Operating mode not supported \nUse one of: " | ||
+ str(self.operating_mode_avail) | ||
) | ||
|
||
##################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ad353xr | ||
================= | ||
|
||
.. automodule:: adi.ad353xr | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ Supported Devices | |
|
||
adi.QuadMxFE_multi | ||
adi.ad2s1210 | ||
adi.ad353xr | ||
adi.ad3552r | ||
adi.ad4020 | ||
adi.ad405x | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Copyright (C) 2025 Analog Devices, Inc. | ||
# | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without modification, | ||
# are permitted provided that the following conditions are met: | ||
# - Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# - Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in | ||
# the documentation and/or other materials provided with the | ||
# distribution. | ||
# - Neither the name of Analog Devices, Inc. nor the names of its | ||
# contributors may be used to endorse or promote products derived | ||
# from this software without specific prior written permission. | ||
# - The use of this software may or may not infringe the patent rights | ||
# of one or more patent holders. This license does not release you | ||
# from the requirement that you obtain separate licenses from these | ||
# patent holders to use this software. | ||
# - Use of the software either in source or binary form, must be run | ||
# on or directly connected to an Analog Devices Inc. component. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
# INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A | ||
# PARTICULAR PURPOSE ARE DISCLAIMED. | ||
# | ||
# IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY | ||
# RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
import argparse | ||
|
||
from adi.ad353xr import ad353xr | ||
|
||
|
||
def main(): | ||
# Set up argument parser | ||
parser = argparse.ArgumentParser(description="AD353XR Example Script") | ||
parser.add_argument( | ||
"--uri", | ||
type=str, | ||
help="The URI for the AD353XR device", | ||
default="serial:COM7,230400,8n1", | ||
) | ||
parser.add_argument( | ||
"--device_name", | ||
type=str, | ||
choices=["ad3530r"], | ||
help="The device name (Supported devices are ad3530r)", | ||
default="ad3530r", | ||
) | ||
|
||
# Parse arguments | ||
args = parser.parse_args() | ||
|
||
# Set up AD3530R | ||
ad3530r_dev = ad353xr(uri=args.uri, device_name=args.device_name) | ||
ad3530r_dev.all_ch_operating_mode = "normal_operation" | ||
|
||
ad3530r_dev.reference_select = "internal_ref" | ||
|
||
# Configure channel 0 | ||
chn_num = 0 | ||
ad3530r_chan = ad3530r_dev.channel[chn_num] | ||
|
||
# Update dac output for channel 0 instantaneously using the 'raw' attribute | ||
ad3530r_chan.raw = 25000 | ||
|
||
# Update dac output for channel 0 using software LDAC operation | ||
ad3530r_chan.input_register = 5000 | ||
ad3530r_dev.sw_ldac_trigger = "ldac_trigger" | ||
|
||
# Update dac output of channel 0 using hardware LDAC operation | ||
ad3530r_chan.input_register = 40000 | ||
ad3530r_dev.hw_ldac_trigger = "ldac_trigger" | ||
|
||
# Set mux value to "vout0" to monitor vout0 value on the mux_out pin | ||
ad3530r_dev.mux_out_select = "VOUT0" | ||
|
||
# Set 0 to 2Vref as output range | ||
ad3530r_dev.range = "0_to_2VREF" | ||
|
||
# Determine output voltage using scale and offset | ||
raw = int(ad3530r_chan.raw) | ||
scale = float(ad3530r_chan.scale) | ||
offset = int(ad3530r_chan.offset) | ||
print(f"Channel{chn_num} voltage in Volts: {(raw + offset) * scale/1000}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE context [<!ELEMENT context (device | context-attribute)*><!ELEMENT context-attribute EMPTY><!ELEMENT device (channel | attribute | debug-attribute | buffer-attribute)*><!ELEMENT channel (scan-element?, attribute*)><!ELEMENT attribute EMPTY><!ELEMENT scan-element EMPTY><!ELEMENT debug-attribute EMPTY><!ELEMENT buffer-attribute EMPTY><!ATTLIST context name CDATA #REQUIRED description CDATA #IMPLIED><!ATTLIST context-attribute name CDATA #REQUIRED value CDATA #REQUIRED><!ATTLIST device id CDATA #REQUIRED name CDATA #IMPLIED><!ATTLIST channel id CDATA #REQUIRED type (input|output) #REQUIRED name CDATA #IMPLIED><!ATTLIST scan-element index CDATA #REQUIRED format CDATA #REQUIRED scale CDATA #IMPLIED><!ATTLIST attribute name CDATA #REQUIRED filename CDATA #IMPLIED><!ATTLIST debug-attribute name CDATA #REQUIRED><!ATTLIST buffer-attribute name CDATA #REQUIRED>]><context name="xml" description="no-OS/projects/NO_OS_PROJECT NO_OS_VERSION" ><context-attribute name="fw_version" value="6b3592a6adf" /><context-attribute name="hw_carrier" value="SDP_K1" /><context-attribute name="hw_mezzanine" value="EVAL-AD3530RARDZ" /><context-attribute name="hw_name" value="EVAL-AD3530RARDZ" /><context-attribute name="uri" value="serial:/dev/ttyS0,230400,8n1n" /><context-attribute name="serial,port" value="/dev/ttyS0" /><context-attribute name="serial,description" value="ttyS0" /><device id="iio:device0" name="ad3530r"><channel id="voltage0" name="Ch0" type="output" ><scan-element index="0" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage0_input_register" value="0" /><attribute name="raw" filename="out_voltage0_raw" value="0" /><attribute name="scale" filename="out_voltage0_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage0_offset" value="0" /><attribute name="operating_mode" filename="out_voltage0_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage0_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage1" name="Ch1" type="output" ><scan-element index="1" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage1_input_register" value="0" /><attribute name="raw" filename="out_voltage1_raw" value="0" /><attribute name="scale" filename="out_voltage1_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage1_offset" /><attribute name="operating_mode" filename="out_voltage1_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage1_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage2" name="Ch2" type="output" ><scan-element index="2" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage2_input_register" value="0" /><attribute name="raw" filename="out_voltage2_raw" value="0" /><attribute name="scale" filename="out_voltage2_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage2_offset" value="0" /><attribute name="operating_mode" filename="out_voltage2_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage2_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage3" name="Ch3" type="output" ><scan-element index="3" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage3_input_register" value="0" /><attribute name="raw" filename="out_voltage3_raw" value="0" /><attribute name="scale" filename="out_voltage3_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage3_offset" value="0" /><attribute name="operating_mode" filename="out_voltage3_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage3_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage4" name="Ch4" type="output" ><scan-element index="4" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage4_input_register" value="0" /><attribute name="raw" filename="out_voltage4_raw" value="0" /><attribute name="scale" filename="out_voltage4_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage4_offset" value="0" /><attribute name="operating_mode" filename="out_voltage4_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage4_operating_mode_available" value="0" /></channel><channel id="voltage5" name="Ch5" type="output" ><scan-element index="5" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage5_input_register" value="0" /><attribute name="raw" filename="out_voltage5_raw" value="0" /><attribute name="scale" filename="out_voltage5_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage5_offset" value="0" /><attribute name="operating_mode" filename="out_voltage5_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage5_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage6" name="Ch6" type="output" ><scan-element index="6" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage6_input_register" value="0" /><attribute name="raw" filename="out_voltage6_raw" value="0" /><attribute name="scale" filename="out_voltage6_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage6_offset" value="0" /><attribute name="operating_mode" filename="out_voltage6_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage6_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage7" name="Ch7" type="output" ><scan-element index="7" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage7_input_register" value="0" /><attribute name="raw" filename="out_voltage7_raw" value="0" /><attribute name="scale" filename="out_voltage7_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage7_offset" value="0" /><attribute name="operating_mode" filename="out_voltage7_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage7_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /><attribute name="reference_select" value="external_ref" /><attribute name="reference_select_available" value="external_ref internal_ref" /><attribute name="range" value="0_to_VREF" /><attribute name="range_available" value="0_to_VREF 0_to_2VREF" /><attribute name="mux_out_select" value="powered_down" /><attribute name="mux_out_select_available" value="powered_down VOUT0 IOUT0_source IOUT0_sink VOUT1 IOUT1_source IOUT1_sink VOUT2 IOUT2_source IOUT2_sink VOUT3 IOUT3_source IOUT3_sink VOUT4 IOUT4_source IOUT4_sink VOUT5 IOUT5_source IOUT5_sink VOUT6 IOUT6_source IOUT6_sink VOUT7 IOUT7_source IOUT7_sink" /><attribute name="all_ch_operating_mode" value="32kOhm_to_gnd" /><attribute name="all_ch_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /><attribute name="all_ch_input_registers" value="0" /><attribute name="all_ch_raw" value="0" /><attribute name="sampling_frequency" value="562746" /><attribute name="sw_ldac_trigger" value="ldac_trigger" /><attribute name="sw_ldac_trigger_available" value="ldac_trigger" /><attribute name="hw_ldac_trigger" value="ldac_trigger" /><attribute name="hw_ldac_trigger_available" value="ldac_trigger" /><debug-attribute name="direct_reg_access" /></device></context> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
|
||
hardware = "ad3530r" | ||
classname = "adi.ad353xr" | ||
|
||
######################################### | ||
@pytest.mark.iio_hardware(hardware) | ||
@pytest.mark.parametrize("classname", [(classname)]) | ||
@pytest.mark.parametrize( | ||
"attr, start, stop, step, tol, repeats, sub_channel", | ||
[ | ||
("raw", 0, 20000, 2000, 1, 3, "voltage0"), | ||
("raw", 0, 20000, 2000, 1, 3, "voltage1"), | ||
], | ||
) | ||
def test_ad353xr_raw_attr( | ||
test_attribute_single_value, | ||
iio_uri, | ||
classname, | ||
attr, | ||
start, | ||
stop, | ||
step, | ||
tol, | ||
repeats, | ||
sub_channel, | ||
): | ||
test_attribute_single_value( | ||
iio_uri, classname, attr, start, stop, step, tol, repeats, sub_channel | ||
) |