TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (357 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (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 (137069 times)
  2. FAT32 Library (70199 times)
  3. Network Ethernet Library (56082 times)
  4. USB Device Library (46395 times)
  5. Network WiFi Library (42013 times)
  6. FT800 Library (41347 times)
  7. GSM click (29108 times)
  8. mikroSDK (26544 times)
  9. PID Library (26486 times)
  10. microSD click (25483 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: 1939 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

MAGNETO 4 click

5

Magneto 4 click is a high-resolution magnetic encoder Click board which allows contactless movement sensing down to 0.5µm. It features the AS5311, the complete integrated solution with Hall elements, low-noise analog front-end, and digital signal processing (DSP) sections, on the same die.

[Learn More]

GNSS 6 click

0

GNSS 6 Click is a compact add-on board that provides fast positioning capabilities. This board features the Teseo-LIV3FL, a tiny low-power GNSS module from STMicroelectronics. It is an easy-to-use global navigation satellite system that embeds the Teseo III single-die standalone positioning receiver, which can work simultaneously on multiple constellations (GPS, Galileo, Glonass, BeiDou, and QZSS). It provides proven accuracy and robustness of the Teseo ICs and comes with embedded firmware that saves development time.

[Learn More]

LED Driver 10 click

0

LED Driver 10 Click is a compact add-on board that simplifies the control of multiple LEDs. This board features the TLC59283, a 16-channel, constant-current sink light-emitting diode (LED) driver with pre-charge FET from Texas Instruments.

[Learn More]