Skip to content

Commit 8370a2a

Browse files
committed
adi/ad7944: use the sampling_frequency attribute provided by iio:device
Signed-off-by: Florian Sylvestre <[email protected]>
1 parent 95be456 commit 8370a2a

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

adi/ad7944.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ def __init__(self, uri="ip:analog.local", device_name="ad7944"):
2727
if device_name not in self._compatible_parts:
2828
raise Exception(f"Not a compatible device: {device_name}")
2929

30-
# TODO: if/when pyadi-iio and libiio get refactored, this could
31-
# be done more gracefully. The device object should have a
32-
# trigger property that is directly accessible for the sampling
33-
# frequency, but this is broken in libiio 0.25.
34-
trigger_name = "trigger0"
3530
self._rxadc = self._ctrl = self._ctx.find_device(device_name)
36-
self._trigger = self._ctx.find_device(trigger_name)
3731

3832
if not self._ctrl:
3933
raise Exception(f"Error in selecting matching device {device_name}")
@@ -48,12 +42,12 @@ def __init__(self, uri="ip:analog.local", device_name="ad7944"):
4842
@property
4943
def sampling_frequency(self):
5044
"""Get sampling frequency."""
51-
return self._trigger.frequency
45+
return self._get_iio_dev_attr("sampling_frequency")
5246

5347
@sampling_frequency.setter
5448
def sampling_frequency(self, rate):
5549
"""Set sampling frequency."""
56-
self._trigger.frequency = rate
50+
self._set_iio_dev_attr("sampling_frequency", rate)
5751

5852

5953
class ad7985(ad7944):

0 commit comments

Comments
 (0)