Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ad7191 #598

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions adi/ad719x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand Down
Loading