Skip to content

Commit

Permalink
python: added Channel.convert_inverse().
Browse files Browse the repository at this point in the history
Added the convert_inverse() method from the Channel class and its documentation.

Signed-off-by: Cristi Iacob <[email protected]>
  • Loading branch information
cristi-iacob committed Apr 29, 2020
1 parent 848f9f9 commit 13f0360
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bindings/python/iio.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 496,10 @@ class ChannelType(Enum):
_channel_convert.restype = None
_channel_convert.argtypes = (_ChannelPtr, c_void_p, c_void_p)

_channel_convert_inverse = _lib.iio_channel_convert_inverse
_channel_convert_inverse.restype = None
_channel_convert_inverse.argtypes = (_ChannelPtr, c_void_p, c_void_p)

_create_buffer = _lib.iio_device_create_buffer
_create_buffer.restype = _BufferPtr
_create_buffer.argtypes = (_DevicePtr, c_size_t, c_bool, )
Expand Down Expand Up @@ -820,6 824,20 @@ def convert(self, dst, src):
dst_ptr = cast((c_char * (len(dst) * self.data_format.length))(*dst), c_void_p)
_channel_convert(self._channel, src_ptr, dst_ptr)

def convert_inverse(self, dst, src):
"""
Convert the sample from host format to hardware format.
parameters:
dst: type=list
The variable where the result is stored.
src: type=list
Data to be converted.
"""
src_ptr = cast((c_char * (len(src) * self.data_format.length))(*src), c_void_p)
dst_ptr = cast((c_char * (len(dst) * self.data_format.length))(*dst), c_void_p)
_channel_convert_inverse(self._channel, src_ptr, dst_ptr)

class Buffer(object):

"""The class used for all I/O operations."""
Expand Down

0 comments on commit 13f0360

Please sign in to comment.