Skip to content

Commit

Permalink
doc: added DeviceBufferAttr and DeviceDebugAttr in Sphinx.
Browse files Browse the repository at this point in the history
Added the Sphinx documentation for the DeviceBufferAttr and DeviceDebugAttr classes under the Device menu.

Signed-off-by: Cristi Iacob <[email protected]>
  • Loading branch information
cristi-iacob committed Apr 29, 2020
1 parent 5d7d176 commit 06060b8
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 8 deletions.
11 changes: 11 additions & 0 deletions bindings/python/doc/channel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@ Members
--------------
.. autoclass:: iio.Channel
:members:

--------------------

Channel attributes
--------------------
.. autoclass:: iio.DataFormat
:members:
.. autoclass:: iio.ChannelModifier
:members:
.. autoclass:: iio.ChannelType
:members:
12 changes: 12 additions & 0 deletions bindings/python/doc/device.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

43 changes: 35 additions & 8 deletions bindings/python/iio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, )
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 06060b8

Please sign in to comment.