CAT2 Peripheral Driver Library

General Description

Functions

cy_en_syspm_status_t Cy_SysPm_CpuEnterSleep (void)
 Sets the CPU into the Sleep power mode, and calls registered callback functions. More...
 
cy_en_syspm_status_t Cy_SysPm_CpuEnterDeepSleep (void)
 Sets the system into deep sleep power mode. More...
 
void Cy_SysPm_CpuEnterSleepNoCallbacks (void)
 Sets the CPU to Sleep mode without calling registered callback functions. More...
 
void Cy_SysPm_CpuEnterDeepSleepNoCallbacks (void)
 Sets the CPU into Deep Sleep mode without calling registered callback functions. More...
 
void Cy_SysPm_SleepOnExit (bool enable)
 Set Sleep on the Exit mode. More...
 

Function Documentation

◆ Cy_SysPm_CpuEnterSleep()

cy_en_syspm_status_t Cy_SysPm_CpuEnterSleep ( void  )

Sets the CPU into the Sleep power mode, and calls registered callback functions.

For more details about switching into the sleep power mode and debug, refer to the device TRM. If at least one callback function with the CY_SYSPM_SLEEP type was registered, the following algorithm is executed: Prior to entering sleep mode, all callback functions of the CY_SYSPM_SLEEP type with the CY_SYSPM_CHECK_READY parameter are called allowing the driver to signal whether it is ready to enter the low power mode. If any of the callbacks of the CY_SYSPM_SLEEP type with the CY_SYSPM_CHECK_READY parameter returns CY_SYSPM_FAIL, the remaining callback of the CY_SYSPM_SLEEP type with the CY_SYSPM_CHECK_READY parameter calls are skipped. After CY_SYSPM_FAIL, all the CY_SYSPM_SLEEP callbacks with the CY_SYSPM_CHECK_FAIL parameter are executed. These are the callbacks of the CY_SYSPM_SLEEP type with the CY_SYSPM_CHECK_READY parameter that were previously executed before getting CY_SYSPM_FAIL. If sleep mode is not entered the Cy_SysPm_CpuEnterSleep() function returns CY_SYSPM_FAIL. If all of the callbacks of the CY_SYSPM_SLEEP type with the CY_SYSPM_CHECK_READY parameter calls return CY_SYSPM_SUCCESS, then all callbacks of the CY_SYSPM_SLEEP type with the CY_SYSPM_CHECK_FAIL parameters calls are skipped, and all callbacks of the CY_SYSPM_SLEEP type and CY_SYSPM_BEFORE_TRANSITION parameter calls are executed, allowing the peripherals to prepare for CPU sleep. The sleep mode is then entered for the CPU. This is a CPU-centric power mode. It means that the CPU has entered the sleep mode and its main clock is removed. It is identical to CPU active mode from a peripheral point of view. Any enabled interrupt can cause a wakeup from sleep mode. After wakeup from CPU sleep, all registered callbacks of the CY_SYSPM_SLEEP type and with the CY_SYSPM_AFTER_TRANSITION parameter are executed to return the peripherals to active operation. The Cy_SysPm_CpuEnterSleep() function returns CY_SYSPM_SUCCESS. No callbacks of the CY_SYSPM_SLEEP type with the CY_SYSPM_BEFORE_TRANSITION parameter or callbacks of the CY_SYSPM_SLEEP type and CY_SYSPM_AFTER_TRANSITION parameter callbacks are executed if sleep mode is not entered.

Note
The last callback which returned CY_SYSPM_FAIL is not executed with the CY_SYSPM_CHECK_FAIL parameter because of the FAIL. The return values from executed callback functions with the CY_SYSPM_CHECK_FAIL, CY_SYSPM_BEFORE_TRANSITION, and CY_SYSPM_AFTER_TRANSITION modes are ignored. cy_en_syspm_callback_mode_t, except the CY_SYSPM_CHECK_READY, are ignored.
Returns
Entered status, see cy_en_syspm_status_t.

◆ Cy_SysPm_CpuEnterDeepSleep()

cy_en_syspm_status_t Cy_SysPm_CpuEnterDeepSleep ( void  )

Sets the system into deep sleep power mode.

Prior to entering the deep sleep mode, all callbacks of the CY_SYSPM_DEEPSLEEP type with the CY_SYSPM_CHECK_READY parameter registered callbacks are called, allowing the driver to signal whether it is ready to enter the power mode. If any CY_SYSPM_DEEPSLEEP type with the CY_SYSPM_CHECK_READY parameter call returns CY_SYSPM_FAIL, the remaining callback CY_SYSPM_DEEPSLEEP type with the CY_SYSPM_CHECK_READY parameter calls are skipped. After a CY_SYSPM_FAIL, all of the callbacks of the CY_SYSPM_DEEPSLEEP type with the CY_SYSPM_CHECK_FAIL parameter are executed that correspond to the callbacks with CY_SYSPM_DEEPSLEEP type with CY_SYSPM_CHECK_READY parameter calls that occurred up to the point of failure. The deep sleep mode is not entered and the Cy_SysPm_CpuEnterDeepSleep() function returns CY_SYSPM_FAIL. If all callbacks of the CY_SYSPM_DEEPSLEEP type with the CY_SYSPM_CHECK_READY parameter calls return CY_SYSPM_SUCCESS, then all callbacks of the CY_SYSPM_DEEPSLEEP type with the CY_SYSPM_CHECK_FAIL parameter calls are skipped and all callbacks of the CY_SYSPM_DEEPSLEEP type with the CY_SYSPM_BEFORE_TRANSITION parameter calls are executed, allowing the peripherals to prepare for deep sleep. The deep sleep mode is then entered. Any enabled interrupt can cause a wakeup from the deep sleep mode.

Note
The last callback which returned CY_SYSPM_FAIL is not executed with the CY_SYSPM_CHECK_FAIL parameter because of the FAIL.

The return values from executed callback functions with the CY_SYSPM_CHECK_FAIL, CY_SYSPM_BEFORE_TRANSITION, and CY_SYSPM_AFTER_TRANSITION modes are ignored.

Peripherals that do not need a clock or that receive a clock from their external interface (e.g. I2C/SPI) continue operating. Wakeup occurs when an interrupt asserts from an active deep sleep peripheral. For more details, see the corresponding peripheral's datasheet.

For more details about switching into the deep sleep power mode and debug, refer to the device TRM.

After wakeup from Deep Sleep, all of the registered callbacks with CY_SYSPM_DEEPSLEEP type with CY_SYSPM_AFTER_TRANSITION are executed to return peripherals to Active operation. The Cy_SysPm_CpuEnterDeepSleep() function returns CY_SYSPM_SUCCESS. No callbacks are executed with CY_SYSPM_DEEPSLEEP type with CY_SYSPM_BEFORE_TRANSITION or CY_SYSPM_AFTER_TRANSITION parameter, if deep sleep mode was not entered.

Note
For proper clocks tree configuration before entering Deep Sleep mode and restore clock tree configuration after waking up the Cy_SysClk_DeepSleepCallback() (or it's customized version, accordingly to the application specifics) should be registered (recommended as the last in the registration sequence). Otherwise, PSoC may stuck at wakeup from Deep Sleep.
Returns
Entered status, see cy_en_syspm_status_t.

◆ Cy_SysPm_CpuEnterSleepNoCallbacks()

void Cy_SysPm_CpuEnterSleepNoCallbacks ( void  )

Sets the CPU to Sleep mode without calling registered callback functions.

The application is responsible for preparing a device for entering Low-power mode and restoring it to the desired state on a wakeup.

For more details about switching to Sleep mode and debug, refer to the device TRM.

Refer to the Cy_SysPm_CpuEnterSleep() for the automatic execution of registered callback functions.

◆ Cy_SysPm_CpuEnterDeepSleepNoCallbacks()

void Cy_SysPm_CpuEnterDeepSleepNoCallbacks ( void  )

Sets the CPU into Deep Sleep mode without calling registered callback functions.

The application is responsible for preparing a device for entering Low-power mode and restoring it to the desired state on a wakeup.

For more details about switching to Sleep mode and debug, refer to the device TRM.

Refer to the Cy_SysPm_CpuEnterDeepSleep() for the automatic execution of registered callback functions.

◆ Cy_SysPm_SleepOnExit()

void Cy_SysPm_SleepOnExit ( bool  enable)

Set Sleep on the Exit mode.

This API gives a possibility to keep the CPU in the sleep mode at all times and only wakeup to run a single interrupt and then immediately go back to sleep.

Parameters
enable
  • True - Enable Sleep on Exit
  • False - Disable Sleep on Exit