diff --git a/adi/ad5592r.py b/adi/ad5592r.py index baf515cd0..bb5d9c0ae 100644 --- a/adi/ad5592r.py +++ b/adi/ad5592r.py @@ -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: @@ -25,6 +25,8 @@ class ad5592r(context_manager): """ _device_name = "" + _complex_data = False + channel = [] def __repr__(self): retstr = f""" @@ -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)) @@ -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"""