PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Functions
PDL API Reference » SysClk (System Clock) » Low Power Callback

## General Description

## Functions
cy_en_syspm_status_t | Cy_SysClk_DeepSleepCallback (cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode)
| Callback function to be used when entering system Deep Sleep mode. More...

## Function Documentation

## ◆ Cy_SysClk_DeepSleepCallback()

cy_en_syspm_status_t Cy_SysClk_DeepSleepCallback | ( | cy_stc_syspm_callback_params_t * | callbackParams,
|  | cy_en_syspm_callback_mode_t | mode
| ) |  |

Callback function to be used when entering system Deep Sleep mode.

This function is applicable if:

- The FLL is enabled
- The PLL is enabled and is driven by ECO

This function performs the following:

1. Before entering Deep Sleep, the clock configuration is saved in SRAM. If the FLL/PLL source is the ECO, then the FLL/PLL is bypassed and the source is changed to IMO.
   If the FLL is enabled - it is just bypassed.
2. Upon wakeup from Deep Sleep, the function waits for ECO stabilization, then restores the configuration and waits for the FLL/PLL to regain their frequency locks.
   If ECO is not used and FLL is enabled - it waits for FLL lock and unbypasses it.

The function prevents entry into Deep Sleep mode if the measurement counters are currently counting; see Cy_SysClk_StartClkMeasurementCounters.

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

Note
  This function is recommended to be the last callback that is registered. Doing so minimizes the time spent on low power mode entry and exit.
  This function implements all four SysPm callback modes cy_en_syspm_callback_mode_t. So the cy_stc_syspm_callback_t::skipMode must be set to 0UL.
  This function does not support such cases as, for example, FLL is enabled but bypassed by user code before entering Deep Sleep.
  You can use this callback implementation as an example to design custom low-power callbacks for certain user application.

Parameters

  callbackParams | structure with the syspm callback parameters, see cy_stc_syspm_callback_params_t.
  mode | Callback mode, see cy_en_syspm_callback_mode_t

Returns
  Error / status code; see cy_en_syspm_status_t. Pass if not doing a clock measurement, otherwise Fail. Timeout if timeout waiting for ECO, FLL or PLL to get stable / regain its frequency lock.

Function Usage
  /* Scenario: The application uses FLL/PLL sourced from the ECO. The device
  needs to enter chip Deep Sleep. The ECO and FLL/PLL must be
  suitably prepared before entering low power mode. */
  /* Register all the Deep Sleep callbacks for other peripherals.
  The SysClk callback is recommended to be registered last to minimize
  the low power mode entry and wakeup timings. */
  cy_stc_syspm_callback_params_t clkCallbackParams = {
  /*.base =*/ NULL,
  /*.context =*/ NULL
  };
  cy_stc_syspm_callback_t clkCallback = {
  /*.callback =*/ &Cy_SysClk_DeepSleepCallback,
  /*.type =*/ CY_SYSPM_DEEPSLEEP,
  /*.skipMode =*/ 0UL,
  /*.callbackParams =*/ &clkCallbackParams,
  /*.prevItm =*/ NULL,
  /*.nextItm =*/ NULL,
  /*.order =*/ 0
  };
  /* Register the clock callback */
  if(!Cy_SysPm_RegisterCallback(&clkCallback))
  {
  /* Could not register callback. Examine the number of registered callbacks */
  }
  /* Ensure that the clock measurement is not running and enter chip Deep Sleep */
  Cy_SysClk_DeepSleepCallback
  cy_en_syspm_status_t Cy_SysClk_DeepSleepCallback(cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode)
  Callback function to be used when entering system Deep Sleep mode.
  Definition: cy_sysclk_v2.c:7822
  CY_SYSPM_DEEPSLEEP
  @ CY_SYSPM_DEEPSLEEP
  The Deep Sleep enum callback type.
  Definition: cy_syspm.h:1519
  cy_stc_syspm_callback_params_t
  The structure contains syspm callback parameters.
  Definition: cy_syspm.h:2054
  cy_stc_syspm_callback_t
  Structure with syspm callback configuration elements.
  Definition: cy_syspm.h:2068
  Cy_SysPm_RegisterCallback
  bool Cy_SysPm_RegisterCallback(cy_stc_syspm_callback_t *handler)
  Registers a new syspm callback.
  Definition: cy_syspm_v4.c:2063