The DFU protocol provides a set of pre-defined commands.
The user can also add custom commands and register the single handler for all custom commands at the application level. This allows to adjust use case scenarios per the product needs. The feature is enabled with CY_DFU_OPT_CUSTOM_CMD set to non-zero value in the dfu_user.h or project Makefile.
The user commands area preserved in the DFU command protocol:
An example of the custom commands usage:
Functions | |
cy_en_dfu_status_t | Cy_DFU_RegisterUserCommand (cy_stc_dfu_params_t *params, Cy_DFU_CustomCommandHandler handler) |
Registering user commands handler. More... | |
cy_en_dfu_status_t | Cy_DFU_UnRegisterUserCommand (cy_stc_dfu_params_t *params) |
Unregisters user commands handling. More... | |
cy_en_dfu_status_t Cy_DFU_RegisterUserCommand | ( | cy_stc_dfu_params_t * | params, |
Cy_DFU_CustomCommandHandler | handler | ||
) |
Registering user commands handler.
params | The pointer to a DFU parameters structure. See cy_stc_dfu_params_t. |
handler | user command handler |
cy_en_dfu_status_t Cy_DFU_UnRegisterUserCommand | ( | cy_stc_dfu_params_t * | params | ) |
Unregisters user commands handling.
params | The pointer to a DFU parameters structure. See cy_stc_dfu_params_t. |