PSoC 4 Peripheral Driver Library - Alpha

General Description

Functions

cy_en_syspm_status_t Cy_SysPm_SystemEnterDeepSleep (cy_en_syspm_waitfor_t waitFor)
 
cy_en_syspm_status_t Cy_SysPm_SystemEnterHibernate (void)
 

Function Documentation

◆ Cy_SysPm_SystemEnterDeepSleep()

cy_en_syspm_status_t Cy_SysPm_SystemEnterDeepSleep ( cy_en_syspm_waitfor_t  waitFor)
Warning
Not supported in Alpha release

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_SystemEnterDeepSleep() function returns CY_SYSPM_FAIL. If all allbacks 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_SystemEnterDeepSleep() 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.

Parameters
waitForSelects wait for action. See cy_en_syspm_waitfor_t.
Returns
Entered status, see cy_en_syspm_status_t.

◆ Cy_SysPm_SystemEnterHibernate()

cy_en_syspm_status_t Cy_SysPm_SystemEnterHibernate ( void  )
Warning
Not supported in Alpha release

Sets the system into hibernate power mode. Prior to entering hibernate mode, all callbacks of the CY_SYSPM_HIBERNATE type are executed. First, callbacks of the CY_SYSPM_HIBERNATE type and with CY_SYSPM_CHECK_READY parameter are called allowing the driver to signal if it is not ready to enter the power mode. If any of the callbacks of the CY_SYSPM_HIBERNATE type with the CY_SYSPM_CHECK_READY parameter call returns CY_SYSPM_FAIL, the remaining CY_SYSPM_HIBERNATE callbacks with the CY_SYSPM_CHECK_READY parameter calls are skipped. After CY_SYSPM_FAIL, all of the CY_SYSPM_HIBERNATE callbacks with CY_SYSPM_CHECK_FAIL parameter are executed that correspond to the CY_SYSPM_HIBERNATE callbacks with CY_SYSPM_CHECK_READY parameter calls that occurred up to the point of failure. The hibernate mode is not entered and the Cy_SysPm_EnterHibernate() function returns CY_SYSPM_FAIL. If all CY_SYSPM_HIBERNATE callbacks with the CY_SYSPM_CHECK_READY parameter calls return CY_SYSPM_SUCCESS, then all CY_SYSPM_HIBERNATE callbacks with CY_SYSPM_CHECK_FAIL calls are skipped and all CY_SYSPM_HIBERNATE callbacks CY_SYSPM_BEFORE_TRANSITION parameter calls 8 are executed allowing the peripherals to prepare for hibernate. All of the I/O output states are frozen and the hibernate mode is then entered. In hibernate mode, all internal supplies are off and only SRAM and UDB state is retained.

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.

A wakeup from hibernate is triggered by toggling any GPIO pin interrupt, the wakeup pin, or a low-power comparator. A wakeup causes a normal boot procedure. To distinguish a wakeup from hibernate mode and a general reset event, the Cy_SysLib_GetResetReason() function can be used. The GPIO pin interrupt or low-power comparator's polarity can be changed with the Cy_SysPm_SetHibernateWakeupSource function. This function call will not return if hibernate mode is entered. The CY_SYSPM_HIBERNATE callbacks with the CY_SYSPM_AFTER_TRANSITION parameter are never executed. This function freezes the IO cells. The IO cells remain frozen after waking from hibernate mode until the firmware unfreezes them with a Cy_SysPm_IoUnfreeze() function call.

  • Returns
    Entered status, see cy_en_syspm_status_t.