va_io_device.hπ
#include <va_io_device.h>
Defines
-
VA_IO_MAX_CHANNELS
π The maximum number of I/O channels.
Enums
Functions
-
const char *
va_io_device_name
(void)π Returns a human-readable name for the I/O device this server controls.
-
int
va_io_device_init
(void)π Initializes the I/O device.
This function will be called once when the server starts, before any of the functions that access the device.
- Return
0 on success, -1 on failure. On error sets the error message to be retrieved with va_io_last_error().
-
const char *
va_io_last_error
(void)π Returns the last error message.
The returned memory address may point to a static storage that is overwritten on each error.
-
unsigned int
va_io_channel_count
(void)π Returns the total number of I/O channels.
-
void
va_io_fill_config
(unsigned int channel, struct va_io_channel_config *config)π Fills in the configuration for channel.
It is guaranteed by the caller that channel is smaller than va_io_device_channel_count(). The function must set all members of the config structure.
- Parameters
channel
: Index of channel.value
: A pointer to a channel config structure to fill.
-
int
va_io_read_input
(unsigned int channel, unsigned int *value)π Reads the value of an input channel and stores it to value.
It is guaranteed by the caller that channel is an input channel. Note that both the I/O protocol and the server implementation always treat β1β as the active state of a binary input regardless of the inputβs electrical polarity.
- Return
0 on success. On I/O error returns -1 and sets the error message to be retrieved with va_io_last_error().
- Parameters
channel
: Index of channel.value
: A pointer to a memory location to store the value into.
-
int
va_io_write_output
(unsigned int channel, unsigned int value)π Sets the state of a digital output channel.
It is guaranteed by the caller that channel is an output channel and that value is at most the maximum allowed value for that channel. Note that β1β is always considered as the active state of the output regardless of its electrical polarity.
- Return
0 on success, -1 on failure. On error sets the error message to be retrieved with va_io_last_error().
- Parameters
channel
: Index of channel.value
: The new value of the channel.