ad7124

class adi.ad7124.ad7124(uri='', device_name='', device_index=0)

Bases: rx_chan_comp

AD7124 4/8-channel, low-noise, low-power, 24-bit sigma-delta ADC.

Analog input configuration (single-ended, differential, unipolar, bipolar) is set in the device tree. This class scans all channels and creates both a channel[] list attribute and individual channel attributes for channel IDs that are valid Python identifiers, for example:

  • my_ad7124.temp (temperature sensor)

  • my_ad7124.voltage0 (single-ended voltage input)

Differential channels such as voltage0-voltage1 are available through channel[] or as my_ad7124.voltage0_voltage1 (hyphens sanitized to underscores to form valid Python identifiers).

The enable_single_cycle device attribute defaults to ‘Y’, and ensures that when multiple channels are enabled, output data is fully settled; intermediate, unsettled outputs from the digital filter are ignored. Setting to ‘N’ includes these unsettled samples, and is thus only valid when a single channel is valid. WARNING: Setting to ‘N’ when multiple channels are enabled will result in invalid data.

Each voltage channel has the following sub-attributes:

  • raw – Raw ADC code (read only)

  • scale / scale_available – ADC scale (millivolts per LSB) and available scales

  • filter_type / filter_type_available – Digital filter type

  • sampling_frequency – Per-channel sampling frequency

  • __call__() – Returns reading in millivolts

The temperature channel is the same, with these exceptions:

  • scale does not have a setter

  • scale_available does not apply (raises error)

  • __call__() returns temperature in degrees Celsius

property enable_single_cycle

Get single-cycle mode for settled, no-latency conversions.

Dynamic Attributes

The ad7124 class supports a variable number of channels depending on the hardware configuration. Channel property interfaces are dynamically generated using their IIO channel IDs and are available in channel and as named attributes (e.g. temp or dev.voltage0_voltage1). Voltage channels are instances of _ad7124_channel and temperature channels are instances of _temp_channel.

class adi.ad7124._ad7124_channel(ctrl, channel_name)

Bases: attribute

AD7124 channel

property filter_type

Get the AD7124 channel filter type.

property filter_type_available

Provide all available filter types for the selected channel.

property offset

AD7124 channel offset

property raw

AD7124 channel raw value

property sampling_frequency

Get the sampling frequency of the selected channel.

property scale

AD7124 channel scale(gain)

property scale_available

Provide all available scale settings for the selected channel.

property sys_calibration

Return the system calibration state.

property sys_calibration_mode

Return the system calibration mode.

property sys_calibration_mode_available

Return the available system calibration modes.

class adi.ad7124._temp_channel(ctrl, channel_name)
property scale

Get the AD7124 temperature scale.

property scale_available

Provide all available scale settings for the selected channel.