My Project
Loading...
Searching...
No Matches
Channel

Classes

struct  iio_channel
 Represents an input or output channel of a device. More...

Functions

const struct iio_device * iio_channel_get_device (const struct iio_channel *chn)
 Retrieve a pointer to the iio_device structure.
const char * iio_channel_get_id (const struct iio_channel *chn)
 Retrieve the channel ID (e.g. voltage0).
const char * iio_channel_get_name (const struct iio_channel *chn)
 Retrieve the channel name (e.g. vccint).
const char * iio_channel_get_label (const struct iio_channel *chn)
 Retrieve the channel label (e.g. anglY).
bool iio_channel_is_output (const struct iio_channel *chn)
 Return True if the given channel is an output channel.
bool iio_channel_is_scan_element (const struct iio_channel *chn)
 Return True if the given channel is a scan element.
unsigned int iio_channel_get_attrs_count (const struct iio_channel *chn)
 Enumerate the channel-specific attributes of the given channel.
const struct iio_attr * iio_channel_get_attr (const struct iio_channel *chn, unsigned int index)
 Get the channel-specific attribute present at the given index.
const struct iio_attr * iio_channel_find_attr (const struct iio_channel *chn, const char *name)
 Try to find a channel-specific attribute by its name.
unsigned int iio_channel_get_event_attrs_count (const struct iio_channel *chn)
 Enumerate the event attributes of the given channel.
const struct iio_attr * iio_channel_get_event_attr (const struct iio_channel *chn, unsigned int index)
 Get the event attribute present at the given index.
const struct iio_attr * iio_channel_find_event_attr (const struct iio_channel *chn, const char *name)
 Try to find a channel event attribute by its name.
void iio_channel_enable (const struct iio_channel *chn, struct iio_channels_mask *mask)
 Enable the given channel.
void iio_channel_disable (const struct iio_channel *chn, struct iio_channels_mask *mask)
 Disable the given channel.
bool iio_channel_is_enabled (const struct iio_channel *chn, const struct iio_channels_mask *mask)
 Returns True if the channel is enabled.
size_t iio_channel_read (const struct iio_channel *chn, const struct iio_block *block, void *dst, size_t len, bool raw)
 Demultiplex and convert the samples of a given channel.
size_t iio_channel_write (const struct iio_channel *chn, struct iio_block *block, const void *src, size_t len, bool raw)
 Convert and multiplex the samples of a given channel.
void iio_channel_set_data (struct iio_channel *chn, void *data)
 Associate a pointer to an iio_channel structure.
void * iio_channel_get_data (const struct iio_channel *chn)
 Retrieve a previously associated pointer of an iio_channel structure.
enum iio_chan_type iio_channel_get_type (const struct iio_channel *chn)
 Get the type of the given channel.
enum iio_modifier iio_channel_get_modifier (const struct iio_channel *chn)
 Get the modifier type of the given channel.

Detailed Description

Function Documentation

◆ iio_channel_disable()

void iio_channel_disable ( const struct iio_channel * chn,
struct iio_channels_mask * mask )

Disable the given channel.

Parameters
chnA pointer to an iio_channel structure
maskThe channels mask to manipulate

◆ iio_channel_enable()

void iio_channel_enable ( const struct iio_channel * chn,
struct iio_channels_mask * mask )

Enable the given channel.

Parameters
chnA pointer to an iio_channel structure
maskThe channels mask to manipulate

◆ iio_channel_find_attr()

const struct iio_attr * iio_channel_find_attr ( const struct iio_channel * chn,
const char * name )

Try to find a channel-specific attribute by its name.

Parameters
chnA pointer to an iio_channel structure
nameA NULL-terminated string corresponding to the name of the attribute
Returns
On success, a pointer to an iio_attr structure
If the name does not correspond to any known attribute of the given channel, NULL is returned

◆ iio_channel_find_event_attr()

const struct iio_attr * iio_channel_find_event_attr ( const struct iio_channel * chn,
const char * name )

Try to find a channel event attribute by its name.

Parameters
chnA pointer to an iio_channel structure
nameA NULL-terminated string corresponding to the name of the event attribute
Returns
On success, a pointer to an iio_attr structure
If the name does not correspond to any known event attribute of the given channel, NULL is returned

◆ iio_channel_get_attr()

const struct iio_attr * iio_channel_get_attr ( const struct iio_channel * chn,
unsigned int index )

Get the channel-specific attribute present at the given index.

Parameters
chnA pointer to an iio_channel structure
indexThe index corresponding to the attribute
Returns
On success, a pointer to an iio_attr structure
If the index is invalid, NULL is returned

◆ iio_channel_get_attrs_count()

unsigned int iio_channel_get_attrs_count ( const struct iio_channel * chn)

Enumerate the channel-specific attributes of the given channel.

Parameters
chnA pointer to an iio_channel structure
Returns
The number of channel-specific attributes found

◆ iio_channel_get_data()

void * iio_channel_get_data ( const struct iio_channel * chn)

Retrieve a previously associated pointer of an iio_channel structure.

Parameters
chnA pointer to an iio_channel structure
Returns
The pointer previously associated if present, or NULL

◆ iio_channel_get_device()

const struct iio_device * iio_channel_get_device ( const struct iio_channel * chn)

Retrieve a pointer to the iio_device structure.

Parameters
chnA pointer to an iio_channel structure
Returns
A pointer to an iio_device structure

◆ iio_channel_get_event_attr()

const struct iio_attr * iio_channel_get_event_attr ( const struct iio_channel * chn,
unsigned int index )

Get the event attribute present at the given index.

Parameters
chnA pointer to an iio_channel structure
indexThe index corresponding to the event attribute
Returns
On success, a pointer to an iio_attr structure
If the index is invalid, NULL is returned

◆ iio_channel_get_event_attrs_count()

unsigned int iio_channel_get_event_attrs_count ( const struct iio_channel * chn)

Enumerate the event attributes of the given channel.

Parameters
chnA pointer to an iio_channel structure
Returns
The number of event attributes found

◆ iio_channel_get_id()

const char * iio_channel_get_id ( const struct iio_channel * chn)

Retrieve the channel ID (e.g. voltage0).

Parameters
chnA pointer to an iio_channel structure
Returns
A pointer to a static NULL-terminated string

◆ iio_channel_get_label()

const char * iio_channel_get_label ( const struct iio_channel * chn)

Retrieve the channel label (e.g. anglY).

Parameters
chnA pointer to an iio_channel structure
Returns
A pointer to a static NULL-terminated string

NOTE: if the channel has no label, NULL is returned.

◆ iio_channel_get_modifier()

enum iio_modifier iio_channel_get_modifier ( const struct iio_channel * chn)

Get the modifier type of the given channel.

Parameters
chnA pointer to an iio_channel structure
Returns
The modifier type of the channel

◆ iio_channel_get_name()

const char * iio_channel_get_name ( const struct iio_channel * chn)

Retrieve the channel name (e.g. vccint).

Parameters
chnA pointer to an iio_channel structure
Returns
A pointer to a static NULL-terminated string

NOTE: if the channel has no name, NULL is returned.

◆ iio_channel_get_type()

enum iio_chan_type iio_channel_get_type ( const struct iio_channel * chn)

Get the type of the given channel.

Parameters
chnA pointer to an iio_channel structure
Returns
The type of the channel NOTE: Before calling this function, iio_device_is_hwmon() should be called to verify that the passed channel object does not belong to a HWMON device.

◆ iio_channel_is_enabled()

bool iio_channel_is_enabled ( const struct iio_channel * chn,
const struct iio_channels_mask * mask )

Returns True if the channel is enabled.

Parameters
chnA pointer to an iio_channel structure
maskA pointer to an iio_channels_mask structure
Returns
True if the channel is enabled, False otherwise

◆ iio_channel_is_output()

bool iio_channel_is_output ( const struct iio_channel * chn)

Return True if the given channel is an output channel.

Parameters
chnA pointer to an iio_channel structure
Returns
True if the channel is an output channel, False otherwise

◆ iio_channel_is_scan_element()

bool iio_channel_is_scan_element ( const struct iio_channel * chn)

Return True if the given channel is a scan element.

Parameters
chnA pointer to an iio_channel structure
Returns
True if the channel is a scan element, False otherwise

NOTE: a channel that is a scan element is a channel that can generate samples (for an input channel) or receive samples (for an output channel) after being enabled.

◆ iio_channel_read()

size_t iio_channel_read ( const struct iio_channel * chn,
const struct iio_block * block,
void * dst,
size_t len,
bool raw )

Demultiplex and convert the samples of a given channel.

Parameters
chnA pointer to an iio_channel structure
blockA pointer to an iio_block structure
dstA pointer to the memory area where the converted data will be stored
lenThe available length of the memory area, in bytes
rawTrue to read samples in the hardware format, false to read converted samples.
Returns
The size of the converted data, in bytes

◆ iio_channel_set_data()

void iio_channel_set_data ( struct iio_channel * chn,
void * data )

Associate a pointer to an iio_channel structure.

Parameters
chnA pointer to an iio_channel structure
dataThe pointer to be associated

◆ iio_channel_write()

size_t iio_channel_write ( const struct iio_channel * chn,
struct iio_block * block,
const void * src,
size_t len,
bool raw )

Convert and multiplex the samples of a given channel.

Parameters
chnA pointer to an iio_channel structure
blockA pointer to an iio_block structure
srcA pointer to the memory area where the sequential data will be read from
lenThe length of the memory area, in bytes
rawTrue if the samples are already in hardware format, false if they need to be converted.
Returns
The number of bytes actually converted and multiplexed