Low Power Callback

group group_i2s_functions_syspm_callback

The driver supports SysPm callback for Deep Sleep transition.

Functions

cy_en_syspm_status_t Cy_I2S_DeepSleepCallback(cy_stc_syspm_callback_params_t const *callbackParams, cy_en_syspm_callback_mode_t mode)

This is a callback function to be used at the application layer to manage an I2S operation during the Deep Sleep cycle.

It stores the I2S state (Tx/Rx enabled/disabled/paused) into the context structure and stops the communication before entering into Deep Sleep power mode and restores the I2S state after waking up.

note

Use the cy_stc_i2s_context_t data type for definition of the *context element of the cy_stc_syspm_callback_params_t structure.

Return

the SysPm callback status cy_en_syspm_status_t.

Function Usage

    /* Scenario: The I2S hardware must be suitably prepared to enter device Deep Sleep Mode.
    It must stop all communication before Deep Sleep Mode entry and continue communication upon Deep Sleep Mode exit. */
    
    /* Context structure for Cy_I2S_DeepSleepCallback */
    cy_stc_i2s_context_t i2sDeepSleepCallbackContext;

    /* Parameters structure for Cy_I2S_DeepSleepCallback */
    cy_stc_syspm_callback_params_t i2sDeepSleepCallbackParams = 
    {
        (void*) I2S0,
        (void*) &i2sDeepSleepCallbackContext
    };
    
    /* Initialization structure for Cy_I2S_DeepSleepCallback */
    cy_stc_syspm_callback_t i2sDeepSleepCallback = 
    {
        (Cy_SysPmCallback)&Cy_I2S_DeepSleepCallback,
        CY_SYSPM_DEEPSLEEP,
        /* Skip execution for CHECK_READY and CHECK_FAIL events */
        CY_SYSPM_SKIP_CHECK_READY | CY_SYSPM_SKIP_CHECK_FAIL,
        &i2sDeepSleepCallbackParams,
        NULL,
        NULL,
        0
    };
    
    /* Register the Cy_I2S_DeepSleepCallback */
    if (CY_SYSPM_SUCCESS != Cy_SysPm_RegisterCallback(&i2sDeepSleepCallback))
    {
        /* Insert error handling */
    }
    
    /* Enter chip Deep Sleep Mode using the SysPm driver API */

Parameters