@@ -27,13 +27,7 @@ def __init__(self, uri="ip:analog.local", device_name="ad7944"):
27
27
if device_name not in self ._compatible_parts :
28
28
raise Exception (f"Not a compatible device: { device_name } " )
29
29
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"
35
30
self ._rxadc = self ._ctrl = self ._ctx .find_device (device_name )
36
- self ._trigger = self ._ctx .find_device (trigger_name )
37
31
38
32
if not self ._ctrl :
39
33
raise Exception (f"Error in selecting matching device { device_name } " )
@@ -48,12 +42,12 @@ def __init__(self, uri="ip:analog.local", device_name="ad7944"):
48
42
@property
49
43
def sampling_frequency (self ):
50
44
"""Get sampling frequency."""
51
- return self ._trigger . frequency
45
+ return self ._get_iio_dev_attr ( "sampling_frequency" )
52
46
53
47
@sampling_frequency .setter
54
48
def sampling_frequency (self , rate ):
55
49
"""Set sampling frequency."""
56
- self ._trigger . frequency = rate
50
+ self ._set_iio_dev_attr ( "sampling_frequency" , rate )
57
51
58
52
59
53
class ad7985 (ad7944 ):
0 commit comments