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

adi:ad4170: Add support for ad4170 #579

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

jansunil
Copy link
Contributor

@jansunil jansunil commented Jun 14, 2024

  1. Add pyadi driver for ad4170 family
  2. Add example script for data capture with ad4170
  3. Add documentation

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

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:
  • OS:

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

@jansunil jansunil force-pushed the add-support-to-ad4170 branch 4 times, most recently from a117d2a to e1436bd Compare June 18, 2024 08:55
@jansunil
Copy link
Contributor Author

Changelog: Fixed pylint and build errors

@jansunil
Copy link
Contributor Author

@tfcollins - Could you please review these changes when you get a chance?

@tfcollins tfcollins self-requested a review June 20, 2024 17:42
""" AD4170 ADC """

_complex_data = False
channels = [] # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to be defined or reset (set to []) in the constructor. Otherwise you cannot use multiple instances of this class in the same session.

adi/ad4170.py Outdated
self._set_iio_attr(self.name, "scale", False, str(Decimal(value).real))

def to_volts(self, index, val):
"""Converts raw value to SI"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Inputs need documentation

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 minor changes needed

@jansunil jansunil force-pushed the add-support-to-ad4170 branch 2 times, most recently from fc15a70 to 8145d5b Compare June 21, 2024 04:37
@jansunil
Copy link
Contributor Author

Changelog: Addressed review comments

  1. Added documentation for to_volts function
  2. reset channels in the constructor

@jansunil
Copy link
Contributor Author

@tfcollins - Do these changes look good now?

adi/ad4170.py Outdated
Comment on lines 7 to 35
#
# 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.

Sorry missed this the first time. This long form license can be removed. Just need the SPDX line

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 license blurb update and we'll merge

1. Add pyadi driver for ad4170 family
2. Add example script for data capture with ad4170
3. Add documentation

Signed-off-by: Janani Sunil <[email protected]>
@jansunil jansunil force-pushed the add-support-to-ad4170 branch from 8145d5b to 3e95767 Compare June 25, 2024 03:43
@jansunil
Copy link
Contributor Author

Changelog: Address review comments

  1. Correct the license header for ad4170.py
  2. Rebase with analogdevicesinc/pyadi-iio/ main

@tfcollins tfcollins merged commit eddc048 into analogdevicesinc:main Jun 26, 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.

2 participants