- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We need to modify the reply of "Get_Source_Cap" in CYPD4236-40LQXI_dock project,
But there is no "Get_source_cap" in app_callback.
Where do we start from?
Best Regards,
Manu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Manu,
You can begin with send a GET_SOURCE_CAP by yourself and then write a callback for this action and report EVENT to app.c. The function you can use is below:
==================================================================
/**
* @brief This function provides an interface for the application module to
* send PD commands.
* @param port Port index.
* @param cmd Command name.
* @param buf_ptr Pointer to the command buffer.
* @param cmd_cbk Pointer to the callback function.
* @return Returns CCG_STAT_SUCCESS if the command is registered,
* CCG_STAT_CMD_FAILURE if the PD port is not ready for a command and
* CCG_STAT_BUSY if there is another pending command.
* @warning Data received via the callback should be copied out by the
* application, because the buffer will be reused by the stack to store data on
* new message reception.
*/
ccg_status_t dpm_pd_command(uint8_t port, dpm_pd_cmd_t cmd, dpm_pd_cmd_buf_t* buf_ptr,
dpm_pd_cmd_cbk_t cmd_cbk);
=================================================================
You could check the Type-C status and sent it when the Type-C is attached and state is idle.
a. dpm_pd_command (US_TYPEC_PORT_IDX, DPM_CMD_GET_SRC_CAP, NULL, us_get_sourc_cap_cb);
b. dpm_pd_cmd_cbk_t us_get_sourc_cap_cb (uint8_t port);
Best Regards,
Lisa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Manu,
You can begin with send a GET_SOURCE_CAP by yourself and then write a callback for this action and report EVENT to app.c. The function you can use is below:
==================================================================
/**
* @brief This function provides an interface for the application module to
* send PD commands.
* @param port Port index.
* @param cmd Command name.
* @param buf_ptr Pointer to the command buffer.
* @param cmd_cbk Pointer to the callback function.
* @return Returns CCG_STAT_SUCCESS if the command is registered,
* CCG_STAT_CMD_FAILURE if the PD port is not ready for a command and
* CCG_STAT_BUSY if there is another pending command.
* @warning Data received via the callback should be copied out by the
* application, because the buffer will be reused by the stack to store data on
* new message reception.
*/
ccg_status_t dpm_pd_command(uint8_t port, dpm_pd_cmd_t cmd, dpm_pd_cmd_buf_t* buf_ptr,
dpm_pd_cmd_cbk_t cmd_cbk);
=================================================================
You could check the Type-C status and sent it when the Type-C is attached and state is idle.
a. dpm_pd_command (US_TYPEC_PORT_IDX, DPM_CMD_GET_SRC_CAP, NULL, us_get_sourc_cap_cb);
b. dpm_pd_cmd_cbk_t us_get_sourc_cap_cb (uint8_t port);
Best Regards,
Lisa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Liza,
If I receive Get_Source_Cap command, where can I modify the action?
Best Regards,
Manu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Manu,
You could refer below way to detect GET_SOURCE_CAP message and then write a callback for your project.
const dpm_status_t* dpm_stat = dpm_get_info(TYPEC_PORT_0_IDX);
uint8_t msg = pe_stat->rcvd_ptr->msg;
If (msg = CTRL_MSG_GET_SOURCE_CAP)
{
.....
}
Best Regards,
Lisa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Liza,
I create a function that runs in the while loop inside main() :
===
void APP_Recv_Get_Source_Cap_Service(void)
{
const dpm_status_t* dpm_stat = dpm_get_info(TYPEC_PORT_0_IDX);
uint8_t my_msg = dpm_stat->src_cap_p->msg;
if(my_msg == CTRL_MSG_GET_SOURCE_CAP)
{
UART_1_UartPutChar('A');
UART_1_UartPutChar('B');
UART_1_UartPutChar('C');
}
}
===
But received GET_SOURCE_CAP was not detected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Manu,
You used incorrect value. Please kindly take a look.
const dpm_status_t* dpm_stat = dpm_get_info(TYPEC_PORT_0_IDX);
uint8_t msg = pe_stat->rcvd_ptr->msg;
Best Regards,
Lisa