CAT2 Peripheral Driver Library
Low Power Callback

Entering and exiting low power modes require compatible clock configurations to be set before entering low power and restored upon wakeup and exit. More...

Modules

 Callback Timeout Events
 
 Data Structures
 
 Functions
 

Detailed Description

Entering and exiting low power modes require compatible clock configurations to be set before entering low power and restored upon wakeup and exit.

The SysClk driver provides a Cy_SysClk_DeepSleepCallback() function to support the Deep Sleep mode entry. This is needed especially in cases of PLL or/and ECO usage. Also there is a possibility of indication the PLL/ECO startup timeout after the wakeup, see Cy_SysClk_RegisterCallback for details.

Note
If Clock Supervision Block (CSV) and Programmable Delay Block (PGM_DELAY) are used, they also require proper preparation for the Deep Sleep mode, which for example could be done by the separate custom Deep Sleep callback:
/* Declare the Clock Supervisor Deep Sleep callback */
{
static bool pgmEn = false; /* Static variable to store the Delay Counter state during Deep Sleep cycle */
static bool csvEn = false; /* Static variable to store the CSV state during Deep Sleep cycle */
CY_UNUSED_PARAMETER(callbackParams);
{
pgmEn = Cy_SysClk_DelayCounterIsEnabled(); /* Check the Delay Counter state */
csvEn = Cy_SysClk_CsvIsEnabled(); /* Check the CSV state */
if (pgmEn)
{
Cy_SysClk_DelayCounterDisable(); /* Disable the Delay Counter before falling asleep */
}
if (csvEn)
{
Cy_SysClk_CsvDisable(); /* Disable the CSV before falling asleep */
}
}
{
if (csvEn)
{
Cy_SysClk_CsvEnable(); /* Enable the CSV after wake up */
}
if (pgmEn)
{
Cy_SysClk_DelayCounterReload(); /* Reload the Delay Counter before enabling */
Cy_SysClk_DelayCounterEnable(); /* Enable the Delay Counter after wake up */
}
}
return (retVal);
}
/* Declare the SysPm structure to the Clock Supervisor Deep Sleep callback */
cy_stc_syspm_callback_params_t csvCallbackParams =
{
.base = NULL,
.context = NULL
};
{
.callback = &My_CsvDsCb,
.callbackParams = &csvCallbackParams,
.prevItm = NULL,
.nextItm = NULL,
.order = 0
};
/* The Clock Supervisor Deep Sleep callback is recommended to be registered
* right before the Cy_SysClk_DeepSleepCallback registration to minimize
* the possible clock risks.
*/
/* Register the sysClk deep sleep callback */
bool regCbStatus = Cy_SysPm_RegisterCallback(&csvCallback);
if(!regCbStatus)
{
/* Could not register callback. Examine the number of registered callbacks */
}