libiio
Classes | Public Member Functions | Public Attributes | Properties | List of all members
iio.Channel Class Reference

iio.Channel class: Contains the representation of an input or output channel. More...

Inheritance diagram for iio.Channel:

Public Member Functions

void enable ()
 Enable the current channel, so that it can be used for I/O operations. More...
 
void disable ()
 Disable the current channel. More...
 
bool is_enabled ()
 Returns whether or not the channel has been enabled. More...
 
byte [] read (IOBuffer buffer, bool raw=false)
 Extract the samples corresponding to this channel from the given iio.IOBuffer object. More...
 
uint write (IOBuffer buffer, byte[] array, bool raw=false)
 Write the specified array of samples corresponding to this channel into the given iio.IOBuffer object. More...
 
def __init__ (self, _channel)
 
def read (self, buf, raw=False)
 
def write (self, buf, array, raw=False)
 
def device (self)
 
def index (self)
 
def data_format (self)
 
def modifier (self)
 
def type (self)
 
def convert (self, dst, src)
 
def convert_inverse (self, dst, src)
 

Public Attributes

readonly string name
 The name of this channel. More...
 
readonly string id
 An identifier of this channel. More...
 
readonly bool output
 Contains true if the channel is an output channel, false otherwise. More...
 
readonly bool scan_element
 Contains true if the channel is a scan element, false otherwise. More...
 
readonly List< Attrattrs
 A list of all the attributes that this channel has. More...
 

Properties

 id
 
 name
 
 attrs
 
 output
 
 scan_element
 
 enabled
 

Detailed Description

iio.Channel class: Contains the representation of an input or output channel.

Represents a channel of an IIO device.

Constructor & Destructor Documentation

§ __init__()

def iio.Channel.__init__ (   self,
  _channel 
)
Initialize a new instance of the Channel class.

:param _channel: type=_ChannelPtr
    Pointer to an IIO Channel.

returns: type=iio.Channel
    An new instance of this class

Member Function Documentation

§ convert()

def iio.Channel.convert (   self,
  dst,
  src 
)
Convert src and saves the result in dst, using current channel's data format.

:param dst: type=list
    The variable where the result is stored.
:param src: type=list
    Data to be converted.

§ convert_inverse()

def iio.Channel.convert_inverse (   self,
  dst,
  src 
)
Convert the sample from host format to hardware format.

:param dst: type=list
    The variable where the result is stored.
:param src: type=list
    Data to be converted.

§ data_format()

def iio.Channel.data_format (   self)
Channel data format.
type: iio.DataFormat

§ device()

def iio.Channel.device (   self)
Corresponding device for the channel.
type: iio.Device

§ disable()

void iio.Channel.disable ( )
inline

Disable the current channel.

§ enable()

void iio.Channel.enable ( )
inline

Enable the current channel, so that it can be used for I/O operations.

§ index()

def iio.Channel.index (   self)
Index for the channel.

§ is_enabled()

bool iio.Channel.is_enabled ( )
inline

Returns whether or not the channel has been enabled.

§ modifier()

def iio.Channel.modifier (   self)
Channel modifier.
type: iio.ChannelModifier(Enum)

§ read() [1/2]

byte [] iio.Channel.read ( IOBuffer  buffer,
bool  raw = false 
)
inline

Extract the samples corresponding to this channel from the given iio.IOBuffer object.

Parameters
bufferA valid instance of the iio.IOBuffer class.
rawIf set to true, the samples are not converted from their hardware format to their host format.
Returns
A byte array containing the extracted samples.
Exceptions
System.ExceptionThe samples could not be read.

§ read() [2/2]

def iio.Channel.read (   self,
  buf,
  raw = False 
)
Extract the samples corresponding to this channel from the given iio.Buffer object.

:param buf: type=iio.Buffer
    A valid instance of the iio.Buffer class
:param raw: type=bool
    If set to True, the samples are not converted from their
    native format to their host format

returns: type=bytearray
    An array containing the samples for this channel

§ type()

def iio.Channel.type (   self)
Type for the channel.
type: iio.ChannelType(Enum)

§ write() [1/2]

uint iio.Channel.write ( IOBuffer  buffer,
byte []  array,
bool  raw = false 
)
inline

Write the specified array of samples corresponding to this channel into the given iio.IOBuffer object.

Parameters
bufferA valid instance of the iio.IOBuffer class.
arrayA byte array containing the samples to write.
rawIf set to true, the samples are not converted from their host format to their native format.
Returns
The number of bytes written.
Exceptions
System.ExceptionThe samples could not be written.

§ write() [2/2]

def iio.Channel.write (   self,
  buf,
  array,
  raw = False 
)
Write the specified array of samples corresponding to this channel into the given iio.Buffer object.

:param buf: type=iio.Buffer
    A valid instance of the iio.Buffer class
:param array: type=bytearray
    The array containing the samples to copy
:param raw: type=bool
    If set to True, the samples are not converted from their
    host format to their native format

returns: type=int
    The number of bytes written

Member Data Documentation

§ attrs

readonly List<Attr> iio.Channel.attrs

A list of all the attributes that this channel has.

§ id

readonly string iio.Channel.id

An identifier of this channel.

It is possible that two channels have the same ID, if one is an input channel and the other is an output channel.

§ name

readonly string iio.Channel.name

The name of this channel.

§ output

readonly bool iio.Channel.output

Contains true if the channel is an output channel, false otherwise.

§ scan_element

readonly bool iio.Channel.scan_element

Contains true if the channel is a scan element, false otherwise.

If a channel is a scan element, then it is possible to enable it and use it for I/O operations.

Property Documentation

§ attrs

iio.Channel.attrs
static
Initial value:
= property(
lambda self: self._attrs,
None,
None,
"List of attributes for this channel.\n\ttype=dict of iio.ChannelAttr",
)

§ enabled

iio.Channel.enabled
static
Initial value:
= property(
lambda self: _c_is_enabled(self._channel),
lambda self, x: _c_enable(self._channel) if x else _c_disable(self._channel),
None,
"Configured state of the channel\n\ttype=bool",
)

§ id

iio.Channel.id
static
Initial value:
= property(
lambda self: self._id,
None,
None,
"An identifier of this channel.\n\tNote that it is possible that two channels have the same ID, if one is an input channel and the other is an output channel.\n\ttype=str",
)

§ name

iio.Channel.name
static
Initial value:
= property(
lambda self: self._name, None, None, "The name of this channel.\n\ttype=str"
)

§ output

iio.Channel.output
static
Initial value:
= property(
lambda self: self._output,
None,
None,
"Contains True if the channel is an output channel, False otherwise.\n\ttype=bool",
)

§ scan_element

iio.Channel.scan_element
static
Initial value:
= property(
lambda self: self._scan_element,
None,
None,
"Contains True if the channel is a scan element, False otherwise.\n\tIf a channel is a scan element, then it is possible to enable it and use it for I/O operations.\n\ttype=bool",
)

The documentation for this class was generated from the following files: