Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ad738x driver, test script, example code, rst file and emu xml. #583

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

spectrum70
Copy link
Contributor

@spectrum70 spectrum70 commented Jul 25, 2024

Description

Add support for the ad738x serie.

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?


pytest -v --hw=ad7381 --emu --emu-xml=./test/emu/devices/ad7381.xml ./test/test_ad738x.py
================================================================ test session starts =================================================================
platform linux -- Python 3.11.9, pytest-8.2.2, pluggy-1.5.0 -- /home/angelo/dev-baylibre/adi/pyadi-iio/.venv/bin/python3.11
cachedir: .pytest_cache
metadata: {'Python': '3.11.9', 'Platform': 'Linux-6.5.0-rc2-devel-00345-gc2782531397f-x86_64-with-glibc2.39', 'Packages': {'pytest': '8.2.2', 'pluggy': '1.5.0'}, 'Plugins': {'libiio': '0.0.18', 'cov': '5.0.0', 'metadata': '3.1.1', 'html': '3.2.0'}}
rootdir: /home/angelo/dev-baylibre/adi/pyadi-iio
configfile: pyproject.toml
plugins: libiio-0.0.18, cov-5.0.0, metadata-3.1.1, html-3.2.0
collected 1 item                                                                                                                                     

test/test_ad738x.py::test_ad738x_rx_data[1-adi.ad738x] SKIPPED (Test not valid in emulation mode)                                              [100%]

================================================================= 1 skipped in 3.06s =================================================================
Server stopped


invoke precommit
Running supported_parts check
No parts missing from supported_parts.md
---------------

pre-commit run --all-files
codespell................................................................Passed
isort....................................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Check for merge conflicts................................................Passed
Debug Statements (Python)................................................Passed
Check docstring is first.................................................Passed
Flake8...................................................................Passed
black....................................................................Passed
blacken-docs.............................................................Passed
Insert license in comments...............................................Passed

example on target  (*)
$ python3 -m ad738x_example
{'voltage0-voltage1': array([-1193.59130785, -1193.18847582, -1193.18847582, ...,
       -1193.18847582, -1193.59130785, -1193.99413988]), 'voltage2-voltage3': array([ 1649.99999898,     0.        ,     0.        , ...,
       -3299.99999795, -1649.99999898,  1649.99999898])}

(*)
Example on target requires:

  1. to set uri as the target board uri
  2. on target board:
    cd /sys/bus/iio/devices/iio:device0/
    mkdir /sys/kernel/config/iio/triggers/hrtimer/ad7380_timer
    echo ad7380_timer > trigger/current_trigger && iio_attr -d ad7380_timer sampling_frequency 10000

Test Configuration:

  • Hardware: Host PC, arch linux, target Zynq zed
  • OS: arch linux

uImage/devicetree/BOOT.BIN as in
https://baylibre.atlassian.net/browse/ADI-424

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

@threexc
Copy link
Contributor

threexc commented Jul 25, 2024

Looks good to me.

@spectrum70
Copy link
Contributor Author

Hi @tfcollins ,
could you maybe have a look ? Thanks.

test/test_ad738x.py Outdated Show resolved Hide resolved
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.

Just some monitor tweaks needed

@spectrum70
Copy link
Contributor Author

Hi @tfcollins,

  • fixed above points
  • re-run all the tests above

ytest -v --hw=ad7381 --emu --emu-xml=./test/emu/devices/ad7381.xml ./test/test_ad738x.py
================================================= test session starts ==================================================
platform linux -- Python 3.11.9, pytest-8.2.2, pluggy-1.5.0 -- /home/angelo/dev-baylibre/adi/pyadi-iio/.venv/bin/python3.11
cachedir: .pytest_cache
metadata: {'Python': '3.11.9', 'Platform': 'Linux-6.5.0-rc2-devel-00345-gc2782531397f-x86_64-with-glibc2.40', 'Packages': {'pytest': '8.2.2', 'pluggy': '1.5.0'}, 'Plugins': {'libiio': '0.0.18', 'cov': '5.0.0', 'metadata': '3.1.1', 'html': '3.2.0'}}
rootdir: /home/angelo/dev-baylibre/adi/pyadi-iio
configfile: pyproject.toml
plugins: libiio-0.0.18, cov-5.0.0, metadata-3.1.1, html-3.2.0
collected 1 item                                                                                                       

test/test_ad738x.py::test_ad738x_rx_data[1-adi.ad738x] SKIPPED (Test not valid in emulation mode)                [100%]

================================================== 1 skipped in 3.06s ==================================================

invoke precommit
Running supported_parts check
No parts missing from supported_parts.md
------------------------



pre-commit run --all-files
codespell................................................................Passed
isort....................................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Check for merge conflicts................................................Passed
Debug Statements (Python)................................................Passed
Check docstring is first.................................................Passed
Flake8...................................................................Passed
black....................................................................Passed
blacken-docs.............................................................Passed
Insert license in comments...............................................Passed

Thanks

@spectrum70 spectrum70 requested a review from tfcollins August 22, 2024 19:24
@tfcollins tfcollins merged commit 37563ff into analogdevicesinc:main Aug 22, 2024
26 checks passed
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