Device

class iio.Device

iio.Device class: Contains the representation of an IIO device.

Subclassed by iio.Trigger

Public Functions

Channel get_channel (string name, bool output = false)

Get the iio.Channel object of the specified name.

Param name:

Name, ID, or label of the channel to look for

Param output:

true if you are looking for an output channel, otherwise false.

Throws IioLib.IIOException:

The IIO channel with the specified name, ID, or label could not be found in the current device.

void set_trigger (Trigger trig)

Affect a trigger to this device.

Param trig:

A valid instance of the iio.Trigger class.

Throws IioLib.IIOException:

The trigger could not be set.

Trigger get_trigger ()

Get the current trigger affected to this device.

Throws IioLib.IIOException:

The instance could not be retrieved.

Return:

An instance of the iio.Trigger class.

uint get_sample_size (ChannelsMask mask)

Get the current sample size of the device.

The sample size varies each time channels get enabled or disabled.

Throws IioLib.IIOException:

Internal error. Please report any bug.

void reg_write (uint addr, uint value)

Set a value to one register of this device.

Param addr:

The address of the register concerned.

Param value:

The value that will be used for this register.

Throws IioLib.IIOException:

The register could not be written.

uint reg_read (uint addr)

Read the content of a register of this device.

Param addr:

The address of the register concerned.

Throws IioLib.IIOException:

The register could not be read.

Public Members

readonly Context ctx

Gets the context of the current device.

readonly string id

An identifier of this device.

The identifier is only valid in this IIO context

readonly string name

The name of this device.

readonly IReadOnlyDictionary<string, Attr> attrs

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

readonly IReadOnlyDictionary<string, Attr> debug_attrs

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

readonly IReadOnlyDictionary<string, Attr> event_attrs

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

readonly IReadOnlyList<Channel> channels

A list of all the iio.Channel objects that this device possesses.

readonly IReadOnlyList<IOBuffer> buffers

A list of all the iio.IOBuffer objects that this device possesses.

Properties

string label { get; set; }

The label of this device.

bool hwmon { get; set; }

True if the device is a hardware monitoring device, False if it is a IIO device.