XCORE SDK
XCORE Software Development Kit
Functions
Device_control_host

Functions

control_ret_t control_init_i2c (unsigned char i2c_slave_address)
 
control_ret_t control_cleanup_i2c (void)
 
control_ret_t control_init_usb (int vendor_id, int product_id, int interface_num)
 
control_ret_t control_cleanup_usb (void)
 
control_ret_t control_query_version (control_version_t *version)
 
control_ret_t control_write_command (control_resid_t resid, control_cmd_t cmd, const uint8_t payload[], size_t payload_len)
 
control_ret_t control_read_command (control_resid_t resid, control_cmd_t cmd, uint8_t payload[], size_t payload_len)
 

Detailed Description

The public API for using the device control host library

Function Documentation

◆ control_cleanup_i2c()

control_ret_t control_cleanup_i2c ( void  )

Shutdown the I2C host (master) interface connection

Returns
Whether the shutdown was successful or not

◆ control_cleanup_usb()

control_ret_t control_cleanup_usb ( void  )

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_addressI2C 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_idVendor ID of controlled USB device
product_idProduct ID of controlled USB device
interface_numUSB 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
versionReference 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()

control_ret_t control_read_command ( control_resid_t  resid,
control_cmd_t  cmd,
uint8_t  payload[],
size_t  payload_len 
)

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
residResource ID. Indicates which resource the command is intended for
cmdCommand code. Note that this will be in the range 0x80 to 0xFF because bit 7 set indiciates a write command
payloadArray of bytes which constitutes the data payload
payload_lenSize of the payload in bytes
Returns
Whether the read from the device was successful or not

◆ control_write_command()

control_ret_t control_write_command ( control_resid_t  resid,
control_cmd_t  cmd,
const uint8_t  payload[],
size_t  payload_len 
)

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
residResource ID. Indicates which resource the command is intended for
cmdCommand code. Note that this will be in the range 0x80 to 0xFF because bit 7 set indiciates a write command
payloadArray of bytes which constitutes the data payload
payload_lenSize of the payload in bytes
Returns
Whether the write to the device was successful or not