TOP Contributors

  1. MIKROE (2659 codes)
  2. Alcides Ramos (356 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 (137002 times)
  2. FAT32 Library (70121 times)
  3. Network Ethernet Library (56028 times)
  4. USB Device Library (46348 times)
  5. Network WiFi Library (41966 times)
  6. FT800 Library (41286 times)
  7. GSM click (29055 times)
  8. mikroSDK (26489 times)
  9. PID Library (26451 times)
  10. microSD click (25413 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: 1935 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

Button ALARM click

5

Button Alarm Click is a very interesting interactive gadget on a Click board. It is an integrated capacitive touch sensor display in the form of a button.

[Learn More]

Microwave click

0

Microwave click detects movement, thanks to the PD-V11 a 24GHz microwave motion sensor. The typical use for Microwave click is a proximity or motion detector in various applications and devices.

[Learn More]

IPD 2017 click

0

IPD Click is a compact add-on board for controlling inductive and resistive loads in industrial automation and other demanding applications. This board features the TPD2017FN, an 8-channel low-side switch with MOSFET outputs from Toshiba Semiconductor.

[Learn More]