usbcpower 2.1.0.0
USB-C Power Click Driver

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

Topics

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

Functions

void usbcpower_cfg_setup (usbcpower_cfg_t *cfg)
 USB-C Power configuration object setup function.
 
err_t usbcpower_init (usbcpower_t *ctx, usbcpower_cfg_t *cfg)
 USB-C Power initialization function.
 
err_t usbcpower_default_cfg (usbcpower_t *ctx)
 USB-C Power default configuration function.
 
err_t usbcpower_generic_write (usbcpower_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 USB-C Power I2C writing function.
 
err_t usbcpower_generic_read (usbcpower_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 USB-C Power I2C reading function.
 
err_t usbcpower_get_device_mode (usbcpower_t *ctx, uint8_t *device_mode)
 USB-C Power get device mode function.
 
err_t usbcpower_get_device_capabilities (usbcpower_t *ctx, uint8_t *device_cap)
 USB-C Power get device capabilities function.
 
err_t usbcpower_device_info (usbcpower_t *ctx, uint8_t *device_info)
 USB-C Power device info function.
 
err_t usbcpower_set_patch_mode (usbcpower_t *ctx, uint32_t *response)
 USB-C Power set patch mode function.
 
err_t usbcpower_start_patch_burst_mode (usbcpower_t *ctx, usbcpower_pbms_cfg_t pbms_cfg, uint32_t *response)
 USB-C Power starts the patch burst mode function.
 
err_t usbcpower_complete_patch_burst_mode (usbcpower_t *ctx, uint32_t *response)
 USB-C Power complete the patch burst mode function.
 
err_t usbcpower_exit_patch_burst_mode (usbcpower_t *ctx, uint32_t *response)
 USB-C Power exit the patch burst mode function.
 
err_t usbcpower_get_selected_mode (usbcpower_t *ctx, uint8_t *sel_mode)
 USB-C Power gets selected mode function.
 
err_t usbcpower_update_patch_bundle (usbcpower_t *ctx, usbcpower_pbms_cfg_t pbms_cfg)
 USB-C Power update patch bundle function.
 
err_t usbcpower_get_status (usbcpower_t *ctx, usbcpower_status_t *status)
 USB-C Power gets status function.
 
err_t usbcpower_get_pwr_path_status (usbcpower_t *ctx, usbcpower_pwr_path_status_t *pp_status)
 USB-C Power gets power path status function.
 
err_t usbcpower_get_boot_status (usbcpower_t *ctx, usbcpower_boot_status_t *boot_status)
 USB-C Power gets boot status function.
 
err_t usbcpower_get_rx_caps (usbcpower_t *ctx, usbcpower_rx_caps_t *rx_caps)
 USB-C Power gets RX caps function.
 
err_t usbcpower_get_pwr_status (usbcpower_t *ctx, usbcpower_pwr_status_t *pwr_status)
 USB-C Power gets PWR status function.
 
err_t usbcpower_get_pd_status (usbcpower_t *ctx, usbcpower_pd_status_t *pd_status)
 USB-C Power gets PD status function.
 
uint8_t usbcpower_get_int_pin (usbcpower_t *ctx)
 USB-C Power gets interrupt function.
 

Detailed Description

API for configuring and manipulating USB-C Power 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

◆ usbcpower_cfg_setup()

void usbcpower_cfg_setup ( usbcpower_cfg_t * cfg)

USB-C Power configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ usbcpower_complete_patch_burst_mode()

err_t usbcpower_complete_patch_burst_mode ( usbcpower_t * ctx,
uint32_t * response )

USB-C Power complete the patch burst mode function.

This function ends the patch loading sequence of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]response: Response code.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The 'PBMc' Task ends the patch loading sequence. Send this Task after all patch data has been transferred. This Task will initiate the CRC check on the binary patch data that has been transferred, and if the CRC is successful, the function contained within the patch will be executed.

◆ usbcpower_default_cfg()

err_t usbcpower_default_cfg ( usbcpower_t * ctx)

USB-C Power default configuration function.

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

Parameters
[in]ctx: Click context object. See usbcpower_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.

◆ usbcpower_device_info()

err_t usbcpower_device_info ( usbcpower_t * ctx,
uint8_t * device_info )

USB-C Power device info function.

This function reads a ASCII string with hardware and firmware version information of the PD Controller of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

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

◆ usbcpower_exit_patch_burst_mode()

err_t usbcpower_exit_patch_burst_mode ( usbcpower_t * ctx,
uint32_t * response )

USB-C Power exit the patch burst mode function.

This function ends the patch loading sequence of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]response: Response code.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The 'PBMe' Task ends the patch loading sequence. This Task instructs the PD controller to complete the patch loading process.

◆ usbcpower_generic_read()

err_t usbcpower_generic_read ( usbcpower_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

USB-C Power I2C reading function.

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

Parameters
[in]ctx: Click context object. See usbcpower_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.

◆ usbcpower_generic_write()

err_t usbcpower_generic_write ( usbcpower_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

USB-C Power I2C writing function.

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

Parameters
[in]ctx: Click context object. See usbcpower_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.

◆ usbcpower_get_boot_status()

err_t usbcpower_get_boot_status ( usbcpower_t * ctx,
usbcpower_boot_status_t * boot_status )

USB-C Power gets boot status function.

This function reads a boot status of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]boot_status: Boot status object. See usbcpower_boot_status_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower_get_device_capabilities()

err_t usbcpower_get_device_capabilities ( usbcpower_t * ctx,
uint8_t * device_cap )

USB-C Power get device capabilities function.

This function reads a device capabilities value of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

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

◆ usbcpower_get_device_mode()

err_t usbcpower_get_device_mode ( usbcpower_t * ctx,
uint8_t * device_mode )

USB-C Power get device mode function.

This function reads a device information value of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]device_mode: Device mode string.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower_get_int_pin()

uint8_t usbcpower_get_int_pin ( usbcpower_t * ctx)

USB-C Power gets interrupt function.

This function get states of the Interrupt ( INT ) pin of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

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

◆ usbcpower_get_pd_status()

err_t usbcpower_get_pd_status ( usbcpower_t * ctx,
usbcpower_pd_status_t * pd_status )

USB-C Power gets PD status function.

This function reads a power status of PD and Type-C state-machine of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]pd_status: Source and sink capabilities object. See usbcpower_pd_status_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower_get_pwr_path_status()

err_t usbcpower_get_pwr_path_status ( usbcpower_t * ctx,
usbcpower_pwr_path_status_t * pp_status )

USB-C Power gets power path status function.

This function reads a power path status of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]pp_status: Power path status object. See usbcpower_pwr_path_status_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower_get_pwr_status()

err_t usbcpower_get_pwr_status ( usbcpower_t * ctx,
usbcpower_pwr_status_t * pwr_status )

USB-C Power gets PWR status function.

This function reads a power of the connection status info of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]pwr_status: Power of the connection status object. See usbcpower_pwr_status_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower_get_rx_caps()

err_t usbcpower_get_rx_caps ( usbcpower_t * ctx,
usbcpower_rx_caps_t * rx_caps )

USB-C Power gets RX caps function.

This function reads a source and sink capabilities of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]rx_caps: Source and sink capabilities object. See usbcpower_rx_caps_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower_get_selected_mode()

err_t usbcpower_get_selected_mode ( usbcpower_t * ctx,
uint8_t * sel_mode )

USB-C Power gets selected mode function.

This function reads application operation mode of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]sel_mode:
  • 0x00 (USBCPOWER_MODE_PTCH) - Device in patch mode,
  • 0x01 (USBCPOWER_MODE_APP) - The PD Controller is fully functioning in the application firmware,
  • 0x02 (USBCPOWER_MODE_BOOT) - Device booting in dead battery,
  • 0x03 (USBCPOWER_MODE_UNKNOWN) - The PD Controller is functioning in a limited capacity.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower_get_status()

err_t usbcpower_get_status ( usbcpower_t * ctx,
usbcpower_status_t * status )

USB-C Power gets status function.

This function reads a status information of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[out]status: Status information object. See usbcpower_status_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower_init()

err_t usbcpower_init ( usbcpower_t * ctx,
usbcpower_cfg_t * cfg )

USB-C Power initialization function.

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

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

◆ usbcpower_set_patch_mode()

err_t usbcpower_set_patch_mode ( usbcpower_t * ctx,
uint32_t * response )

USB-C Power set patch mode function.

This function set the patch mode, forces PD controller to return to 'PTCH' mode and wait for patch over I2C of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

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

◆ usbcpower_start_patch_burst_mode()

err_t usbcpower_start_patch_burst_mode ( usbcpower_t * ctx,
usbcpower_pbms_cfg_t pbms_cfg,
uint32_t * response )

USB-C Power starts the patch burst mode function.

This function write sequence for loading a patch bundle in burst mode to the PD controller from an external host over I2C of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[in]pbms_cfg: The 'PBMs' task configuration object. See usbcpower_pbms_cfg_t definition for detailed explanation.
[out]response: Response code.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The 'PBMs' Task starts the patch loading sequence. This Task initializes the firmware in preparation for a patch bundle load sequence and indicates what the patch bundle will contain.

◆ usbcpower_update_patch_bundle()

err_t usbcpower_update_patch_bundle ( usbcpower_t * ctx,
usbcpower_pbms_cfg_t pbms_cfg )

USB-C Power update patch bundle function.

This function writes the entire patch-bundle data in a single I2C transaction of the TPS25750 USB Type-C® and USB PD Controller with Integrated Power Switches Optimized for Power Applications on the USB-C Power Click board™.

Parameters
[in]ctx: Click context object. See usbcpower_t object definition for detailed explanation.
[in]pbms_cfg: The 'PBMs' task configuration object. See usbcpower_pbms_cfg_t definition for detailed explanation.
[out]response: Response code.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The PD controller increments the pointer into its patch memory space with each byte received on the Patch Slave address that was configured as part of the 'PBMs' 4CC Task.