PDStack Middleware Library 1.20
cy_stc_pdstack_app_cbk_t Struct Reference

Description

Struct to hold the application interface.

The application is expected to fill the structure with pointers to functions that use the on-board circuitry to accomplish tasks like source/sink power turn on/off. All the functions in this structure must be non-blocking and take minimum execution time.

Warning
The application must check the callback pointer passed by the stack is not NULL.

Data Fields

void(* app_event_handler )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_en_pdstack_app_evt_t evt, const void *dat)
 App event handler callback. More...
 
void(* psrc_set_voltage )(struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t volt_mV)
 Set power source voltage in mV units. More...
 
void(* psrc_set_current )(struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t cur_10mA)
 Set power source current in 10mA units. More...
 
void(* psrc_enable )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_pwr_ready_cbk_t pwr_ready_handler)
 Enable the power supply. More...
 
void(* psrc_disable )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_pwr_ready_cbk_t pwr_ready_handler)
 Disable the power supply. More...
 
bool(* vconn_enable )(struct cy_stc_pdstack_context *ptrPdStackContext, uint8_t channel)
 Turn VCONN supply ON. More...
 
void(* vconn_disable )(struct cy_stc_pdstack_context *ptrPdStackContext, uint8_t channel)
 Turn VCONN supply OFF. More...
 
bool(* vconn_is_present )(struct cy_stc_pdstack_context *ptrPdStackContext)
 Check whether VConn supply is ON. More...
 
bool(* vbus_is_present )(struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t volt, int8_t per)
 Check whether VBus voltage is within expected range. More...
 
void(* vbus_discharge_on )(struct cy_stc_pdstack_context *ptrPdStackContext)
 Turn on VBUS discharge circuit. More...
 
void(* vbus_discharge_off )(struct cy_stc_pdstack_context *ptrPdStackContext)
 Turn off VBUS discharge circuit. More...
 
void(* psnk_set_voltage )(struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t volt_mV)
 Set power sink voltage, in mV units. More...
 
void(* psnk_set_current )(struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t cur_10mA)
 Set power sink current, in 10mA units. More...
 
void(* psnk_enable )(struct cy_stc_pdstack_context *ptrPdStackContext)
 Enable power sink related circuitry. More...
 
void(* psnk_disable )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_sink_discharge_off_cbk_t snk_discharge_off_handler)
 Disable power sink related circuitry. More...
 
void(* eval_src_cap )(struct cy_stc_pdstack_context *ptrPdStackContext, const cy_stc_pdstack_pd_packet_t *srcCap, cy_pdstack_app_resp_cbk_t app_resp_handler)
 Evaluate received source caps and provide the RDO to be used to negotiate contract. More...
 
void(* eval_rdo )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_pd_pd_do_t rdo, cy_pdstack_app_resp_cbk_t app_resp_handler)
 Evaluate sink request message. More...
 
void(* eval_dr_swap )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_app_resp_cbk_t app_resp_handler)
 Handles DR swap request received by port. More...
 
void(* eval_pr_swap )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_app_resp_cbk_t app_resp_handler)
 Handles pr swap request received by port. More...
 
void(* eval_vconn_swap )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_app_resp_cbk_t app_resp_handler)
 Handles VCONN swap request received by port. More...
 
void(* eval_vdm )(struct cy_stc_pdstack_context *ptrPdStackContext, const cy_stc_pdstack_pd_packet_t *vdm, cy_pdstack_vdm_resp_cbk_t vdm_resp_handler)
 Handle VDMs (all structured/unstructured VDMs need to be handled) received by the port. More...
 
void(* eval_fr_swap )(struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_app_resp_cbk_t app_resp_handler)
 Handle FR swap request received by the specified port. More...
 
uint16_t(* vbus_get_value )(struct cy_stc_pdstack_context *ptrPdStackContext)
 Get current VBUS value in mV from application. More...
 
uint32_t(* psrc_get_voltage )(struct cy_stc_pdstack_context *ptrPdStackContext)
 Get expected VBUS value in mV from application. More...
 

Field Documentation

◆ app_event_handler

void(* cy_stc_pdstack_app_cbk_t::app_event_handler) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_en_pdstack_app_evt_t evt, const void *dat)

App event handler callback.

◆ psrc_set_voltage

void(* cy_stc_pdstack_app_cbk_t::psrc_set_voltage) (struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t volt_mV)

Set power source voltage in mV units.

◆ psrc_set_current

void(* cy_stc_pdstack_app_cbk_t::psrc_set_current) (struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t cur_10mA)

Set power source current in 10mA units.

◆ psrc_enable

void(* cy_stc_pdstack_app_cbk_t::psrc_enable) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_pwr_ready_cbk_t pwr_ready_handler)

Enable the power supply.

The pwr_ready_handler, if not NULL, must be called when the power supply is ready.

◆ psrc_disable

void(* cy_stc_pdstack_app_cbk_t::psrc_disable) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_pwr_ready_cbk_t pwr_ready_handler)

Disable the power supply.

The pwr_ready_handler, if not NULL, must be called when the power supply has been discharged to Vsafe0V.

◆ vconn_enable

bool(* cy_stc_pdstack_app_cbk_t::vconn_enable) (struct cy_stc_pdstack_context *ptrPdStackContext, uint8_t channel)

Turn VCONN supply ON.

Return true if VCONN was turned ON.

◆ vconn_disable

void(* cy_stc_pdstack_app_cbk_t::vconn_disable) (struct cy_stc_pdstack_context *ptrPdStackContext, uint8_t channel)

Turn VCONN supply OFF.

◆ vconn_is_present

bool(* cy_stc_pdstack_app_cbk_t::vconn_is_present) (struct cy_stc_pdstack_context *ptrPdStackContext)

Check whether VConn supply is ON.

◆ vbus_is_present

bool(* cy_stc_pdstack_app_cbk_t::vbus_is_present) (struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t volt, int8_t per)

Check whether VBus voltage is within expected range.

◆ vbus_discharge_on

void(* cy_stc_pdstack_app_cbk_t::vbus_discharge_on) (struct cy_stc_pdstack_context *ptrPdStackContext)

Turn on VBUS discharge circuit.

◆ vbus_discharge_off

void(* cy_stc_pdstack_app_cbk_t::vbus_discharge_off) (struct cy_stc_pdstack_context *ptrPdStackContext)

Turn off VBUS discharge circuit.

◆ psnk_set_voltage

void(* cy_stc_pdstack_app_cbk_t::psnk_set_voltage) (struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t volt_mV)

Set power sink voltage, in mV units.

◆ psnk_set_current

void(* cy_stc_pdstack_app_cbk_t::psnk_set_current) (struct cy_stc_pdstack_context *ptrPdStackContext, uint16_t cur_10mA)

Set power sink current, in 10mA units.

◆ psnk_enable

void(* cy_stc_pdstack_app_cbk_t::psnk_enable) (struct cy_stc_pdstack_context *ptrPdStackContext)

Enable power sink related circuitry.

◆ psnk_disable

void(* cy_stc_pdstack_app_cbk_t::psnk_disable) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_sink_discharge_off_cbk_t snk_discharge_off_handler)

Disable power sink related circuitry.

◆ eval_src_cap

void(* cy_stc_pdstack_app_cbk_t::eval_src_cap) (struct cy_stc_pdstack_context *ptrPdStackContext, const cy_stc_pdstack_pd_packet_t *srcCap, cy_pdstack_app_resp_cbk_t app_resp_handler)

Evaluate received source caps and provide the RDO to be used to negotiate contract.

◆ eval_rdo

void(* cy_stc_pdstack_app_cbk_t::eval_rdo) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_pd_pd_do_t rdo, cy_pdstack_app_resp_cbk_t app_resp_handler)

Evaluate sink request message.

◆ eval_dr_swap

void(* cy_stc_pdstack_app_cbk_t::eval_dr_swap) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_app_resp_cbk_t app_resp_handler)

Handles DR swap request received by port.

◆ eval_pr_swap

void(* cy_stc_pdstack_app_cbk_t::eval_pr_swap) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_app_resp_cbk_t app_resp_handler)

Handles pr swap request received by port.

◆ eval_vconn_swap

void(* cy_stc_pdstack_app_cbk_t::eval_vconn_swap) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_app_resp_cbk_t app_resp_handler)

Handles VCONN swap request received by port.

◆ eval_vdm

void(* cy_stc_pdstack_app_cbk_t::eval_vdm) (struct cy_stc_pdstack_context *ptrPdStackContext, const cy_stc_pdstack_pd_packet_t *vdm, cy_pdstack_vdm_resp_cbk_t vdm_resp_handler)

Handle VDMs (all structured/unstructured VDMs need to be handled) received by the port.

◆ eval_fr_swap

void(* cy_stc_pdstack_app_cbk_t::eval_fr_swap) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_pdstack_app_resp_cbk_t app_resp_handler)

Handle FR swap request received by the specified port.

◆ vbus_get_value

uint16_t(* cy_stc_pdstack_app_cbk_t::vbus_get_value) (struct cy_stc_pdstack_context *ptrPdStackContext)

Get current VBUS value in mV from application.

◆ psrc_get_voltage

uint32_t(* cy_stc_pdstack_app_cbk_t::psrc_get_voltage) (struct cy_stc_pdstack_context *ptrPdStackContext)

Get expected VBUS value in mV from application.

This is to include any additional compensation done for drops.