libiio
|
Classes | |
struct | iio_channel |
Represents an input or output channel of a device. More... | |
Macros | |
#define | iio_channel_attr_read(chn, attr, ptr) |
Read the content of the given channel-specific attribute. More... | |
#define | iio_channel_attr_write(chn, attr, val) |
Set the value of the given channel-specific attribute. More... | |
Functions | |
__api __check_ret __pure const struct iio_device * | iio_channel_get_device (const struct iio_channel *chn) |
Retrieve a pointer to the iio_device structure. More... | |
__api __check_ret __pure const char * | iio_channel_get_id (const struct iio_channel *chn) |
Retrieve the channel ID (e.g. More... | |
__api __check_ret __pure const char * | iio_channel_get_name (const struct iio_channel *chn) |
Retrieve the channel name (e.g. More... | |
__api __check_ret __pure bool | iio_channel_is_output (const struct iio_channel *chn) |
Return True if the given channel is an output channel. More... | |
__api __check_ret __pure bool | iio_channel_is_scan_element (const struct iio_channel *chn) |
Return True if the given channel is a scan element. More... | |
__api __check_ret __pure unsigned int | iio_channel_get_attrs_count (const struct iio_channel *chn) |
Enumerate the channel-specific attributes of the given channel. More... | |
__api __check_ret __pure const char * | iio_channel_get_attr (const struct iio_channel *chn, unsigned int index) |
Get the channel-specific attribute present at the given index. More... | |
__api __check_ret __pure const char * | iio_channel_find_attr (const struct iio_channel *chn, const char *name) |
Try to find a channel-specific attribute by its name. More... | |
__api __check_ret __pure const char * | iio_channel_attr_get_filename (const struct iio_channel *chn, const char *attr) |
Retrieve the filename of an attribute. More... | |
__api __check_ret ssize_t | iio_channel_attr_read_raw (const struct iio_channel *chn, const char *attr, char *dst, size_t len) |
Read the content of the given channel-specific attribute. More... | |
__api __check_ret ssize_t | iio_channel_attr_write_raw (const struct iio_channel *chn, const char *attr, const void *src, size_t len) |
Set the value of the given channel-specific attribute. More... | |
__api void | iio_channel_enable (const struct iio_channel *chn, struct iio_channels_mask *mask) |
Enable the given channel. More... | |
__api void | iio_channel_disable (const struct iio_channel *chn, struct iio_channels_mask *mask) |
Disable the given channel. More... | |
__api __check_ret bool | iio_channel_is_enabled (const struct iio_channel *chn, const struct iio_channels_mask *mask) |
Returns True if the channel is enabled. More... | |
__api __check_ret 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. More... | |
__api __check_ret 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. More... | |
__api void | iio_channel_set_data (struct iio_channel *chn, void *data) |
Associate a pointer to an iio_channel structure. More... | |
__api void * | iio_channel_get_data (const struct iio_channel *chn) |
Retrieve a previously associated pointer of an iio_channel structure. More... | |
__api __check_ret __pure enum iio_chan_type | iio_channel_get_type (const struct iio_channel *chn) |
Get the type of the given channel. More... | |
__api __check_ret __pure enum iio_modifier | iio_channel_get_modifier (const struct iio_channel *chn) |
Get the modifier type of the given channel. More... | |
#define iio_channel_attr_read | ( | chn, | |
attr, | |||
ptr | |||
) |
Read the content of the given channel-specific attribute.
chn | A pointer to an iio_channel structure |
attr | A NULL-terminated string corresponding to the name of the attribute |
ptr | A pointer to the variable where the value should be stored |
#define iio_channel_attr_write | ( | chn, | |
attr, | |||
val | |||
) |
Set the value of the given channel-specific attribute.
chn | A pointer to an iio_channel structure |
attr | A NULL-terminated string corresponding to the name of the attribute |
val | The value to set the attribute to |
__api __check_ret __pure const char* iio_channel_attr_get_filename | ( | const struct iio_channel * | chn, |
const char * | attr | ||
) |
Retrieve the filename of an attribute.
chn | A pointer to an iio_channel structure |
attr | a NULL-terminated string corresponding to the name of the attribute |
__api __check_ret ssize_t iio_channel_attr_read_raw | ( | const struct iio_channel * | chn, |
const char * | attr, | ||
char * | dst, | ||
size_t | len | ||
) |
Read the content of the given channel-specific attribute.
chn | A pointer to an iio_channel structure |
attr | A NULL-terminated string corresponding to the name of the attribute |
dst | A pointer to the memory area where the NULL-terminated string corresponding to the value read will be stored |
len | The available length of the memory area, in bytes |
__api __check_ret ssize_t iio_channel_attr_write_raw | ( | const struct iio_channel * | chn, |
const char * | attr, | ||
const void * | src, | ||
size_t | len | ||
) |
Set the value of the given channel-specific attribute.
chn | A pointer to an iio_channel structure |
attr | A NULL-terminated string corresponding to the name of the attribute |
src | A pointer to the data to be written |
len | The number of bytes that should be written |
__api void iio_channel_disable | ( | const struct iio_channel * | chn, |
struct iio_channels_mask * | mask | ||
) |
Disable the given channel.
chn | A pointer to an iio_channel structure |
mask | The channels mask to manipulate |
__api void iio_channel_enable | ( | const struct iio_channel * | chn, |
struct iio_channels_mask * | mask | ||
) |
Enable the given channel.
chn | A pointer to an iio_channel structure |
mask | The channels mask to manipulate |
__api __check_ret __pure const char* iio_channel_find_attr | ( | const struct iio_channel * | chn, |
const char * | name | ||
) |
Try to find a channel-specific attribute by its name.
chn | A pointer to an iio_channel structure |
name | A NULL-terminated string corresponding to the name of the attribute |
NOTE: This function is useful to detect the presence of an attribute. It can also be used to retrieve the name of an attribute as a pointer to a static string from a dynamically allocated string.
__api __check_ret __pure const char* iio_channel_get_attr | ( | const struct iio_channel * | chn, |
unsigned int | index | ||
) |
Get the channel-specific attribute present at the given index.
chn | A pointer to an iio_channel structure |
index | The index corresponding to the attribute |
__api __check_ret __pure unsigned int iio_channel_get_attrs_count | ( | const struct iio_channel * | chn | ) |
Enumerate the channel-specific attributes of the given channel.
chn | A pointer to an iio_channel structure |
__api void* iio_channel_get_data | ( | const struct iio_channel * | chn | ) |
Retrieve a previously associated pointer of an iio_channel structure.
chn | A pointer to an iio_channel structure |
__api __check_ret __pure const struct iio_device* iio_channel_get_device | ( | const struct iio_channel * | chn | ) |
Retrieve a pointer to the iio_device structure.
chn | A pointer to an iio_channel structure |
__api __check_ret __pure const char* iio_channel_get_id | ( | const struct iio_channel * | chn | ) |
Retrieve the channel ID (e.g.
voltage0)
chn | A pointer to an iio_channel structure |
__api __check_ret __pure enum iio_modifier iio_channel_get_modifier | ( | const struct iio_channel * | chn | ) |
Get the modifier type of the given channel.
chn | A pointer to an iio_channel structure |
__api __check_ret __pure const char* iio_channel_get_name | ( | const struct iio_channel * | chn | ) |
Retrieve the channel name (e.g.
vccint)
chn | A pointer to an iio_channel structure |
NOTE: if the channel has no name, NULL is returned.
__api __check_ret __pure enum iio_chan_type iio_channel_get_type | ( | const struct iio_channel * | chn | ) |
Get the type of the given channel.
chn | A pointer to an iio_channel structure |
__api __check_ret bool iio_channel_is_enabled | ( | const struct iio_channel * | chn, |
const struct iio_channels_mask * | mask | ||
) |
Returns True if the channel is enabled.
chn | A pointer to an iio_channel structure |
__api __check_ret __pure bool iio_channel_is_output | ( | const struct iio_channel * | chn | ) |
Return True if the given channel is an output channel.
chn | A pointer to an iio_channel structure |
__api __check_ret __pure bool iio_channel_is_scan_element | ( | const struct iio_channel * | chn | ) |
Return True if the given channel is a scan element.
chn | A pointer to an iio_channel structure |
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.
__api __check_ret 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.
chn | A pointer to an iio_channel structure |
block | A pointer to an iio_block structure |
dst | A pointer to the memory area where the converted data will be stored |
len | The available length of the memory area, in bytes |
raw | True to read samples in the hardware format, false to read converted samples. |
__api void iio_channel_set_data | ( | struct iio_channel * | chn, |
void * | data | ||
) |
Associate a pointer to an iio_channel structure.
chn | A pointer to an iio_channel structure |
data | The pointer to be associated |
__api __check_ret 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.
chn | A pointer to an iio_channel structure |
block | A pointer to an iio_block structure |
src | A pointer to the memory area where the sequential data will be read from |
len | The length of the memory area, in bytes |
raw | True if the samples are already in hardware format, false if they need to be converted. |