-
Notifications
You must be signed in to change notification settings - Fork 126
Update Ad4630 class and improve example #691
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
base: main
Are you sure you want to change the base?
Changes from all commits
40c810b
f034a37
edb252c
15aff26
d74a7c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,13 @@ class ad4630(rx, context_manager, attribute): | |
|
|
||
| """ AD4630 is low power 24-bit precision SAR ADC """ | ||
|
|
||
| _compatible_parts = ["ad4630-24", "ad4030-24", "ad4630-16"] | ||
| _compatible_parts = [ | ||
| "ad4030-24", | ||
| "ad4630-16", | ||
| "ad4630-24", | ||
| "ad4632-16", | ||
| "ad4632-24", | ||
| ] | ||
| _complex_data = False | ||
| _data_type = np.uint32 | ||
| _device_name = "" | ||
|
|
@@ -113,26 +119,25 @@ def sample_rate(self, rate): | |
| @property | ||
| def sample_averaging_avail(self): | ||
| """Get list of all the sample averaging values available. Only available in 30bit averaged mode.""" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as below comment |
||
| return self._get_iio_dev_attr("sample_averaging_available") | ||
| return self._get_iio_dev_attr("oversampling_ratio_available") | ||
|
|
||
| @property | ||
| def sample_averaging(self): | ||
| """Get the sample averaging. Only available in 30bit averaged mode.""" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the docstring and property name still correct? Does this apply to all supported parts?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @tfcollins
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you be more descriptive on what this means. sample_averaging seems to be a boolean but oversampling_ratio would be an integer
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| return self._get_iio_dev_attr_str("sample_averaging") | ||
| return self._get_iio_dev_attr_str("oversampling_ratio") | ||
|
|
||
| @sample_averaging.setter | ||
| def sample_averaging(self, n_sample): | ||
| """Set the sample averaging. Only available in 30bit averaged mode.""" | ||
| if str(self.sample_averaging) != "OFF": | ||
| if str(n_sample) in str(self.sample_averaging_avail): | ||
| self._set_iio_dev_attr("sample_averaging", str(n_sample)) | ||
| else: | ||
| raise ValueError( | ||
| "Error: Number of avg samples not supported \nUse one of: " | ||
| + str(self.sample_averaging_avail) | ||
| ) | ||
| """Set the sample averaging. The device driver will automatically set | ||
| the ADC into 30bit averaged mode.""" | ||
|
|
||
| if str(n_sample) in str(self.sample_averaging_avail): | ||
| self._set_iio_dev_attr("oversampling_ratio", str(n_sample)) | ||
| else: | ||
| raise Exception("Sample Averaging only available in 30bit averaged mode.") | ||
| raise ValueError( | ||
| "Error: Number of avg samples not supported \nUse one of: " | ||
| + str(self.sample_averaging_avail) | ||
| ) | ||
|
|
||
| class _channel(attribute): | ||
| """AD4x30 differential channel.""" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <?xml version="1.0" encoding="utf-8"?><!DOCTYPE context [<!ELEMENT context (device | context-attribute)*><!ELEMENT context-attribute EMPTY><!ELEMENT device (channel | attribute | debug-attribute | buffer-attribute)*><!ELEMENT channel (scan-element?, attribute*)><!ELEMENT attribute EMPTY><!ELEMENT scan-element EMPTY><!ELEMENT debug-attribute EMPTY><!ELEMENT buffer-attribute EMPTY><!ATTLIST context name CDATA #REQUIRED version-major CDATA #REQUIRED version-minor CDATA #REQUIRED version-git CDATA #REQUIRED description CDATA #IMPLIED><!ATTLIST context-attribute name CDATA #REQUIRED value CDATA #REQUIRED><!ATTLIST device id CDATA #REQUIRED name CDATA #IMPLIED label CDATA #IMPLIED><!ATTLIST channel id CDATA #REQUIRED type (input|output) #REQUIRED name CDATA #IMPLIED><!ATTLIST scan-element index CDATA #REQUIRED format CDATA #REQUIRED scale CDATA #IMPLIED><!ATTLIST attribute name CDATA #REQUIRED filename CDATA #IMPLIED><!ATTLIST debug-attribute name CDATA #REQUIRED><!ATTLIST buffer-attribute name CDATA #REQUIRED>]><context name="xml" version-major="0" version-minor="25" version-git="5e7f76e" description="Linux analog 6.17.0-rc3-iio-zed-new+ #114 SMP PREEMPT Mon Oct 6 13:59:42 -03 2025 armv7l" ><context-attribute name="hw_model" value="EVAL-ADAQ4216-FMCZ on Xilinx Zynq ZED" /><context-attribute name="hw_carrier" value="Xilinx Zynq ZED" /><context-attribute name="local,kernel" value="6.17.0-rc3-iio-zed-new+" /><context-attribute name="uri" value="local:" /><device id="hwmon0" name="e000b000ethernetffffffff00" ><channel id="temp1" type="input" ><attribute name="crit" filename="temp1_crit" /><attribute name="input" filename="temp1_input" /><attribute name="max_alarm" filename="temp1_max_alarm" /></channel></device><device id="iio:device0" name="adaq4216" ><channel id="voltage0-voltage1" type="input" ><scan-element index="0" format="le:s16/32>>0" scale="0.018750" /><attribute name="calibbias" filename="in_voltage0-voltage1_calibbias" /><attribute name="calibbias_available" filename="in_voltage0-voltage1_calibbias_available" /><attribute name="calibscale" filename="in_voltage0-voltage1_calibscale" /><attribute name="calibscale_available" filename="in_voltage0-voltage1_calibscale_available" /><attribute name="label" filename="in_voltage0-voltage1_label" /><attribute name="raw" filename="in_voltage0-voltage1_raw" /><attribute name="scale" filename="in_voltage0-voltage1_scale" /><attribute name="scale_available" filename="in_voltage0-voltage1_scale_available" /></channel><channel id="voltage2" type="input" ><scan-element index="1" format="be:U8/8>>0" scale="16.000000" /><attribute name="label" filename="in_voltage2_label" /><attribute name="raw" filename="in_voltage2_raw" /><attribute name="scale" filename="in_voltage2_scale" /></channel><attribute name="oversampling_ratio" /><attribute name="oversampling_ratio_available" /><attribute name="sampling_frequency" /><attribute name="waiting_for_supplier" /><buffer-attribute name="data_available" /><buffer-attribute name="direction" /><buffer-attribute name="length_align_bytes" /><debug-attribute name="direct_reg_access" /></device><device id="iio_sysfs_trigger" ><attribute name="add_trigger" /><attribute name="remove_trigger" /></device></context> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update supported parts MD