usbcsink4  2.1.0.0
Modules | Functions
USB-C Sink 4 Click Driver

API for configuring and manipulating USB-C Sink 4 Click driver. More...

Modules

 USB-C Sink 4 Registers List
 List of registers of USB-C Sink 4 Click driver.
 
 USB-C Sink 4 Registers Settings
 Settings for registers of USB-C Sink 4 Click driver.
 
 USB-C Sink 4 MikroBUS Map
 MikroBUS pin mapping of USB-C Sink 4 Click driver.
 

Functions

void usbcsink4_cfg_setup (usbcsink4_cfg_t *cfg)
 USB-C Sink 4 configuration object setup function. More...
 
err_t usbcsink4_init (usbcsink4_t *ctx, usbcsink4_cfg_t *cfg)
 USB-C Sink 4 initialization function. More...
 
err_t usbcsink4_default_cfg (usbcsink4_t *ctx)
 USB-C Sink 4 default configuration function. More...
 
err_t usbcsink4_generic_write (usbcsink4_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len)
 USB-C Sink 4 I2C writing function. More...
 
err_t usbcsink4_generic_read (usbcsink4_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len)
 USB-C Sink 4 I2C reading function. More...
 
err_t usbcsink4_get_silicon_id (usbcsink4_t *ctx, uint16_t *silicon_id)
 USB-C Sink 4 get Silicon ID function. More...
 
err_t usbcsink4_get_type_c_status (usbcsink4_t *ctx, usbcsink4_type_c_status_t *type_c_status)
 USB-C Sink 4 get Type-C status function. More...
 
err_t usbcsink4_get_bus_voltage (usbcsink4_t *ctx, float *vbus_v)
 USB-C Sink 4 get VBUS function. More...
 
err_t usbcsink4_get_bus_current (usbcsink4_t *ctx, float *vbus_c)
 USB-C Sink 4 get VBUS current function. More...
 
err_t usbcsink4_get_event_status (usbcsink4_t *ctx, usbcsink4_event_status_t *event_status)
 USB-C Sink 4 get event status function. More...
 
err_t usbcsink4_get_chrg_mode (usbcsink4_t *ctx, uint8_t *chrg_mode)
 USB-C Sink 4 get charging mode function. More...
 
err_t usbcsink4_reset_device (usbcsink4_t *ctx)
 USB-C Sink 4 reset the device function. More...
 
err_t usbcsink4_reset_i2c (usbcsink4_t *ctx)
 USB-C Sink 4 reset the I2C block function. More...
 
err_t usbcsink4_get_response (usbcsink4_t *ctx, uint8_t *rsp_code)
 USB-C Sink 4 get response function. More...
 
uint8_t usbcsink4_get_interrupt (usbcsink4_t *ctx)
 USB-C Sink 4 get interrupt function. More...
 
uint8_t usbcsink4_get_fault_condition (usbcsink4_t *ctx)
 USB-C Sink 4 get fault indicator function. More...
 

Detailed Description

API for configuring and manipulating USB-C Sink 4 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ usbcsink4_cfg_setup()

void usbcsink4_cfg_setup ( usbcsink4_cfg_t cfg)

USB-C Sink 4 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See usbcsink4_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ usbcsink4_default_cfg()

err_t usbcsink4_default_cfg ( usbcsink4_t ctx)

USB-C Sink 4 default configuration function.

This function executes a default configuration of USB-C Sink 4 click board.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ usbcsink4_generic_read()

err_t usbcsink4_generic_read ( usbcsink4_t ctx,
uint16_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

USB-C Sink 4 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_generic_write()

err_t usbcsink4_generic_write ( usbcsink4_t ctx,
uint16_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

USB-C Sink 4 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_get_bus_current()

err_t usbcsink4_get_bus_current ( usbcsink4_t ctx,
float *  vbus_c 
)

USB-C Sink 4 get VBUS current function.

This function reads the live current draw on the VBUS supply for the specified port by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[out]vbus_c: Current [A].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_get_bus_voltage()

err_t usbcsink4_get_bus_voltage ( usbcsink4_t ctx,
float *  vbus_v 
)

USB-C Sink 4 get VBUS function.

This function reads the live voltage on the VBUS supply for the specified port by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[out]vbus_v: Voltage [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_get_chrg_mode()

err_t usbcsink4_get_chrg_mode ( usbcsink4_t ctx,
uint8_t *  chrg_mode 
)

USB-C Sink 4 get charging mode function.

This function reads the status reports of the active legacy charging mode by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[out]chrg_mode: Legacy charging mode status.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_get_event_status()

err_t usbcsink4_get_event_status ( usbcsink4_t ctx,
usbcsink4_event_status_t event_status 
)

USB-C Sink 4 get event status function.

This function reads the reports of the event status to know what has happened on the Type-C/PD port by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[out]event_status: Event status object. See usbcsink4_event_status_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_get_fault_condition()

uint8_t usbcsink4_get_fault_condition ( usbcsink4_t ctx)

USB-C Sink 4 get fault indicator function.

This function get states of the fault indicator pin.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ usbcsink4_get_interrupt()

uint8_t usbcsink4_get_interrupt ( usbcsink4_t ctx)

USB-C Sink 4 get interrupt function.

This function get states of the interrupt pin.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ usbcsink4_get_response()

err_t usbcsink4_get_response ( usbcsink4_t ctx,
uint8_t *  rsp_code 
)

USB-C Sink 4 get response function.

This function is used to store responses to commands sent on certain command registers by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[in]rsp_code: Response Code.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_get_silicon_id()

err_t usbcsink4_get_silicon_id ( usbcsink4_t ctx,
uint16_t *  silicon_id 
)

USB-C Sink 4 get Silicon ID function.

This function reads the Silicon ID of the device by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[out]silicon_id: Silicon ID of the device.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_get_type_c_status()

err_t usbcsink4_get_type_c_status ( usbcsink4_t ctx,
usbcsink4_type_c_status_t type_c_status 
)

USB-C Sink 4 get Type-C status function.

This function reads the reports of the status of the Type-C port by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[out]type_c_status: Status of the Type-C port object. See usbcsink4_type_c_status_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_init()

err_t usbcsink4_init ( usbcsink4_t ctx,
usbcsink4_cfg_t cfg 
)

USB-C Sink 4 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See usbcsink4_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_reset_device()

err_t usbcsink4_reset_device ( usbcsink4_t ctx)

USB-C Sink 4 reset the device function.

This function performs the software reset of the device by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcsink4_reset_i2c()

err_t usbcsink4_reset_i2c ( usbcsink4_t ctx)

USB-C Sink 4 reset the I2C block function.

This function performs the software reset of the I2C block by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See usbcsink4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.