MTB CAT1 Peripheral driver library
Low Power Callback

General Description

This set of functions is for Deep Sleep entry and exit.

Functions

cy_en_syspm_status_t Cy_SAR_DeepSleepCallback (const cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode)
 Callback to prepare the SAR before entering Deep Sleep and to re-enable the SAR after exiting Deep Sleep. More...
 
void Cy_SAR_DeepSleep (SAR_Type *base)
 This is the preferred routine to prepare the hardware for Deep Sleep. More...
 
void Cy_SAR_Wakeup (SAR_Type *base)
 This is the preferred routine to restore the hardware to the state after calling Cy_SAR_DeepSleep. More...
 

Function Documentation

◆ Cy_SAR_DeepSleepCallback()

cy_en_syspm_status_t Cy_SAR_DeepSleepCallback ( const cy_stc_syspm_callback_params_t callbackParams,
cy_en_syspm_callback_mode_t  mode 
)

Callback to prepare the SAR before entering Deep Sleep and to re-enable the SAR after exiting Deep Sleep.

Parameters
callbackParamsPointer to structure of type cy_stc_syspm_callback_params_t
modeCallback mode, see cy_en_syspm_callback_mode_t
Returns
See cy_en_syspm_status_t
Function Usage
/* Scenario: Before putting the device into Deep Sleep mode,
* the SAR Deep Sleep callback must be registered to ensure
* proper Deep Sleep entry and exit. */
/* Set the base address pointer to the SAR hardware block. */
static cy_stc_syspm_callback_params_t SARDeepSleepCallbackParams =
{
/* .base */ SAR_HW,
/* .context */ NULL
};
/* Attach the Cy_SAR_DeepSleepCallback function and set the callback parameters. */
static cy_stc_syspm_callback_t SARDeepSleepCallbackStruct =
{
/* .type */ CY_SYSPM_DEEPSLEEP,
/* .skipMode */ 0UL,
/* .callbackParams */ &SARDeepSleepCallbackParams,
/* .prevItm */ NULL,
/* .nextItm */ NULL,
/* .order */ 0
};
/* Register the callback before entering Deep Sleep mode. */
Cy_SysPm_RegisterCallback(&SARDeepSleepCallbackStruct);
/* Put the device into Deep Sleep mode and wait for an interrupt to wake up. */
Cy_SysPm_DeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT);

◆ Cy_SAR_DeepSleep()

void Cy_SAR_DeepSleep ( SAR_Type base)

This is the preferred routine to prepare the hardware for Deep Sleep.

It will call Cy_SAR_StopConvert to disable continuous conversions and wait for SAR conversions to stop before entering Deep Sleep. If the SARMUX is not configured for Deep Sleep operation, the entire SAR hardware block will be turned off.

Parameters
basePointer to structure describing registers
Returns
None
Function Usage

This function is used in the Cy_SAR_DeepSleepCallback. There is no need to call this function directly.

◆ Cy_SAR_Wakeup()

void Cy_SAR_Wakeup ( SAR_Type base)

This is the preferred routine to restore the hardware to the state after calling Cy_SAR_DeepSleep.

Restoring the hardware involves re-enabling the hardware, the reference buffer, and continuous scanning if it was previously enabled before entering sleep.

Parameters
basePointer to structure describing registers
Side Effects
Calling this function without previously calling Cy_SAR_DeepSleep can lead to unpredictable results.
Returns
None
Function Usage

This function is used in the Cy_SAR_DeepSleepCallback. There is no need to call this function directly.