usbcpower 2.1.0.0
usbcpower.h File Reference

This file contains API for USB-C Power Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  usbcpower_t
 USB-C Power Click context object. More...
 
struct  usbcpower_cfg_t
 USB-C Power Click configuration object. More...
 
struct  usbcpower_pbms_cfg_t
 USB-C Power Click PBMs configuration object. More...
 
struct  usbcpower_status_t
 USB-C Power Click status information object. More...
 
struct  usbcpower_pwr_path_status_t
 USB-C Power Click power path status object. More...
 
struct  usbcpower_boot_status_t
 USB-C Power Click boot path status object. More...
 
struct  usbcpower_rx_caps_t
 USB-C Power Click rx source/sink caps object. More...
 
struct  usbcpower_pwr_status_t
 USB-C Power Click power status object. More...
 
struct  usbcpower_pd_status_t
 USB-C Power Click PD status object. More...
 

Macros

#define USBCPOWER_REG_MODE   0x03
 USB-C Power description register.
 
#define USBCPOWER_MODE_REG_SIZE   5
 
#define USBCPOWER_REG_TYPE   0x04
 
#define USBCPOWER_TYPE_REG_SIZE   5
 
#define USBCPOWER_REG_CUSTUSE   0x06
 
#define USBCPOWER_CUSTUSE_REG_SIZE   9
 
#define USBCPOWER_REG_CMD1   0x08
 
#define USBCPOWER_CMD1_REG_SIZE   5
 
#define USBCPOWER_REG_DATA   0x09
 
#define USBCPOWER_DATA_REG_SIZE   65
 
#define USBCPOWER_REG_DEVICE_CAP   0x0D
 
#define USBCPOWER_DEVICE_CAP_REG_SIZE   5
 
#define USBCPOWER_REG_VERSION   0x0F
 
#define USBCPOWER_VERSION_REG_SIZE   5
 
#define USBCPOWER_REG_INT_EVENT1   0x14
 
#define USBCPOWER_INT_EVENT1_REG_SIZE   15
 
#define USBCPOWER_REG_INT_MASK1   0x16
 
#define USBCPOWER_INT_MASK1_REG_SIZE   12
 
#define USBCPOWER_REG_INT_CLEAR1   0x18
 
#define USBCPOWER_INT_CLEAR1_REG_SIZE   12
 
#define USBCPOWER_REG_STATUS   0x1A
 
#define USBCPOWER_STATUS_REG_SIZE   6
 
#define USBCPOWER_REG_POWER_PATH_STATUS   0x26
 
#define USBCPOWER_POWER_PATH_STATUS_REG_SIZE   6
 
#define USBCPOWER_REG_PORT_CONTROL   0x29
 
#define USBCPOWER_PORT_CONTROL_REG_SIZE   5
 
#define USBCPOWER_REG_BOOT_STATUS   0x2D
 
#define USBCPOWER_BOOT_STATUS_REG_SIZE   6
 
#define USBCPOWER_REG_BUILD_DESC   0x2E
 
#define USBCPOWER_BUILD_DESC_SIZE   50
 
#define USBCPOWER_REG_DEVICE_INFO   0x2F
 
#define USBCPOWER_DEVICE_INFO_REG_SIZE   41
 
#define USBCPOWER_REG_RX_SOURCE_CAPS   0x30
 
#define USBCPOWER_RX_SOURCE_CAPS_REG_SIZE   30
 
#define USBCPOWER_REG_RX_SINK_CAPS   0x31
 
#define USBCPOWER_RX_SINK_CAPS_REG_SIZE   30
 
#define USBCPOWER_REG_TX_SOURCE_CAPS   0x32
 
#define USBCPOWER_TX_SOURCE_CAPS_REG_SIZE   32
 
#define USBCPOWER_REG_TX_SINK_CAPS   0x33
 
#define USBCPOWER_TX_SINK_CAPS_REG_SIZE   30
 
#define USBCPOWER_REG_ACTIVE_CONTRACT_PDO   0x34
 
#define USBCPOWER_ACTIVE_CONTRACT_PDO_REG_SIZE   7
 
#define USBCPOWER_REG_ACTIVE_CONTRACT_RDO   0x35
 
#define USBCPOWER_ACTIVE_CONTRACT_RDO_REG_SIZE   5
 
#define USBCPOWER_REG_POWER_STATUS   0x3F
 
#define USBCPOWER_POWER_STATUS_REG_SIZE   3
 
#define USBCPOWER_REG_PD_STATUS   0x40
 
#define USBCPOWER_PD_STATUS_REG_SIZE   5
 
#define USBCPOWER_REG_TYPEC_STATE   0x69
 
#define USBCPOWER_TYPEC_STATE_REG_SIZE   5
 
#define USBCPOWER_REG_GPIO_STATUS   0x72
 
#define USBCPOWER_GPIO_STATUS_REG_SIZE   9
 
#define USBCPOWER_CAP_POWER_ROLE_M   0x03
 USB-C Power description setting.
 
#define USBCPOWER_CAP_USBPD_CAP_M   0x04
 
#define USBCPOWER_CAP_I2CMLEVEL_VOLT_M   0x80
 
#define USBCPOWER_STATUS_PLUG_PRESENT_M   0x01
 USB-C Power description status value.
 
#define USBCPOWER_STATUS_CONN_STATE_M   0x0E
 
#define USBCPOWER_STATUS_PLUG_OR_M   0x10
 
#define USBCPOWER_STATUS_PORT_ROLE_M   0x20
 
#define USBCPOWER_STATUS_DATA_ROLE_M   0x40
 
#define USBCPOWER_STATUS_VBUS_STATUS_M   0x30
 
#define USBCPOWER_STATUS_USB_HOST_PRSNT_M   0xC0
 
#define USBCPOWER_STATUS_ACT_LEGACY_M   0x03
 
#define USBCPOWER_STATUS_BIST_M   0x08
 
#define USBCPOWER_RSP_OK   0x00
 USB-C Power description standard task response value.
 
#define USBCPOWER_RSP_PBMs   "PBMs"
 
#define USBCPOWER_RSP_PTCH   "PTCH"
 
#define USBCPOWER_RSP_APP   "APP "
 
#define USBCPOWER_RSP_BOOT   "BOOT"
 
#define USBCPOWER_RSP_DEVICE_INFO_NAME   "TPS65992"
 
#define USBCPOWER_CMD_SWSk   "4SWSk"
 USB-C Power description 4CC tasks command value.
 
#define USBCPOWER_CMD_SWSr   "4SWSr"
 
#define USBCPOWER_CMD_SWDF   "4SWDF"
 
#define USBCPOWER_CMD_SWUF   "4SWUF"
 
#define USBCPOWER_CMD_GSkC   "4GSkC"
 
#define USBCPOWER_CMD_GSrC   "4GSrC"
 
#define USBCPOWER_CMD_SSrC   "4SSrC"
 
#define USBCPOWER_CMD_PTCH   "4PTCH"
 
#define USBCPOWER_CMD_GO2P   "4GO2P"
 
#define USBCPOWER_CMD_PBMs   "4PBMs"
 
#define USBCPOWER_CMD_PBMc   "4PBMc"
 
#define USBCPOWER_CMD_PBMe   "4PBMe"
 
#define USBCPOWER_MODE_PTCH   0x00
 USB-C Power description of device modes value.
 
#define USBCPOWER_MODE_APP   0x01
 
#define USBCPOWER_MODE_BOOT   0x02
 
#define USBCPOWER_MODE_UNKNOWN   0x03
 
#define USBCPOWER_PD_CON_MODE_SOURCE   0x00
 
#define USBCPOWER_PD_CON_MODE_SINK   0x01
 
#define USBCPOWER_PD_MODE_SELECTOR   USBCPOWER_PD_CON_MODE_SOURCE
 
#define USBCPOWER_STATUS_NO_CONNECTION   0x00
 USB-C Power description of power status value.
 
#define USBCPOWER_STATUS_PORT_DISABLED   0x01
 
#define USBCPOWER_STATUS_AUDIO_CONNECTION   0x02
 
#define USBCPOWER_STATUS_DEBUG_CONNECTION   0x03
 
#define USBCPOWER_STATUS_NO_CONNECTION_Ra   0x04
 
#define USBCPOWER_STATUS_RESERVED   0x05
 
#define USBCPOWER_STATUS_CONNECT_NO_Ra   0x06
 
#define USBCPOWER_PWR_STATUS_USB   0x00
 
#define USBCPOWER_PWR_STATUS_TYPE_C_1_5A   0x01
 
#define USBCPOWER_PWR_STATUS_TYPE_C_3_0A   0x02
 
#define USBCPOWER_PWR_STATUS_CHG_ADV_DISABLE   0x00
 
#define USBCPOWER_PWR_STATUS_CHG_ADV_PROCESS   0x01
 
#define USBCPOWER_PWR_STATUS_CHG_ADV_COMPLETE   0x02
 
#define USBCPOWER_DEVICE_ADDRESS   0x21
 USB-C Power device address setting.
 
#define USBCPOWER_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  usbcpower_return_value_t { USBCPOWER_OK = 0 , USBCPOWER_ERROR = -1 }
 USB-C Power Click return value data. More...
 

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

This file contains API for USB-C Power Click Driver.

Enumeration Type Documentation

◆ usbcpower_return_value_t

USB-C Power Click return value data.

Predefined enum values for driver return values.

Enumerator
USBCPOWER_OK 
USBCPOWER_ERROR