Skip to content

Commit

Permalink
adi:ad5592r: Added Rx method
Browse files Browse the repository at this point in the history
Added rx method for data capture

Signed-off-by: Disha D <[email protected]>
  • Loading branch information
D-Disha authored and [email protected] committed Jan 31, 2025
1 parent 77c5ed2 commit 0af9159
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions adi/ad5592r.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from adi.attribute import attribute
from adi.context_manager import context_manager
from adi.rx_tx import rx


class ad5592r(context_manager):
class ad5592r(rx, context_manager):
"""AD5592R and AD5593R SPI / I2C interface, 8-channel, 12-bit Confiburable ADC/DAC, digital GPIO
Analog I/O pins are configured in the device tree and can be ADC, DAC, or both. Channel attributes are as follows, where X corresponds to device channel number:
Expand All @@ -25,6 +25,8 @@ class ad5592r(context_manager):
"""

_device_name = ""
_complex_data = False
channel = []

def __repr__(self):
retstr = f"""
Expand Down Expand Up @@ -56,11 +58,16 @@ def __init__(self, uri="", device_name=""):
for device in self._ctx.devices:
if device.name in device_name:
self._ctrl = device
self._rxadc = device
break

self.channel = []
self._rx_channel_names = []

# Dynamically get channels after the index
for ch in self._ctrl.channels:
name = ch._id
print(name)
output = ch._output
if name == "temp":
setattr(self, name, self.channel_temp(self._ctrl, name, output))
Expand All @@ -70,9 +77,12 @@ def __init__(self, uri="", device_name=""):
self, name + "_dac", self.channel_dac(self._ctrl, name, output)
)
else:
self._rx_channel_names.append(name)
self.channel.append(self.channel_adc(self._ctrl, name, output))
setattr(
self, name + "_adc", self.channel_adc(self._ctrl, name, output)
)
rx.__init__(self)

class channel_adc(attribute):
"""AD5592R Input Voltage Channels"""
Expand Down

0 comments on commit 0af9159

Please sign in to comment.