usbcsink4  2.1.0.0
Data Structures | Macros | Enumerations | Functions
usbcsink4.h File Reference

This file contains API for USB-C Sink 4 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  usbcsink4_t
 USB-C Sink 4 Click context object. More...
 
struct  usbcsink4_cfg_t
 USB-C Sink 4 Click configuration object. More...
 
struct  usbcsink4_type_c_status_t
 USB-C Sink 4 Click status of the Type-C port. More...
 
struct  usbcsink4_event_status_t
 USB-C Sink 4 Click status of the event. More...
 

Macros

#define USBCSINK4_REG_DEVICE_MODE   0x0000u
 USB-C Sink 4 description register. More...
 
#define USBCSINK4_REG_SILICON_ID   0x0002u
 
#define USBCSINK4_REG_INTERRUPT   0x0006u
 
#define USBCSINK4_REG_TYPE_C_STATUS   0x100Cu
 
#define USBCSINK4_REG_BUS_VOLTAGE   0x100Du
 
#define USBCSINK4_REG_BUS_CURRENT   0x1058u
 
#define USBCSINK4_REG_EVENT_STATUS   0x1034u
 
#define USBCSINK4_REG_CHARGING_MODE_STATUS   0x1095u
 
#define USBCSINK4_REG_RESET   0x0008u
 
#define USBCSINK4_REG_EVENT_MASK   0x1024u
 
#define USBCSINK4_REG_FAULT_PIN_MASK   0x1080u
 
#define USBCSINK4_REG_OVP_CONFIG   0x1088u
 
#define USBCSINK4_REG_SNK_FET_DISABLE   0x1084u
 
#define USBCSINK4_REG_SNK_FET_CONTROL   0x1085u
 
#define USBCSINK4_REG_SAFE_PWR_CONTROL   0x1086u
 
#define USBCSINK4_REG_CHARGING_MODE_DISABLE   0x1094u
 
#define USBCSINK4_REG_DEV_RESPONSE   0x007Eu
 
#define USBCSINK4_REG_PD_RESPONSE   0x1400u
 
#define USBCSINK4_REG_READ_DATA_MEMORY_START   0x1404u
 
#define USBCSINK4_REG_READ_DATA_MEMORY_STOP   0x150Bu
 
#define USBCSINK4_REG_WRITE_DATA_MEMORY_START   0x1800u
 
#define USBCSINK4_REG_WRITE_DATA_MEMORY_STOP   0x19FFu
 
#define USBCSINK4_TYPE_C_ST_PORT_DISCONN   0x00
 USB-C Sink 4 description setting. More...
 
#define USBCSINK4_TYPE_C_ST_PORT_CONN   0x01
 
#define USBCSINK4_TYPE_C_ST_PORT_BITMAKS   0x01
 
#define USBCSINK4_TYPE_C_ST_CC_1   0x00
 
#define USBCSINK4_TYPE_C_ST_CC_2   0x01
 
#define USBCSINK4_TYPE_C_ST_CC_BITMAKS   0x01
 
#define USBCSINK4_TYPE_C_ST_ATT_NTH   0x00
 
#define USBCSINK4_TYPE_C_ST_ATT_SRC   0x02
 
#define USBCSINK4_TYPE_C_ST_ATT_DEBUG   0x03
 
#define USBCSINK4_TYPE_C_ST_ATT_BITMAKS   0x07
 
#define USBCSINK4_TYPE_C_ST_CURR_0_9A   0x00
 
#define USBCSINK4_TYPE_C_ST_CURR_1A   0x01
 
#define USBCSINK4_TYPE_C_ST_CURR_3A   0x02
 
#define USBCSINK4_TYPE_C_ST_CURR_BITMAKS   0x03
 
#define USBCSINK4_CHARGING_MODE_ENABLE   0x00
 USB-C Sink 4 legacy charging mode support and status setting. More...
 
#define USBCSINK4_CHARGING_MODE_DISABLE   0x01
 
#define USBCSINK4_CHG_MODE_STATUS_CLEAR   0xFF
 
#define USBCSINK4_CHG_MODE_STATUS_NO_LGC   0x00
 USB-C Sink 4 active Legacy charging mode. More...
 
#define USBCSINK4_CHG_MODE_STATUS_BC1_2DCP_CDC   0x01
 
#define USBCSINK4_CHG_MODE_STATUS_QC2_1   0x02
 
#define USBCSINK4_CHG_MODE_STATUS_AFC   0x04
 
#define USBCSINK4_CHG_MODE_STATUS_APPLE   0x05
 
#define USBCSINK4_INTERRUPT_RESPONSE_NO   0x00
 USB-C Sink 4 active Legacy charging mode. More...
 
#define USBCSINK4_INTERRUPT_RESPONSE_DEV   0x01
 
#define USBCSINK4_INTERRUPT_RESPONSE_PD   0x02
 
#define USBCSINK4_VOLTAGE_SENS   0.1f
 USB-C Sink 4 voltage and current sensitivity setting. More...
 
#define USBCSINK4_CURRENT_SENS   0.05f
 
#define USBCSINK4_OVP_CONFIG_SIG_DISABLE   'D'
 USB-C Sink 4 OVP configuration data values. More...
 
#define USBCSINK4_OVP_CONFIG_SIG_RE_ENABLE   'C'
 
#define USBCSINK4_OVP_CONFIG_THOLD_DEFAULT   0x28
 
#define USBCSINK4_OVP_CONFIG_DBNC_DEFAULT   0x0A
 
#define USBCSINK4_SIG_RESET   'R'
 USB-C Sink 4 reset the device or the I2C block. More...
 
#define USBCSINK4_RESET_I2C   0x00
 
#define USBCSINK4_RESET_DEVICE   0x01
 
#define USBCSINK4_DEV_RSP_CMD_REG_WRITE   0x00
 USB-C Sink 4 device response data values. More...
 
#define USBCSINK4_DEV_RSP_ASYNC_EVENT   0x80
 
#define USBCSINK4_DEV_RSP_CODE_NO_RSP   0x00
 
#define USBCSINK4_DEV_RSP_CODE_SUCCESS   0x02
 
#define USBCSINK4_DEV_RSP_CODE_INVALID   0x05
 
#define USBCSINK4_DEV_RSP_CODE_UNEXPECTED   0x09
 
#define USBCSINK4_DEV_RSP_CODE_NOT_SUPPORTED   0x0A
 
#define USBCSINK4_DEV_RSP_CODE_TXN_FAILED   0x0C
 
#define USBCSINK4_DEV_RSP_CODE_PD_CMD_FAILED   0x0D
 
#define USBCSINK4_DEV_RSP_CODE_PORT_BUSY   0x12
 
#define USBCSINK4_DEV_RSP_CODE_RST_CPLT   0x80
 
#define USBCSINK4_DEV_RSP_CODE_MSG_QUEUE_OVF   0x81
 
#define USBCSINK4_DEV_RSP_CODE_OVC   0x82
 
#define USBCSINK4_DEV_RSP_CODE_OVV   0x83
 
#define USBCSINK4_DEV_RSP_CODE_PORT_CONN   0x84
 
#define USBCSINK4_DEV_RSP_CODE_PORT_DISCONN   0x85
 
#define USBCSINK4_DEV_RSP_CODE_PD_NEG_CPLT   0x86
 
#define USBCSINK4_DEV_RSP_CODE_SWAP_CPLT   0x87
 
#define USBCSINK4_DEV_RSP_CODE_PS_RDY   0x8A
 
#define USBCSINK4_DEV_RSP_CODE_GOTOMIN   0x8B
 
#define USBCSINK4_DEV_RSP_CODE_ACCEPT   0x8C
 
#define USBCSINK4_DEV_RSP_CODE_REJECT   0x8D
 
#define USBCSINK4_DEV_RSP_CODE_WAIT   0x8E
 
#define USBCSINK4_DEV_RSP_CODE_HARD_RST   0x8F
 
#define USBCSINK4_DEV_RSP_CODE_VDM_REC   0x90
 
#define USBCSINK4_DEV_RSP_CODE_SRC_CAPB   0x91
 
#define USBCSINK4_DEV_RSP_CODE_SINK_CAPB   0x92
 
#define USBCSINK4_DEV_RSP_CODE_HARD_RST_SENT   0x9A
 
#define USBCSINK4_DEV_RSP_CODE_SOFT_RST_SENT   0x9B
 
#define USBCSINK4_DEV_RSP_CODE_SRC_DIS   0x9D
 
#define USBCSINK4_DEV_RSP_CODE_NO_VDM_RES_REC   0x9F
 
#define USBCSINK4_SILICON_ID_BCR_LITE   0x20A2u
 USB-C Sink 4 silicon ID value. More...
 
#define USBCSINK4_DEVICE_ADDRESS   0x08
 USB-C Sink 4 device address setting. More...
 
#define USBCSINK4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  usbcsink4_return_value_t { USBCSINK4_OK = 0, USBCSINK4_ERROR = -1 }
 USB-C Sink 4 Click return value data. More...
 

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

This file contains API for USB-C Sink 4 Click Driver.

Enumeration Type Documentation

◆ usbcsink4_return_value_t

USB-C Sink 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
USBCSINK4_OK 
USBCSINK4_ERROR