The public API for using the device control host library
◆ control_cleanup_i2c()
Shutdown the I2C host (master) interface connection
- Returns
- Whether the shutdown was successful or not
◆ control_cleanup_usb()
Shutdown the USB host interface connection
- Returns
- Whether the shutdown was successful or not
◆ control_init_i2c()
control_ret_t control_init_i2c |
( |
unsigned char |
i2c_slave_address | ) |
|
Initialize the I2C host (master) interface
- Parameters
-
i2c_slave_address | I2C address of the slave (controlled device) |
- Returns
- Whether the initialization was successful or not
◆ control_init_usb()
control_ret_t control_init_usb |
( |
int |
vendor_id, |
|
|
int |
product_id, |
|
|
int |
interface_num |
|
) |
| |
Initialize the USB host interface
- Parameters
-
vendor_id | Vendor ID of controlled USB device |
product_id | Product ID of controlled USB device |
interface_num | USB Control interface number of controlled device |
- Returns
- Whether the initialization was successful or not
◆ control_query_version()
control_ret_t control_query_version |
( |
control_version_t * |
version | ) |
|
Checks to see that the version of control library in the device is the same as the host
- Parameters
-
version | Reference to control version variable that is set on this call |
- Returns
- Whether the checking of control library version was successful or not
◆ control_read_command()
Request to read from controllable resource inside the device. The command consists of a resource ID, command and a byte payload of length payload_len.
- Parameters
-
resid | Resource ID. Indicates which resource the command is intended for |
cmd | Command code. Note that this will be in the range 0x80 to 0xFF because bit 7 set indiciates a write command |
payload | Array of bytes which constitutes the data payload |
payload_len | Size of the payload in bytes |
- Returns
- Whether the read from the device was successful or not
◆ control_write_command()
Request to write to controllable resource inside the device. The command consists of a resource ID, command and a byte payload of length payload_len.
- Parameters
-
resid | Resource ID. Indicates which resource the command is intended for |
cmd | Command code. Note that this will be in the range 0x80 to 0xFF because bit 7 set indiciates a write command |
payload | Array of bytes which constitutes the data payload |
payload_len | Size of the payload in bytes |
- Returns
- Whether the write to the device was successful or not