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

ad7606 tweaks and updates #590

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Commits on Aug 26, 2024

  1. ad7606: oversampling attribute are _get_iio_dev_attr type

    With the upstream Linux version, the oversampling, oversampling_ratio
    attributes are available at device level.
    
    _get_iio_attr() is used for accessing channel attributes.
    
    Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
    commodo committed Aug 26, 2024
    Configuration menu
    Copy the full SHA
    ca601fd View commit details
    Browse the repository at this point in the history
  2. ad7606: remove non-existing range attributes

    There seems to be a confusion between scale and range.
    In the case of AD7606, the range (specified in the datasheet) determines
    the scale of the device (or the channel in some cases).
    
    Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
    commodo committed Aug 26, 2024
    Configuration menu
    Copy the full SHA
    14bd599 View commit details
    Browse the repository at this point in the history
  3. ad7606: init self._device_name member

    Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
    commodo committed Aug 26, 2024
    Configuration menu
    Copy the full SHA
    fa5b39d View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2024

  1. ad7606: implement per-channel scale-available support

    The AD7606C-16 and AD7606C-18 support per-channel 'scale_availble' in SW
    mode.
    That is because each channel can be configured individually, to be
    bipolar-differential, bipolar-single-ended or unipolar-single-ended.
    
    Depending on the above configuration, the available scales change.
    So, we need to tweak this per-channel.
    
    Since there isn't a way to detect SW mode, we use some 'try' blocks in
    Python.
    
    Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
    commodo committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    3d01f08 View commit details
    Browse the repository at this point in the history
  2. ad7606: rework to_volts() method to support np.int32

    For AD7606C-18 especially, there will be 32-bit samples getting returned
    from the ADC.
    
    Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
    commodo committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    8a4dfe7 View commit details
    Browse the repository at this point in the history
  3. ad7606: don't add timestamp channel to channels array

    The soft timestamp channel is a special IIO channel.
    It's not an RX channel, so it hasn't any of the typically attributes (raw,
    scale, etc) like the other RX channels.
    
    So, just ignore it.
    
    Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
    commodo committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    f0378b9 View commit details
    Browse the repository at this point in the history
  4. ad7606: add handling in to_volts() method for 'int' and 'list'

    At least the 'raw' channel attribute returns int.
    So,  'ad7606.to_volts(0, channel0.raw)' won't work with checking for numpy
    types.
    
    Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
    commodo committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    b54a3dc View commit details
    Browse the repository at this point in the history