usbcsink 2.0.0.0
|
API for configuring and manipulating USB-C Sink Click driver. More...
Topics | |
USB-C Sink Registers List | |
List of registers of USB-C Sink Click driver. | |
USB-C Sink Registers Settings | |
Settings for registers of USB-C Sink Click driver. | |
USB-C Sink MikroBUS Map | |
MikroBUS pin mapping of USB-C Sink Click driver. | |
Functions | |
void | usbcsink_cfg_setup (usbcsink_cfg_t *cfg) |
USB-C Sink configuration object setup function. | |
err_t | usbcsink_init (usbcsink_t *ctx, usbcsink_cfg_t *cfg) |
USB-C Sink initialization function. | |
err_t | usbcsink_generic_write (usbcsink_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
USB-C Sink I2C writing function. | |
err_t | usbcsink_generic_read (usbcsink_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
USB-C Sink I2C reading function. | |
void | usbcsink_hw_reset (usbcsink_t *ctx) |
HW reset function. | |
uint8_t | usbcsink_get_pdo2 (usbcsink_t *ctx) |
Get PO2 pin state function. | |
uint8_t | usbcsink_get_pdo3 (usbcsink_t *ctx) |
Get PO3 pin state function. | |
uint8_t | usbcsink_get_interrupt (usbcsink_t *ctx) |
Get INT pin state function. | |
void | usbcsink_write_byte (usbcsink_t *ctx, uint8_t reg, uint8_t tx_data) |
Write byte function. | |
uint8_t | usbcsink_read_byte (usbcsink_t *ctx, uint8_t reg) |
Read byte function. | |
uint8_t | usbcsink_dev_chk (usbcsink_t *ctx) |
Check device communication function. | |
err_t | usbcsink_cust_wr_sec (usbcsink_t *ctx, uint8_t sec_num, uint8_t *sec_data) |
Write sector function. | |
err_t | usbcsink_cust_ent_wr_mode (usbcsink_t *ctx, uint8_t er_sec) |
Enter the write mode function. | |
err_t | usbcsink_cust_ext_test_mode (usbcsink_t *ctx) |
Exit write mode function. | |
void | usbcsink_load_data (usbcsink_t *ctx) |
Load data function. | |
void | usbcsink_upload_new_data (usbcsink_t *ctx, uint8_t def_vals) |
Upload data function. | |
void | usbcsink_set_voltage (uint8_t pdo_numb, float volt) |
Set the voltage function. | |
float | usbcsink_get_voltage (uint8_t pdo_numb) |
Get the voltage function. | |
void | usbcsink_set_current (uint8_t pdo_numb, float curr) |
Set the current function. | |
float | usbcsink_get_current (uint8_t pdo_numb) |
Get the current function. | |
void | usbcsink_set_lo_volt_limit (uint8_t pdo_numb, uint8_t value) |
Set the lower voltage limit function. | |
uint8_t | usbcsink_get_lo_volt_limit (uint8_t pdo_numb) |
Get the lower voltage limit function. | |
void | usbcsink_set_up_volt_limit (uint8_t pdo_numb, uint8_t value) |
Set the upper voltage limit function. | |
uint8_t | usbcsink_get_up_volt_limit (uint8_t pdo_numb) |
Get the over voltage limit function. | |
void | usbcsink_set_flx_curr (float value) |
Set the flexible current function. | |
float | usbcsink_get_flx_curr (void) |
Get the flexible current function. | |
void | usbcsink_set_pdo_num (uint8_t pdo_numb) |
Set the number of sink function. | |
uint8_t | usbcsink_get_pdo_num (void) |
Get the number of sink function. | |
void | usbcsink_set_ext_pow (uint8_t value) |
Set the external source of power function. | |
uint8_t | usbcsink_get_ext_pow (void) |
Get the external source of power function. | |
void | usbcsink_set_usb_com_capa (uint8_t value) |
Set the USB capable function. | |
uint8_t | usbcsink_get_usb_com_cap (void) |
Get the USB capable function. | |
void | usbcsink_set_cfg_ok_gpio (uint8_t value) |
Set the config OK GPIO function. | |
uint8_t | usbcsink_get_cfg_ok_gpio (void) |
Get the config OK GPIO function. | |
void | usbcsink_set_gpio_ctl (uint8_t value) |
Set the config CTRL GPIO function. | |
uint8_t | usbcsink_get_gpio_ctl (void) |
Get the config CTRL GPIO function. | |
void | usbcsink_set_pow_above_5v_only (uint8_t value) |
Set the power only above 5V function. | |
uint8_t | usbcsink_get_pow_above_5v_only (void) |
Get the power only above 5V function. | |
void | usbcsink_set_req_src_current (uint8_t value) |
Set the request operating current function. | |
uint8_t | usbcsink_get_req_src_curr (void) |
Get the request operating current function. | |
API for configuring and manipulating USB-C Sink Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void usbcsink_cfg_setup | ( | usbcsink_cfg_t * | cfg | ) |
USB-C Sink configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See usbcsink_cfg_t object definition for detailed explanation. |
err_t usbcsink_cust_ent_wr_mode | ( | usbcsink_t * | ctx, |
uint8_t | er_sec ) |
Enter the write mode function.
The function enter the write mode of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
[in] | er_sec | : Sector number. |
0
- Success, -1
- Error.err_t usbcsink_cust_ext_test_mode | ( | usbcsink_t * | ctx | ) |
Exit write mode function.
The function the exit of writing mode of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t usbcsink_cust_wr_sec | ( | usbcsink_t * | ctx, |
uint8_t | sec_num, | ||
uint8_t * | sec_data ) |
Write sector function.
The function write sector is used to write multiple data bytes to a group of sector registers of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. |
[in] | sec_num | : Sector number. |
[in] | sec_data | : Sector data to be written. See usbcsink_t object definition for detailed explanation. |
0
- Success, -1
- Error.uint8_t usbcsink_dev_chk | ( | usbcsink_t * | ctx | ) |
Check device communication function.
The function check device communication of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
err_t usbcsink_generic_read | ( | usbcsink_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
USB-C Sink I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | rx_buf | : Output read data. |
[in] | rx_len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t usbcsink_generic_write | ( | usbcsink_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
USB-C Sink I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | tx_buf | : Data to be written. |
[in] | tx_len | : Number of bytes to be written. |
0
- Success, -1
- Error.uint8_t usbcsink_get_cfg_ok_gpio | ( | void | ) |
Get the config OK GPIO function.
The function get the config OK GPIO of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
0
- Source attached. 1
- No source attached. float usbcsink_get_current | ( | uint8_t | pdo_numb | ) |
Get the current function.
The function get the current to be requested for each of the three power data objects ( PDO ) of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
uint8_t usbcsink_get_ext_pow | ( | void | ) |
Get the external source of power function.
The function get the external source of power of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
0
- No external source of power. 1
- An external power source is available and is sufficient to adequately power the system while charging external devices. float usbcsink_get_flx_curr | ( | void | ) |
Get the flexible current function.
The function set the flexible current value common to all PDOs of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
uint8_t usbcsink_get_gpio_ctl | ( | void | ) |
Get the config CTRL GPIO function.
The function get the config CTRL GPIO of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
0
- Source attached. 1
- No source attached. uint8_t usbcsink_get_interrupt | ( | usbcsink_t * | ctx | ) |
Get INT pin state function.
The function get INT pin state reset the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
uint8_t usbcsink_get_lo_volt_limit | ( | uint8_t | pdo_numb | ) |
Get the lower voltage limit function.
The function get the under votlage lock out parameter for each of the three power data objects ( PDO ) of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
uint8_t usbcsink_get_pdo2 | ( | usbcsink_t * | ctx | ) |
Get PO2 pin state function.
The function get PO2 ( AN ) pin state reset the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
uint8_t usbcsink_get_pdo3 | ( | usbcsink_t * | ctx | ) |
Get PO3 pin state function.
The function get PO3 ( CS ) pin state reset the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
uint8_t usbcsink_get_pdo_num | ( | void | ) |
Get the number of sink function.
The function set the number of sink PDOs of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
uint8_t usbcsink_get_pow_above_5v_only | ( | void | ) |
Get the power only above 5V function.
The function get the power only above 5V parameter configuration of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | value | :
|
uint8_t usbcsink_get_req_src_curr | ( | void | ) |
Get the request operating current function.
The function get the request operating current selects which operation current from the sink or the source is to be requested in the RDO message of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
0
- Request I SNK sink as operating current in RDO message. 1
- Request I SRC sink as operating current in RDO message. uint8_t usbcsink_get_up_volt_limit | ( | uint8_t | pdo_numb | ) |
Get the over voltage limit function.
The function get the over votlage lock out parameter for each of the three power data objects ( PDO ) of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
uint8_t usbcsink_get_usb_com_cap | ( | void | ) |
Get the USB capable function.
The function get the USB capable parameter value of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
0
- Sink does not support data communication. 1
- Sink does support data communication. float usbcsink_get_voltage | ( | uint8_t | pdo_numb | ) |
Get the voltage function.
The function get the voltage to be requested for each of the three power data objects ( PDO ) of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
void usbcsink_hw_reset | ( | usbcsink_t * | ctx | ) |
HW reset function.
The function hw reset, reset the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[out] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
err_t usbcsink_init | ( | usbcsink_t * | ctx, |
usbcsink_cfg_t * | cfg ) |
USB-C Sink initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See usbcsink_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.void usbcsink_load_data | ( | usbcsink_t * | ctx | ) |
Load data function.
The function load data is used to read the non-volatile memory of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
uint8_t usbcsink_read_byte | ( | usbcsink_t * | ctx, |
uint8_t | reg ) |
Read byte function.
The function read a the byte of data from the targeted 8-bit register address of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
[in] | reg | : 8-bit register address. |
void usbcsink_set_cfg_ok_gpio | ( | uint8_t | value | ) |
Set the config OK GPIO function.
The function set the config OK GPIO of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | value | :
|
void usbcsink_set_current | ( | uint8_t | pdo_numb, |
float | curr ) |
Set the current function.
The function set the current to be requested for each of the three power data objects ( PDO ) of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
[in] | curr | : Float current value. |
void usbcsink_set_ext_pow | ( | uint8_t | value | ) |
Set the external source of power function.
The function set the external source of power of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | value | :
|
void usbcsink_set_flx_curr | ( | float | value | ) |
Set the flexible current function.
The function set the flexible current value common to all PDOs of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | value | : Float flexible current data. |
void usbcsink_set_gpio_ctl | ( | uint8_t | value | ) |
Set the config CTRL GPIO function.
The function set the config CTRL GPIO of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | value | :
|
void usbcsink_set_lo_volt_limit | ( | uint8_t | pdo_numb, |
uint8_t | value ) |
Set the lower voltage limit function.
The function set the under votlage lock out parameter for each of the three power data objects ( PDO ) of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
[in] | value | : 8-bit under votlage lock out parameter. |
void usbcsink_set_pdo_num | ( | uint8_t | pdo_numb | ) |
Set the number of sink function.
The function set the the number of sink PDOs of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
void usbcsink_set_pow_above_5v_only | ( | uint8_t | value | ) |
Set the power only above 5V function.
The function set the power only above 5V parameter configuration of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | value | :
|
void usbcsink_set_req_src_current | ( | uint8_t | value | ) |
Set the request operating current function.
The function set the request operating current selects which operation current from the sink or the source is to be requested in the RDO message of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | value | :
|
void usbcsink_set_up_volt_limit | ( | uint8_t | pdo_numb, |
uint8_t | value ) |
Set the upper voltage limit function.
The function set the over votlage lock out parameter for each of the three power data objects ( PDO ) of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
[in] | value | : 8-bit over votlage lock out parameter. |
void usbcsink_set_usb_com_capa | ( | uint8_t | value | ) |
Set the USB capable function.
The function set the USB capable parameter value of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | value | :
|
void usbcsink_set_voltage | ( | uint8_t | pdo_numb, |
float | volt ) |
Set the voltage function.
The function sets the voltage to be requested for each of the three power data objects ( PDO ) of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | pdo_numb | : Number of the sink PDOs[ 1 - 3 ] ( profile ). |
[in] | volt | : Float voltage value. |
void usbcsink_upload_new_data | ( | usbcsink_t * | ctx, |
uint8_t | def_vals ) |
Upload data function.
The function upload data is used to write new data to the non-volatile memory of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. |
[in] | def_vals | : Default values. See usbcsink_t object definition for detailed explanation. |
void usbcsink_write_byte | ( | usbcsink_t * | ctx, |
uint8_t | reg, | ||
uint8_t | tx_data ) |
Write byte function.
The function write byte the byte of data to the targeted 8-bit register address of the STUSB4500 Standalone USB PD sink controller on USB-C Sink Click board.
[in] | ctx | : Click context object. See usbcsink_t object definition for detailed explanation. |
[in] | reg | : 8-bit register address. |
[in] | tx_data | : Data to be written. |