channel.jl
AdalmPluto.libIIO_jl.C_iio_channel_attr_get_filename
AdalmPluto.libIIO_jl.C_iio_channel_attr_read
AdalmPluto.libIIO_jl.C_iio_channel_attr_read_all
AdalmPluto.libIIO_jl.C_iio_channel_attr_read_bool
AdalmPluto.libIIO_jl.C_iio_channel_attr_read_double
AdalmPluto.libIIO_jl.C_iio_channel_attr_read_longlong
AdalmPluto.libIIO_jl.C_iio_channel_attr_write
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_all
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_bool
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_double
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_longlong
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_raw
AdalmPluto.libIIO_jl.C_iio_channel_disable
AdalmPluto.libIIO_jl.C_iio_channel_enable
AdalmPluto.libIIO_jl.C_iio_channel_find_attr
AdalmPluto.libIIO_jl.C_iio_channel_get_attr
AdalmPluto.libIIO_jl.C_iio_channel_get_attrs_count
AdalmPluto.libIIO_jl.C_iio_channel_get_data
AdalmPluto.libIIO_jl.C_iio_channel_get_device
AdalmPluto.libIIO_jl.C_iio_channel_get_id
AdalmPluto.libIIO_jl.C_iio_channel_get_modifier
AdalmPluto.libIIO_jl.C_iio_channel_get_name
AdalmPluto.libIIO_jl.C_iio_channel_get_type
AdalmPluto.libIIO_jl.C_iio_channel_is_enabled
AdalmPluto.libIIO_jl.C_iio_channel_is_output
AdalmPluto.libIIO_jl.C_iio_channel_is_scan_element
AdalmPluto.libIIO_jl.C_iio_channel_read!
AdalmPluto.libIIO_jl.C_iio_channel_read_raw
AdalmPluto.libIIO_jl.C_iio_channel_set_data
AdalmPluto.libIIO_jl.C_iio_channel_write
AdalmPluto.libIIO_jl.C_iio_channel_write_raw
AdalmPluto.libIIO_jl.C_iio_channel_attr_get_filename
— MethodC_iio_channel_attr_get_filename(channel, attr)
Retrieve the filename of an attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attribute
Returns
- On success, a NULL-terminated string
- If the attribute name is unknown, NULL is returned. If the assertions are enabled, throws an error instead.
AdalmPluto.libIIO_jl.C_iio_channel_attr_read
— MethodC_iio_channel_attr_read(channel, attr)
Read the content of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attribute
Returns
- On success,
(nbytes, value::String)
where nbytes is the length of the value string. - On error,
(errno, "")
is returned, where errno is a negative error code. - If all the attributes are begin read, an array of the values above is returned.
The string may be shorter than the number of bytes returned as the conversion tirims excess null characters.
NOTE
By passing NULL (replaced by an empty string in the Julia wrapper) as the "attr" argument to iio_channel_attr_read
, it is now possible to read all of the attributes of a channel.
The buffer is filled with one block of data per attribute of the channel, by the order they appear in the iio_channel structure.
The first four bytes of one block correspond to a 32-bit signed value in network order. If negative, it corresponds to the errno code that were returned when reading the attribute; if positive, it corresponds to the length of the data read. In that case, the rest of the block contains the data.
AdalmPluto.libIIO_jl.C_iio_channel_attr_read_all
— MethodC_iio_channel_attr_read_all()
THIS IS A PLACEHOLDER. THE DOCUMENTATION BELOW IS ONLY A COPY/PASTE OF THE C DOCUMENTATION.
Read the content of all channel-specific attributes.
Parameters
- chn : A pointer to an iio_channel structure
- cb : A pointer to a callback function
- data : A pointer that will be passed to the callback function
Returns
- On success, 0 is returned
- On error, a negative errno code is returned
NOTE
This function is especially useful when used with the network backend, as all the channel-specific attributes are read in one single command.
AdalmPluto.libIIO_jl.C_iio_channel_attr_read_bool
— MethodC_iio_channel_attr_read_bool(channel, attr)
Read the content of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attribute
Returns
- On success,
(0, value::Bool)
is returned - On error,
(errno, false)
is returned, where errno is a negative error code. The second value should be discarded.
AdalmPluto.libIIO_jl.C_iio_channel_attr_read_double
— MethodC_iio_channel_attr_read_double(channel, attr)
Read the content of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attribute
Returns
- On success,
(0, value::Float64)
is returned - On error,
(errno, 0)
is returned, where errno is a negative error code. The second value should be discarded.
AdalmPluto.libIIO_jl.C_iio_channel_attr_read_longlong
— MethodC_iio_channel_attr_read_longlong(channel, attr)
Read the content of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attribute
Returns
- On success,
(0, value::Int64)
is returned - On error,
(errno, 0)
is returned, where errno is a negative error code. The second value should be discarded.
AdalmPluto.libIIO_jl.C_iio_channel_attr_write
— MethodC_iio_channel_attr_write(channel, attr, value)
Set the value of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attributevalue::String
: A NULL-terminated string to set the attribute to
Returns
- On success, the number of bytes written
- On error, a negative errno code is returned
NOTE
By passing NULL as the "attr" argument to iio_channel_attr_write
, it is now possible to write all of the attributes of a channel.
The buffer must contain one block of data per attribute of the channel, by the order they appear in the iio_channel structure.
The first four bytes of one block correspond to a 32-bit signed value in network order. If negative, the attribute is not written; if positive, it corresponds to the length of the data to write. In that case, the rest of the block must contain the data.
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_all
— MethodC_iio_channel_attr_write_all()
THIS IS A PLACEHOLDER. THE DOCUMENTATION BELOW IS ONLY A COPY/PASTE OF THE C DOCUMENTATION.
Set the values of all channel-specific attributes.
Parameters
- chn : A pointer to an iio_channel structure
- cb : A pointer to a callback function
- data : A pointer that will be passed to the callback function
Returns
- On success, 0 is returned
- On error, a negative errno code is returned
NOTE
This function is especially useful when used with the network backend, as all the channel-specific attributes are written in one single command.
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_bool
— MethodC_iio_channel_attr_write_bool(channel, attr, value)
Set the value of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attributevalue::Bool
: A bool value to set the attribute to
Returns
- On success, 0 is returned
- On error, a negative errno code is returned
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_double
— MethodC_iio_channel_attr_write_double(channel, attr, value)
Set the value of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attributevalue::Float64
: A double value to set the attribute to
Returns
- On success, 0 is returned
- On error, a negative errno code is returned
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_longlong
— MethodC_iio_channel_attr_write_longlong(channel, attr, value)
Set the value of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attributevalue::Int64
: A long long value to set the attribute to
Returns
- On success, 0 is returned
- On error, a negative errno code is returned
AdalmPluto.libIIO_jl.C_iio_channel_attr_write_raw
— MethodC_iio_channel_attr_write_raw(channel, attr, value)
Set the value of the given channel-specific attribute.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureattr::String
: a NULL-terminated string corresponding to the name of the attributevalue::Ptr{Cvoid}
: A pointer to the data to be writtensize::Csize_t
: The number of bytes to be written
Returns
- On success, the number of bytes written
- On error, a negative errno code is returned
AdalmPluto.libIIO_jl.C_iio_channel_disable
— MethodC_iio_channel_disable(channel)
Disable the given channel.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
AdalmPluto.libIIO_jl.C_iio_channel_enable
— MethodC_iio_channel_enable(channel)
Enable the given channel.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
NOTE
Before creating an iiobuffer structure with `iiodevicecreatebuffer`, it is required to enable at least one channel of the device to read from.
AdalmPluto.libIIO_jl.C_iio_channel_find_attr
— MethodC_iio_channel_find_attr(channel, name)
Try to find a channel-specific attribute by its name.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structurename::String
: A NULL-terminated string corresponding to the name of the attribute
Returns
- On success, a NULL-terminated string.
- On failure, if the assertions are enabled, throws an error.
- On failure, if the assertions are disabled, returns an empty string.
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.
AdalmPluto.libIIO_jl.C_iio_channel_get_attr
— MethodC_iio_channel_get_attr(channel, index)
Get the channel-specific attribute present at the given index.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structureindex::UInt32
: The index corresponding to the attribute
Returns
- On success, a NULL-terminated string.
- On failure, if the assertions are enabled, throws an error.
- On failure, if the assertions are disabled, returns an empty string.
AdalmPluto.libIIO_jl.C_iio_channel_get_attrs_count
— MethodC_iio_channel_get_attrs_count(channel)
Enumerate the channel-specific attributes of the given channel.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- The number of channel-specific attributes found
AdalmPluto.libIIO_jl.C_iio_channel_get_data
— MethodC_iio_channel_get_data(channel)
Retrieve a previously associated pointer of an iio_channel structure.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- The pointer previously associated if present, or NULL
AdalmPluto.libIIO_jl.C_iio_channel_get_device
— MethodC_iio_channel_get_device(channel)
Retrieve a pointer to the iio_device structure.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- A pointer to an iio_device structure
AdalmPluto.libIIO_jl.C_iio_channel_get_id
— MethodC_iio_channel_get_id(channel)
Retrieve the channel ID (e.g. voltage0)
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- A NULL-terminated string
AdalmPluto.libIIO_jl.C_iio_channel_get_modifier
— MethodC_iio_channel_get_modifier(channel)
Get the modifier type of the given channel.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- The modifier type of the channel
AdalmPluto.libIIO_jl.C_iio_channel_get_name
— MethodC_iio_channel_get_name(channel)
Retrieve the channel name (e.g. vccint)
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- A NULL-terminated string.
NOTE
If the channel has no name, and the assertions are enabled, throws an error. If the assertions are disabled, returns an empty string.
AdalmPluto.libIIO_jl.C_iio_channel_get_type
— MethodC_iio_channel_get_type(channel)
Get the type of the given channel.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- The type of the channel
AdalmPluto.libIIO_jl.C_iio_channel_is_enabled
— MethodC_iio_channel_is_enabled(channel)
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- True if the channel is enabled, False otherwise
AdalmPluto.libIIO_jl.C_iio_channel_is_output
— MethodC_iio_channel_is_output(channel)
Return True if the given channel is an output channel.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- True if the channel is an output channel, False otherwise
AdalmPluto.libIIO_jl.C_iio_channel_is_scan_element
— MethodC_iio_channel_is_scan_element(channel)
Return True if the given channel is a scan element.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structure
Returns
- True if the channel is a scan element, False otherwise
AdalmPluto.libIIO_jl.C_iio_channel_read!
— MethodC_iio_channel_read!(chn, buf, dst)
Demultiplex and convert the samples of a given channel.
Parameters
chn::Ptr{iio_channel}
: A pointer to an iio_channel structurebuf::Ptr{iio_buffer}
: A pointer to an iio_buffer structuredst::Array{UInt8}
: An array where the converted data will be stored
Returns
- The size of the converted data written is dst, in bytes
AdalmPluto.libIIO_jl.C_iio_channel_read_raw
— MethodC_iio_channel_read_raw()
THIS IS A PLACEHOLDER. THE DOCUMENTATION BELOW IS ONLY A COPY/PASTE OF THE C DOCUMENTATION.
Demultiplex the samples of a given channel.
Parameters
- chn : A pointer to an iio_channel structure
- buffer : A pointer to an iio_buffer structure
- dst : A pointer to the memory area where the demultiplexed data will be stored
- len : The available length of the memory area, in bytes
Returns
- The size of the demultiplexed data, in bytes
AdalmPluto.libIIO_jl.C_iio_channel_set_data
— MethodC_iio_channel_set_data(channel, data)
Associate a pointer to an iio_channel structure. If the pointer is a Julia pointer, you need to protect the data from the GC.
See the Julia Documentation and GC.@preserve
.
Parameters
channel::Ptr{iio_channel}
: A pointer to an iio_channel structuredata::Ptr{Cvoid}
: The pointer to be associated.
AdalmPluto.libIIO_jl.C_iio_channel_write
— MethodC_iio_channel_write()
THIS IS A PLACEHOLDER. THE DOCUMENTATION BELOW IS ONLY A COPY/PASTE OF THE C DOCUMENTATION.
Convert and multiplex the samples of a given channel.
Parameters
- chn : A pointer to an iio_channel structure
- buffer : A pointer to an iio_buffer 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
Returns
- The number of bytes actually converted and multiplexed
AdalmPluto.libIIO_jl.C_iio_channel_write_raw
— MethodC_iio_channel_write_raw()
THIS IS A PLACEHOLDER. THE DOCUMENTATION BELOW IS ONLY A COPY/PASTE OF THE C DOCUMENTATION.
Multiplex the samples of a given channel.
Parameters
- chn : A pointer to an iio_channel structure
- buffer : A pointer to an iio_buffer 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
Returns
- The number of bytes actually multiplexed