CAT2 Peripheral Driver Library

Functions

cy_en_syspm_status_t Cy_SCB_SPI_DeepSleepCallback (cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode)
 This function handles the transition of the SCB SPI into and out of Deep Sleep mode. More...
 
__STATIC_INLINE void Cy_SCB_SPI_RegisterDSClockConfig (CySCB_Type const *base, cy_cb_scb_spi_handle_deep_sleep_mode_t callback, cy_stc_scb_spi_context_t *context)
 Registers a callback function that will occur in Cy_SCB_SPI_DeepSleepCallback when the SPI goes into deepsleep. More...
 

Detailed Description

Function Documentation

◆ Cy_SCB_SPI_DeepSleepCallback()

cy_en_syspm_status_t Cy_SCB_SPI_DeepSleepCallback ( cy_stc_syspm_callback_params_t callbackParams,
cy_en_syspm_callback_mode_t  mode 
)

This function handles the transition of the SCB SPI into and out of Deep Sleep mode.

It prevents the device from entering Deep Sleep mode if the SPI slave or master is actively communicating, or there is any data in the TX or RX FIFOs. The following behavior of the SPI SCB depends on whether the SCB block is configured as enable-wakeup or not:

  • enable-wakeup: any transfer intended to the slave wakes up the device from Deep Sleep mode. The slave responds with 0xFF to the transfer and incoming data is ignored. If the transfer occurs before the device enters Deep Sleep mode, the device will not enter Deep Sleep mode and incoming data is stored in the RX FIFO. The SCB clock is disabled before entering Deep Sleep and enabled after the device exits Deep Sleep mode. The SCB clock disabling may lead to corrupted data in the RX FIFO. Clear the RX FIFO after this callback is executed. Note that for proper SPI operation after Deep Sleep the source of HFCLK must be stable, this includes the PLL. Only the SPI slave can be configured to be a wakeup source from Deep Sleep mode.
  • Not enable-wakeup: the SPI is disabled. It is enabled when the device fails to enter Deep Sleep mode or it is awakened from Deep Sleep mode. While the SPI is disabled, it stops driving the outputs and ignores the inputs. Any incoming data is ignored. Refer to section Low Power Support for more information about SPI pins when SCB disabled.

This function must be called during execution of Cy_SysPm_CpuEnterDeepSleep. To do it, register this function as a callback before calling Cy_SysPm_CpuEnterDeepSleep : specify CY_SYSPM_DEEPSLEEP as the callback type and call Cy_SysPm_RegisterCallback.

Parameters
callbackParamsThe pointer to the callback parameters structure cy_stc_syspm_callback_params_t.
modeCallback mode, see cy_en_syspm_callback_mode_t
Returns
cy_en_syspm_status_t
Note
For proper operation, when the SPI slave is configured to be a wakeup source from Deep Sleep mode, need to register callback function by Cy_SCB_SPI_RegisterDSClockConfig. Callback function must disable or enable the clock divider depending on the event SPI Deep Sleep Callback Events. Not applicable for PSoC 4100S Max and PSoC 4000T.

◆ Cy_SCB_SPI_RegisterDSClockConfig()

__STATIC_INLINE void Cy_SCB_SPI_RegisterDSClockConfig ( CySCB_Type const *  base,
cy_cb_scb_spi_handle_deep_sleep_mode_t  callback,
cy_stc_scb_spi_context_t context 
)

Registers a callback function that will occur in Cy_SCB_SPI_DeepSleepCallback when the SPI goes into deepsleep.

In the configurator if Deep Sleep Callback is enabled a callback function will be supplied. The function will disable the clock divider when going into deepsleep and enable the clock divider when coming out of deepsleep. If Deep Sleep Callback is not enabled a user defined function must enable and disable the clock dividers.

Parameters
baseThe pointer to the SPI SCB instance.
callbackThe pointer to a callback function that will enable and disable the SPI clock divider when going into and out of deepsleep. See cy_cb_scb_spi_handle_events_t for the function prototype.
contextThe pointer to the context structure cy_stc_scb_spi_context_t allocated by the user. The structure is used during the SPI operation for internal configuration and data retention. The user should not modify anything in this structure.
Note
To remove the callback, pass NULL as the pointer to the callback function.
Not applicable for PSoC 4100S Max and PSoC 4000T.