TOP Contributors

  1. MIKROE (2745 codes)
  2. Alcides Ramos (371 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (138914 times)
  2. FAT32 Library (71500 times)
  3. Network Ethernet Library (56914 times)
  4. USB Device Library (47269 times)
  5. Network WiFi Library (42993 times)
  6. FT800 Library (42282 times)
  7. GSM click (29724 times)
  8. mikroSDK (27668 times)
  9. PID Library (26828 times)
  10. microSD click (26087 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

USB-C Sink click

Rating:

5

Author: MIKROE

Last Updated: 2021-01-29

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: USB-C PD

Downloaded: 2341 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.

No Abuse Reported

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".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

USB-C Sink Click

USB-C Sink Click

Native view of the USB-C Sink Click board.

View full image
USB-C Sink Click

USB-C Sink Click

Front and back view of the USB-C Sink Click board.

View full image

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 :

  • System Initialization - Initializes I2C, sets AN, CS, INT and PWM pins as input and set RST pin as output and start to write log.
  • Application Initialization - Initialization driver enables - I2C, set hw reset, set PDO2 profile and current value for PDO2 2.5A, upload new data and reset device to write NVM settings to the STUSB450, also write log.
  • Application Task - (code snippet) This is an example which demonstrates the use of USB-C Sink Click board™. USB-C Sink Click board™ can be used to read the Power Data Objects (PDO) highest priority profile: PDO1 : 5V, PDO2 : 12V, PDO3 : 20V. All data logs write on USB uart changes for every 5 sec.
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:

  • I2C
  • UART
  • Conversions

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

Buck Boost click

6

Buck-Boost click features LTC3129-1, a buck-boost DC/DC conversion integrated circuit from Linear Technology®. The click supports wide input voltage range and can output eight discrete regulated voltage levels, selectable by the digital output voltage selection pins, ranging from 2.5V to 15V.

[Learn More]

Fingerprint click

0

Fingerprint click is the simplest way to integrate biometric security to your design. The smallest optical touch fingerprint sensor in the world is featured on the click — GTS-511E2. The sensor takes a digital imprint of the fingerprint pattern using visible light. The board is designed to use a 3.3V power supply.

[Learn More]

Scanner click

0

Scanner Click as his name said, is an optical scanner expansion board for building optical cost-sensitive scanners and printers.

[Learn More]