Skip to content

ad4080: add pyadi-iio support#669

Merged
tfcollins merged 2 commits intomainfrom
ad4080_main
Sep 16, 2025
Merged

ad4080: add pyadi-iio support#669
tfcollins merged 2 commits intomainfrom
ad4080_main

Conversation

@amiclaus
Copy link
Contributor

Description

Add support for ad4080.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Hardware: EVAL-AD4080 + Zedboard
  • OS: Linux

Documentation

If this is a new feature or example please mention or link any documentation. All new hardware interface classes require documentation.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have signed off all commits and they contain "Signed-off by: "
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@amiclaus amiclaus requested a review from tfcollins May 21, 2025 13:37
@amiclaus amiclaus self-assigned this May 21, 2025
@github-actions
Copy link

Generated documentation for this PR is available at Link

@github-actions
Copy link

github-actions bot commented May 21, 2025

Test Results

1 690 tests  +2     439 ✅ +1   11m 46s ⏱️ -1s
    1 suites ±0   1 251 💤 +1 
    1 files   ±0       0 ❌ ±0 

Results for commit 4791340. ± Comparison against base commit 9653f85.

This pull request removes 4 and adds 6 tests. Note that renamed tests count towards both.
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=rx_hardwaregain_chan0-val=[1.0, 0.0, 12.0, 15.0, 6.5, 31.0, 3.5, 31.5, 27.5, 22.5]-depends={'gain_control_mode_chan1': 'spi', 'rx_ensm_mode_chan1': 'rf_enabled'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=rx_hardwaregain_chan0-val=[4.5, 1.5, 12.5, 23.5, 9.5, 11.0, 14.5, 26.0, 18.5, 32.0]-depends={'gain_control_mode_chan0': 'spi', 'rx_ensm_mode_chan0': 'rf_enabled'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=tx_hardwaregain_chan0-val=[-23.0, -5.5, -21.5, -10.65, -22.05, -33.1, -7.5, -38.1, -12.8, -31.6]-depends={'atten_control_mode_chan0': 'spi'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=tx_hardwaregain_chan1-val=[-30.35, -25.1, -36.0, -27.2, -29.7, -30.15, -6.4, -9.3, -36.85, -25.1]-depends={'atten_control_mode_chan1': 'spi'}-classname=adi.adrv9002]
test.test_ad4080 ‑ test_ad4080_attr[attr=filter_type-val=['none', 'sinc1', 'sinc5', 'sinc5+pf1']-classname=adi.ad4080]
test.test_ad4080 ‑ test_ad4080_rx_data[channel=0-classname=adi.ad4080]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=rx_hardwaregain_chan0-val=[33.5, 30.0, 27.5, 25.0, 4.5, 12.5, 32.0, 18.0, 18.5, 28.5]-depends={'gain_control_mode_chan0': 'spi', 'rx_ensm_mode_chan0': 'rf_enabled'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=rx_hardwaregain_chan0-val=[8.0, 26.5, 1.0, 31.5, 26.0, 14.0, 1.0, 18.0, 17.0, 32.0]-depends={'gain_control_mode_chan1': 'spi', 'rx_ensm_mode_chan1': 'rf_enabled'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=tx_hardwaregain_chan0-val=[-9.7, -39.2, -39.45, -28.95, -31.45, -2.95, -5.4, -15.45, -8.25, -8.25]-depends={'atten_control_mode_chan0': 'spi'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=tx_hardwaregain_chan1-val=[-23.9, -18.55, -7.9, -17.6, -4.75, -32.3, -18.5, -34.2, -18.9, -20.0]-depends={'atten_control_mode_chan1': 'spi'}-classname=adi.adrv9002]

♻️ This comment has been updated with latest results.

adi/ad4080.py Outdated
Comment on lines +6 to +35
# 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont need the full license with the SPDX there

Copy link
Collaborator

@tfcollins tfcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License just needs updating. If you also want to add testing to the properties that would increase test usefulness

@amiclaus amiclaus force-pushed the ad4080_main branch 7 times, most recently from c5a07b4 to 13bdf8b Compare May 23, 2025 11:56
Copy link
Contributor Author

@amiclaus amiclaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2:

  • use short version for license
  • improve tests

@thorenscientific
Copy link
Contributor

I verified that this also works with @nacuna-adi 's tinyiiod server running on MAX3266: analogdevicesinc/no-OS#2697

borderaxespad=0.0,
)

plt.show()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it good practice to put del my_adc at the end? I find at least with serial backend, the script won't run multiple times if the context is left connected. I've tried some basic if my_adc is None and try my_adc constructs, but nothing seems to work cleanly.

Add support for ad4080.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Copy link
Contributor Author

@amiclaus amiclaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v3:

  • add del my_adc at the end of the example

@tfcollins tfcollins merged commit 1e446e2 into main Sep 16, 2025
33 of 44 checks passed
@tfcollins tfcollins deleted the ad4080_main branch September 16, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants