From a758f526095d696102a314d406e1c5131bcd2ae8 Mon Sep 17 00:00:00 2001 From: Kantipudi-Supriya Date: Thu, 12 Sep 2024 10:51:11 +0530 Subject: [PATCH 1/3] projects:ad7191_iio:Added the python support for ad7191 1) Modified to_volts so that it gives the correct value for both unipolar and bipolar mode Signed-off-by: Kantipudi-Supriya --- adi/ad719x.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adi/ad719x.py b/adi/ad719x.py index c8ae4a9f6..8e90240a5 100644 --- a/adi/ad719x.py +++ b/adi/ad719x.py @@ -23,7 +23,7 @@ def __init__(self, uri="", device_name=""): """Constructor for AD719x class.""" context_manager.__init__(self, uri, self._device_name) - compatible_parts = ["ad7190", "ad7192", "ad7193", "ad7194", "ad7195"] + compatible_parts = ["ad7190", "ad7191","ad7192", "ad7193", "ad7194", "ad7195"] self._ctrl = None @@ -89,14 +89,15 @@ def offset(self, value): def to_volts(self, index, val): """Converts raw value to SI.""" _scale = self.channel[index].scale + _offset = self.channel[index].offset ret = None if isinstance(val, np.int32): - ret = val * _scale + ret = (val+_offset)/1000 * _scale if isinstance(val, np.ndarray): - ret = [x * _scale for x in val] + ret = [(x+offset)/1000 * _scale for x in val] if ret is None: raise Exception("Error in converting to actual voltage") From b517db51138c8d7c56b3a8560892d744e5ee8882 Mon Sep 17 00:00:00 2001 From: Kantipudi-Supriya Date: Thu, 12 Sep 2024 11:52:57 +0530 Subject: [PATCH 2/3] projects:ad7191_iio:Modified the ad719x.py file Signed-off-by: Kantipudi-Supriya --- adi/ad719x.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adi/ad719x.py b/adi/ad719x.py index 8e90240a5..beade3eb2 100644 --- a/adi/ad719x.py +++ b/adi/ad719x.py @@ -97,7 +97,7 @@ def to_volts(self, index, val): ret = (val+_offset)/1000 * _scale if isinstance(val, np.ndarray): - ret = [(x+offset)/1000 * _scale for x in val] + ret = [((x+_offset)/1000) * _scale for x in val] if ret is None: raise Exception("Error in converting to actual voltage") From df75290b92e9189e102f1a994fefa32628206c6b Mon Sep 17 00:00:00 2001 From: Kantipudi-Supriya Date: Thu, 26 Sep 2024 11:48:25 +0530 Subject: [PATCH 3/3] projects:ad7191:Address the review comments 1)Added the ad7191 to the supported_parts.md Signed-off-by: Kantipudi-Supriya --- supported_parts.md | 1 + 1 file changed, 1 insertion(+) diff --git a/supported_parts.md b/supported_parts.md index 313da888c..3dee33a0c 100644 --- a/supported_parts.md +++ b/supported_parts.md @@ -82,6 +82,7 @@ - AD7176-2 - AD7177-2 - AD7190 +- AD7191 - AD7192 - AD7193 - AD7194