Functions | |
void | Cy_USBPD_Calc_Cabl_Gain (cy_stc_usbpd_context_t *context, uint32_t cur, uint8_t *gain_sel) |
Calculates cable gain. More... | |
void | Cy_USBPD_CSA_Calc_Ref (cy_stc_usbpd_context_t *context, uint32_t cur_10mA, uint8_t gain, uint32_t *vref_sel, bool vin_rsense) |
Calculates Vref Voltage. More... | |
void | Cy_USBPD_PFC_StopComp (cy_stc_usbpd_context_t *context) |
Disables PFC Comparator. More... | |
void | Cy_USBPD_SR_StopComp (cy_stc_usbpd_context_t *context) |
Disables SR Comparator. More... | |
bool | Cy_USBPD_PFC_SetComp (cy_stc_usbpd_context_t *context, uint32_t cur, cy_usbpd_vbus_filter_edge_detect_cfg_t edge, cy_pd_cmp_cbk_t cbk) |
Sets PFC Comparator. More... | |
bool | Cy_USBPD_SR_SetComp (cy_stc_usbpd_context_t *context, uint32_t cur, cy_usbpd_vbus_filter_edge_detect_cfg_t edge, cy_pd_cmp_cbk_t cbk) |
Sets SR Comparator. More... | |
uint16_t | Cy_USBPD_Hal_MeasureCur (cy_stc_usbpd_context_t *context) |
Sample the VBus current using ADC. More... | |
void | Cy_USBPD_Hal_Disable_CV (cy_stc_usbpd_context_t *context) |
Disables CV. More... | |
void | Cy_USBPD_Hal_Enable_CV (cy_stc_usbpd_context_t *context) |
Enables CV. More... | |
void | Cy_USBPD_Hal_Set_Fb_Dac (cy_stc_usbpd_context_t *context, int16_t dac_value) |
Configure Feedback DAC control of device. More... | |
int16_t | Cy_USBPD_Hal_Get_Fb_Dac (cy_stc_usbpd_context_t *context) |
Read Feedback DAC control of device. More... | |
uint8_t | Cy_USBPD_Get_Silicon_Rev (cy_stc_usbpd_context_t *context) |
Function to get silicon revision. More... | |
bool | Cy_USBPD_CF_GetStatus (cy_stc_usbpd_context_t *context) |
Retrieves the status of the CF mode hardware. More... | |
bool | Cy_USBPD_PFC_CompSample (cy_stc_usbpd_context_t *context, uint32_t cur) |
Samples the PFC comparator. More... | |
void | Cy_USBPD_LSCSA_Calc_Cfg (cy_stc_usbpd_context_t *context, uint32_t cur_10mA, uint8_t *gain_sel, uint32_t *vref_sel) |
Calculate the gain and reference settings for a specific current requirement. More... | |
cy_en_usbpd_status_t | Cy_USBPD_LSCSA_Config (cy_stc_usbpd_context_t *context, cy_en_usbpd_vbus_lscsa_app_config_t lscsa_app, uint32_t gain_sel_value) |
Sets up LSCSA for specified application. More... | |
void | Cy_USBPD_CF_Mon_Enable (cy_stc_usbpd_context_t *context, bool reset_state, cy_vbus_cf_cbk_t cbk) |
Enables hardware monitoring for VBus Current foldback on the specified port. More... | |
void | Cy_USBPD_CF_Mon_Disable (cy_stc_usbpd_context_t *context) |
Disables hardware monitoring for VBus Current foldback on the specified port. More... | |
void | Cy_USBPD_CF_Enable (cy_stc_usbpd_context_t *context, uint32_t cur) |
Enables VBus Current foldback on the specified port. More... | |
void | Cy_USBPD_CF_Disable (cy_stc_usbpd_context_t *context) |
Disables hardware monitoring for VBus Current foldback on the specified port. More... | |
void | Cy_USBPD_PFC_Intr1Handler (cy_stc_usbpd_context_t *context) |
PFC Interrupt handler. More... | |
void | Cy_USBPD_SR_Intr1Handler (cy_stc_usbpd_context_t *context) |
SR Interrupt handler. More... | |
void | Cy_USBPD_VBTR_Start (cy_stc_usbpd_context_t *context) |
This function triggers VBUS voltage transition. More... | |
void | Cy_USBPD_VBTR_Config (cy_stc_usbpd_context_t *context, int16_t dac_cur, int16_t dac_req, cy_cb_adc_events_t vbtr_cb) |
This function does blocking Vbus transition to VSAFE_5V from lower iDAC setting to zero. More... | |
bool | Cy_USBPD_VBTR_IsIdle (cy_stc_usbpd_context_t *context) |
Gets the current status of the VBTR module. More... | |
void | Cy_USBPD_VBTR_SetIdac (cy_stc_usbpd_context_t *context, int16_t dac_req, cy_cb_adc_events_t vbtr_cb) |
Configures VBUS transition operation for the requested idac value. More... | |
void | Cy_USBPD_VBTR_Abort (cy_stc_usbpd_context_t *context) |
Aborts the ongoing VBUS transition operation. More... | |
bool | Cy_USBPD_IBTR_IsIdle (cy_stc_usbpd_context_t *context) |
Gets the current status of the IBTR module. More... | |
void | Cy_USBPD_IBTR_Set (cy_stc_usbpd_context_t *context, uint16_t refgen_req, cy_cb_adc_events_t ibtr_cb) |
Configures VBUS current transition operation for the requested idac value. More... | |
void | Cy_USBPD_IBTR_Abort (cy_stc_usbpd_context_t *context) |
Aborts the ongoing VBUS current transition operation. More... | |
void Cy_USBPD_Calc_Cabl_Gain | ( | cy_stc_usbpd_context_t * | context, |
uint32_t | cur, | ||
uint8_t * | gain_sel | ||
) |
Calculates cable gain.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
cur | Current |
gain_sel | Cable gain |
void Cy_USBPD_CSA_Calc_Ref | ( | cy_stc_usbpd_context_t * | context, |
uint32_t | cur_10mA, | ||
uint8_t | gain, | ||
uint32_t * | vref_sel, | ||
bool | vin_rsense | ||
) |
Calculates Vref Voltage.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
cur_10mA | Current |
gain | Gain |
vref_sel | VREF Voltage |
vin_rsense | VIN Rsense |
void Cy_USBPD_PFC_StopComp | ( | cy_stc_usbpd_context_t * | context | ) |
Disables PFC Comparator.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_SR_StopComp | ( | cy_stc_usbpd_context_t * | context | ) |
Disables SR Comparator.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
bool Cy_USBPD_PFC_SetComp | ( | cy_stc_usbpd_context_t * | context, |
uint32_t | cur, | ||
cy_usbpd_vbus_filter_edge_detect_cfg_t | edge, | ||
cy_pd_cmp_cbk_t | cbk | ||
) |
Sets PFC Comparator.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
cur | Current |
edge | Edge detection interrupt |
cbk | Callback |
bool Cy_USBPD_SR_SetComp | ( | cy_stc_usbpd_context_t * | context, |
uint32_t | cur, | ||
cy_usbpd_vbus_filter_edge_detect_cfg_t | edge, | ||
cy_pd_cmp_cbk_t | cbk | ||
) |
Sets SR Comparator.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
cur | Current |
edge | Edge detection interrupt |
cbk | Callback |
uint16_t Cy_USBPD_Hal_MeasureCur | ( | cy_stc_usbpd_context_t * | context | ) |
Sample the VBus current using ADC.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_Hal_Disable_CV | ( | cy_stc_usbpd_context_t * | context | ) |
Disables CV.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_Hal_Enable_CV | ( | cy_stc_usbpd_context_t * | context | ) |
Enables CV.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_Hal_Set_Fb_Dac | ( | cy_stc_usbpd_context_t * | context, |
int16_t | dac_value | ||
) |
Configure Feedback DAC control of device.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
dac_value | Signed DAC value. Positive is sink and negative is source. |
int16_t Cy_USBPD_Hal_Get_Fb_Dac | ( | cy_stc_usbpd_context_t * | context | ) |
Read Feedback DAC control of device.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
uint8_t Cy_USBPD_Get_Silicon_Rev | ( | cy_stc_usbpd_context_t * | context | ) |
Function to get silicon revision.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
bool Cy_USBPD_CF_GetStatus | ( | cy_stc_usbpd_context_t * | context | ) |
Retrieves the status of the CF mode hardware.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
bool Cy_USBPD_PFC_CompSample | ( | cy_stc_usbpd_context_t * | context, |
uint32_t | cur | ||
) |
Samples the PFC comparator.
The function samples against the requested current and restores the previous settings after sampling. This function is useful when the comparator is already configured for interrupt and needs to be multiplexed to sample at a different current.
context | USB-PD port context. |
cur | Operating current in 10mA units. |
Applicable devices: CCG3PA, CCG3PA2, PAG1S.
void Cy_USBPD_LSCSA_Calc_Cfg | ( | cy_stc_usbpd_context_t * | context, |
uint32_t | cur_10mA, | ||
uint8_t * | gain_sel, | ||
uint32_t * | vref_sel | ||
) |
Calculate the gain and reference settings for a specific current requirement.
This function eliminates the pre-calculated table.
context | USB-PD port context. |
cur_10mA | Current setting in 10mA unit for which CSA setting is required. |
gain_sel | Pointer to variable where the gain setting code corresponding to the current setting needs to be stored. |
vref_sel | Pointer to variable where the voltage reference code corresponding to the current setting needs to be stored. |
Applicable devices: CCG3PA, CCG3PA2, PAG1S.
cy_en_usbpd_status_t Cy_USBPD_LSCSA_Config | ( | cy_stc_usbpd_context_t * | context, |
cy_en_usbpd_vbus_lscsa_app_config_t | lscsa_app, | ||
uint32_t | gain_sel_value | ||
) |
Sets up LSCSA for specified application.
context | USB-PD port context. |
lscsa_app | LSCSA application |
gain_sel_value | Gain selection code to be used |
Applicable devices: CCG3PA, CCG3PA2, PAG1S.
void Cy_USBPD_CF_Mon_Enable | ( | cy_stc_usbpd_context_t * | context, |
bool | reset_state, | ||
cy_vbus_cf_cbk_t | cbk | ||
) |
Enables hardware monitoring for VBus Current foldback on the specified port.
The function invokes the callback when a change happens from the current state. When the monitor is enabled, the calling function can specify the default state to allow for both high to low and low to high detection at enable. This avoids any race condition while enabling the monitoring. Monitoring should be enabled only when no VBUS transition is enabled.
context | USB-PD port context. |
reset_state | Current CF state as expected by the calling function. |
cbk | Function to be called when CF event is detected. |
Applicable devices: PAG1S.
void Cy_USBPD_CF_Mon_Disable | ( | cy_stc_usbpd_context_t * | context | ) |
Disables hardware monitoring for VBus Current foldback on the specified port.
Monitoring should be disabled when there is VBUS transition as well as when not in PPS mode operation.
context | USB-PD port context. |
Applicable devices: PAG1S.
void Cy_USBPD_CF_Enable | ( | cy_stc_usbpd_context_t * | context, |
uint32_t | cur | ||
) |
Enables VBus Current foldback on the specified port.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
cur | Operating current in 10mA units. |
void Cy_USBPD_CF_Disable | ( | cy_stc_usbpd_context_t * | context | ) |
Disables hardware monitoring for VBus Current foldback on the specified port.
Monitoring should be disabled when there is VBUS transition as well as when not in PPS mode operation.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_PFC_Intr1Handler | ( | cy_stc_usbpd_context_t * | context | ) |
PFC Interrupt handler.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_SR_Intr1Handler | ( | cy_stc_usbpd_context_t * | context | ) |
SR Interrupt handler.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_VBTR_Start | ( | cy_stc_usbpd_context_t * | context | ) |
This function triggers VBUS voltage transition.
It expects that configuration has been done already.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_VBTR_Config | ( | cy_stc_usbpd_context_t * | context, |
int16_t | dac_cur, | ||
int16_t | dac_req, | ||
cy_cb_adc_events_t | vbtr_cb | ||
) |
This function does blocking Vbus transition to VSAFE_5V from lower iDAC setting to zero.
It assumes that the caller has already setup the iDAC to negative value. Calling the function with a positive iDAC setting shall result in EA being loaded directly to zero and CV mode disabled. If the VBUS is higher than 5V, the VBUS_IN safe voltage correction is expected to drop the voltage.
The function is expected to be called only during HAL start / stop functions and should not be invoked while in attached state.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
dac_cur | Initial signed iDAC value for VBUS voltage transition. Negative for source and positive for sink. |
dac_req | Final signed iDAC value for VBUS voltage transition. Negative for source and positive for sink. |
vbtr_cb | Callback to notify vbtr events |
bool Cy_USBPD_VBTR_IsIdle | ( | cy_stc_usbpd_context_t * | context | ) |
Gets the current status of the VBTR module.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_VBTR_SetIdac | ( | cy_stc_usbpd_context_t * | context, |
int16_t | dac_req, | ||
cy_cb_adc_events_t | vbtr_cb | ||
) |
Configures VBUS transition operation for the requested idac value.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
dac_req | Final signed iDAC value for VBUS voltage transition. Negative for source and positive for sink. |
vbtr_cb | Callback to notify vbtr events |
void Cy_USBPD_VBTR_Abort | ( | cy_stc_usbpd_context_t * | context | ) |
Aborts the ongoing VBUS transition operation.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
bool Cy_USBPD_IBTR_IsIdle | ( | cy_stc_usbpd_context_t * | context | ) |
Gets the current status of the IBTR module.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
void Cy_USBPD_IBTR_Set | ( | cy_stc_usbpd_context_t * | context, |
uint16_t | refgen_req, | ||
cy_cb_adc_events_t | ibtr_cb | ||
) |
Configures VBUS current transition operation for the requested idac value.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |
refgen_req | Signed iDAC value. Negative for source and positive for sink. |
ibtr_cb | Callback to notify IBTR events. |
void Cy_USBPD_IBTR_Abort | ( | cy_stc_usbpd_context_t * | context | ) |
Aborts the ongoing VBUS current transition operation.
context | The pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure. |