We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2021-01-29
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: USB-C PD
Downloaded: 2408 times
Not followed.
License: MIT license
USB-C Sink Click is a compact add-on board that contains a standalone autonomous USB power delivery controller. This board features the STUSB4500, a USB-C sink-only controller compatible with Power-Delivery (PD) from STMicroelectronics.
Do you want to subscribe in order to receive notifications regarding "USB-C Sink click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "USB-C Sink click" changes.
Do you want to report abuse regarding "USB-C Sink click".
Library Description
The library covers all the necessary functions to control USB-C Sink Click board™. A library performs the communication with the device via I2C interface.
Key functions:
uint8_t usbcsink_generic_write ( uint8_t reg, uint8_t *p_tx_data, uint8_t n_bytes )
- Generic write function.void usbcsink_generic_read ( uint8_t reg, uint8_t *p_rx_data, uint8_t n_bytes )
- Generic read function.void usbcsink_set_pdo_num ( uint8_t pdo_numb )
- Set the number of sink function.Examples description
The application is composed of three sections :
void application_task ( )
{
usbcsink_load_data( );
mikrobus_logWrite( " New Parameters ", _LOG_LINE );
mikrobus_logWrite( "------------------------", _LOG_LINE );
sel_profile = usbcsink_get_pdo_num( );
mikrobus_logWrite( " PDO Number ~ ", _LOG_TEXT );
mikrobus_logWrite( "PDO", _LOG_TEXT );
ByteToStr( sel_profile, log_text );
Ltrim( log_text );
mikrobus_logWrite( log_text, _LOG_LINE );
mikrobus_logWrite( "- - - - - - - - - - - - ", _LOG_LINE );
demo_data = usbcsink_get_voltage( sel_profile );
mikrobus_logWrite( " Voltage : ", _LOG_TEXT );
FloatToStr( demo_data, log_text );
Ltrim( log_text );
mikrobus_logWrite( log_text, _LOG_TEXT );
mikrobus_logWrite( " V", _LOG_LINE );
demo_data = usbcsink_get_current( sel_profile );
mikrobus_logWrite( " Current : ", _LOG_TEXT );
FloatToStr( demo_data, log_text );
Ltrim( log_text );
mikrobus_logWrite( log_text, _LOG_TEXT );
mikrobus_logWrite( " A", _LOG_LINE );
mikrobus_logWrite( "------------------------", _LOG_LINE );
Delay_ms( 5000 );
}
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.