libiio
Classes | Public Types | 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:
Inheritance graph
[legend]
Collaboration diagram for iio.Channel:
Collaboration graph
[legend]

Classes

struct  DataFormat
 

Public Types

enum  ChannelModifier {
  IIO_NO_MOD, IIO_MOD_X, IIO_MOD_Y, IIO_MOD_Z,
  IIO_MOD_X_AND_Y, IIO_MOD_X_AND_Z, IIO_MOD_Y_AND_Z, IIO_MOD_X_AND_Y_AND_Z,
  IIO_MOD_X_OR_Y, IIO_MOD_X_OR_Z, IIO_MOD_Y_OR_Z, IIO_MOD_X_OR_Y_OR_Z,
  IIO_MOD_LIGHT_BOTH, IIO_MOD_LIGHT_IR, IIO_MOD_ROOT_SUM_SQUARED_X_Y, IIO_MOD_SUM_SQUARED_X_Y_Z,
  IIO_MOD_LIGHT_CLEAR, IIO_MOD_LIGHT_RED, IIO_MOD_LIGHT_GREEN, IIO_MOD_LIGHT_BLUE,
  IIO_MOD_QUATERNION, IIO_MOD_TEMP_AMBIENT, IIO_MOD_TEMP_OBJECT, IIO_MOD_NORTH_MAGN,
  IIO_MOD_NORTH_TRUE, IIO_MOD_NORTH_MAGN_TILT_COMP, IIO_MOD_NORTH_TRUE_TILT_COMP, IIO_MOD_RUNNING,
  IIO_MOD_JOGGING, IIO_MOD_WALKING, IIO_MOD_STILL, IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
  IIO_MOD_I, IIO_MOD_Q, IIO_MOD_CO2, IIO_MOD_VOC,
  IIO_MOD_LIGHT_UV, IIO_MOD_LIGHT_DUV, IIO_MOD_PM1, IIO_MOD_PM2P5,
  IIO_MOD_PM4, IIO_MOD_PM10, IIO_MOD_ETHANOL, IIO_MOD_H2,
  IIO_MOD_O2
}
 iio.Channel.ChannelModifier class: Contains the available channel modifiers. More...
 
enum  ChannelType {
  IIO_VOLTAGE, IIO_CURRENT, IIO_POWER, IIO_ACCEL,
  IIO_ANGL_VEL, IIO_MAGN, IIO_LIGHT, IIO_INTENSITY,
  IIO_PROXIMITY, IIO_TEMP, IIO_INCLI, IIO_ROT,
  IIO_ANGL, IIO_TIMESTAMP, IIO_CAPACITANCE, IIO_ALTVOLTAGE,
  IIO_CCT, IIO_PRESSURE, IIO_HUMIDITYRELATIVE, IIO_ACTIVITY,
  IIO_STEPS, IIO_ENERGY, IIO_DISTANCE, IIO_VELOCITY,
  IIO_CONCENTRATION, IIO_RESISTANCE, IIO_PH, IIO_UVINDEX,
  IIO_ELECTRICALCONDUCTIVITY, IIO_COUNT, IIO_INDEX, IIO_GRAVITY,
  IIO_POSITIONRELATIVE, IIO_PHASE, IIO_MASSCONCENTRATION, IIO_CHAN_TYPE_UNKNOWN = Int32.MaxValue
}
 iio.Channel.ChannelType class: Contains the available channel types. More...
 

Public Member Functions

void enable (ChannelsMask mask)
 Enable the current channel, so that it can be used for I/O operations. More...
 
void disable (ChannelsMask mask)
 Disable the current channel. More...
 
bool is_enabled (ChannelsMask mask)
 Returns whether or not the channel has been enabled. More...
 
byte [] read (Block block, bool raw=false)
 Extract the samples corresponding to this channel from the given iio.Block object. More...
 
uint write (Block block, byte[] array, bool raw=false)
 Write the specified array of samples corresponding to this channel into the given iio.Block object. More...
 
def __init__ (self, dev, _channel)
 
def read (self, block, raw=False)
 
def write (self, block, array, raw=False)
 
def device (self)
 
def index (self)
 
def data_format (self)
 
def modifier (self)
 
def type (self)
 
- Public Member Functions inherited from iio._IIO_Object
def __init__ (self, hdl, parent)
 
def __eq__ (self, other)
 

Public Attributes

readonly Device dev
 
readonly string name
 The name of this channel. More...
 
readonly string id
 An identifier of this channel. More...
 
readonly uint index
 Get the index 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

ChannelModifier modifier [get]
 The modifier of this channel. More...
 
ChannelType type [get]
 The type of this channel. More...
 
DataFormat format [get]
 Represents the format of a data sample. More...
 
 id
 
 name
 
 attrs
 
 output
 
 scan_element
 

Detailed Description

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

Represents a channel of an IIO device.

Member Enumeration Documentation

◆ ChannelModifier

iio.Channel.ChannelModifier class: Contains the available channel modifiers.

◆ ChannelType

iio.Channel.ChannelType class: Contains the available channel types.

Constructor & Destructor Documentation

◆ __init__()

def iio.Channel.__init__ (   self,
  dev,
  _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

◆ 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 ( ChannelsMask  mask)
inline

Disable the current channel.

◆ enable()

void iio.Channel.enable ( ChannelsMask  mask)
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 ( ChannelsMask  mask)
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 ( Block  block,
bool  raw = false 
)
inline

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

Parameters
blockA valid instance of the iio.Block 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
IioLib.IIOExceptionThe samples could not be read.

◆ read() [2/2]

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

:param block: type=iio.Block
    A valid instance of the iio.Block 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 ( Block  block,
byte []  array,
bool  raw = false 
)
inline

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

Parameters
blockA valid instance of the iio.Block 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
IioLib.IIOExceptionThe samples could not be written.

◆ write() [2/2]

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

:param buf: type=iio.Block
    A valid instance of the iio.Block 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.

◆ index

readonly uint iio.Channel.index

Get the index of this 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",
)

◆ format

DataFormat iio.Channel.format
get

Represents the format of a data sample.

◆ 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",
)

◆ modifier

ChannelModifier iio.Channel.modifier
get

The modifier of this channel.

◆ 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",
)

◆ type

ChannelType iio.Channel.type
get

The type of this channel.


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