From 06060b8ac834ec27af1392d35c9bd37d38cc090d Mon Sep 17 00:00:00 2001 From: Cristi Iacob Date: Thu, 23 Apr 2020 11:11:50 +0300 Subject: [PATCH] doc: added DeviceBufferAttr and DeviceDebugAttr in Sphinx. Added the Sphinx documentation for the DeviceBufferAttr and DeviceDebugAttr classes under the Device menu. Signed-off-by: Cristi Iacob --- bindings/python/doc/channel.rst | 11 +++++++++ bindings/python/doc/device.rst | 12 +++++++++ bindings/python/iio.py | 43 +++++++++++++++++++++++++++------ 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/bindings/python/doc/channel.rst b/bindings/python/doc/channel.rst index 398737b50..62a62fc64 100644 --- a/bindings/python/doc/channel.rst +++ b/bindings/python/doc/channel.rst @@ -5,3 +5,14 @@ Members -------------- .. autoclass:: iio.Channel :members: + +-------------------- + +Channel attributes +-------------------- +.. autoclass:: iio.DataFormat + :members: +.. autoclass:: iio.ChannelModifier + :members: +.. autoclass:: iio.ChannelType + :members: diff --git a/bindings/python/doc/device.rst b/bindings/python/doc/device.rst index 19beff020..a5512c2b5 100644 --- a/bindings/python/doc/device.rst +++ b/bindings/python/doc/device.rst @@ -6,3 +6,15 @@ Members .. autoclass:: iio.Device :members: :inherited-members: + +------------------ + +Device attributes +------------------ +.. autoclass:: iio.DeviceDebugAttr + :members: + :inherited-members: +.. autoclass:: iio.DeviceBufferAttr + :members: + :inherited-members: + diff --git a/bindings/python/iio.py b/bindings/python/iio.py index c3e3adfe5..125144822 100644 --- a/bindings/python/iio.py +++ b/bindings/python/iio.py @@ -75,7 +75,7 @@ class DataFormat(Structure): ('repeat', c_uint)] class ChannelModifier(Enum): - """Contains the modifier types of an IIO channel.""" + """Contains the modifier type of an IIO channel.""" IIO_NO_MOD = 0 IIO_MOD_X = 1 @@ -526,10 +526,6 @@ class ChannelType(Enum): _buffer_cancel.restype = c_void_p _buffer_cancel.argtypes = (_BufferPtr, ) -_buffer_get_data = _lib.iio_buffer_get_data -_buffer_get_data.restype = c_void_p -_buffer_get_data.argtypes = (_BufferPtr, ) - _buffer_get_device = _lib.iio_buffer_get_device _buffer_get_device.restype = _DevicePtr _buffer_get_device.argtypes = (_BufferPtr, ) @@ -811,6 +807,15 @@ def type(self): return ChannelType(_channel_get_type(self._channel)) def convert(self, dst, src): + """ + Converts src and saves the result in dst, using current channel's data format. + + parameters: + dst: type=list + The variable where the result is stored. + src: type=list + Data to be converted. + """ _channel_convert(self._channel, c_void_p(*dst), c_void_p(*src)) class Buffer(object): @@ -904,12 +909,22 @@ def write(self, array): return length def cancel(self): + """ + Cancels the current buffer. + """ _buffer_cancel(self._buffer) - def get_data(self): - return _buffer_get_data(self._buffer) - def set_blocking_mode(self, blocking): + """ + Sets the buffer's blocking mode. + + parameters: + blocking: type=boolean + True if in blocking_mode else False. + + returns: type=int + Return code from the C layer. + """ return _buffer_set_blocking_mode(self._buffer, c_bool(blocking)) @property @@ -922,10 +937,18 @@ def device(self): @property def poll_fd(self): + """ + This buffer's poll_fd. + type: int + """ return _buffer_get_poll_fd(self._buffer) @property def step(self): + """ + This buffer's step size. + type: int + """ return _buffer_step(self._buffer) class _DeviceOrTrigger(object): @@ -1090,6 +1113,10 @@ def _get_trigger(self): @property def context(self): + """ + This device's context. + type: iio.Context + """ return self.ctx() class Context(object):