Channel

class iio.Channel

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

Public Types

enum ChannelModifier

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

Values:

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_MOD_LINEAR_X
IIO_MOD_LINEAR_Y
IIO_MOD_LINEAR_Z
IIO_MOD_PITCH
IIO_MOD_YAW
IIO_MOD_ROLL
IIO_MOD_LIGHT_UVA
IIO_MOD_LIGHT_UVB
IIO_MOD_RMS
IIO_MOD_ACTIVE
IIO_MOD_REACTIVE
IIO_MOD_APPARENT
enum ChannelType

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

Values:

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_DELTA_ANGL
IIO_DELTA_VELOCITY
IIO_COLORTEMP
IIO_CHROMATICITY
IIO_ATTENTION
IIO_ALTCURRENT
IIO_CHAN_TYPE_UNKNOWN

Public Functions

void enable (ChannelsMask mask)

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

void disable (ChannelsMask mask)

Disable the current channel.

bool is_enabled (ChannelsMask mask)

Returns whether or not the channel has been enabled.

byte[] read (Block block, bool raw = false)

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

Param block:

A valid instance of the iio.Block class.

Param raw:

If set to true, the samples are not converted from their hardware format to their host format.

Throws IioLib.IIOException:

The samples could not be read.

Return:

A byte array containing the extracted samples.

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.

Param block:

A valid instance of the iio.Block class.

Param array:

A byte array containing the samples to write.

Param raw:

If set to true, the samples are not converted from their host format to their native format.

Throws IioLib.IIOException:

The samples could not be written.

Return:

The number of bytes written.

Public Members

readonly Device dev
readonly string name

The name of this channel.

readonly string 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.

readonly uint index

Get the index of this channel.

readonly bool output

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

readonly bool 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.

readonly IReadOnlyDictionary<string, Attr> attrs

A Dictionary of all the attributes that this channel has. Key is the attribute name.

readonly IReadOnlyDictionary<string, Attr> event_attrs

A Dictionary of all the event attributes that this channel has. Key is the attribute name.

Properties

string label { get; set; }

The label of this channel.

ChannelModifier modifier { get; set; }

The modifier of this channel.

ChannelType type { get; set; }

The type of this channel.

DataFormat format { get; set; }

Represents the format of a data sample.

struct DataFormat

Public Members

uint length

Total length of the sample, in bits.

uint bits

Length of valuable data in the sample, in bits.

uint shift

Right-shift to apply when converting sample.

bool is_signed

True if the sample is signed.

bool is_fully_defined

True if the sample if fully defined, sign-extended, etc.

bool is_be

True if the sample is in big-endian format.

bool with_scale

True if the sample should be scaled when converted.

double scale

Scale to apply if with_scale is True.

uint repeat

Number of times length repeats.

double offset

Contains a value to be added to the raw sample before applying the scale.