Skip to content

Commit b1da342

Browse files
committed
PSoC 6: enable/disable sleep modes based on CY_CFG_PWR_SYS_IDLE_MODE
1 parent 7f0c98d commit b1da342

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/cy_sleep_api.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@
2626

2727
void hal_sleep(void)
2828
{
29+
// Noop, if the idle mode is active
30+
#if !defined(CY_CFG_PWR_SYS_IDLE_MODE) || (CY_CFG_PWR_SYS_IDLE_MODE != CY_CFG_PWR_MODE_ACTIVE)
2931
cyhal_syspm_sleep();
32+
#endif
3033
}
3134

3235
void hal_deepsleep(void)
3336
{
37+
#if !defined(CY_CFG_PWR_SYS_IDLE_MODE) || (CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_DEEPSLEEP)
38+
3439
#if DEVICE_LPTICKER
3540
// A running timer will block DeepSleep, which would normally be
3641
// good because we don't want the timer to accidentally
@@ -41,9 +46,14 @@ void hal_deepsleep(void)
4146
cy_us_ticker_stop();
4247
cyhal_syspm_deepsleep();
4348
cy_us_ticker_start();
44-
#else
49+
#else // DEVICE_LPTICKER
50+
cyhal_syspm_sleep();
51+
#endif // DEVICE_LPTICKER
52+
53+
#elif CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_SLEEP
4554
cyhal_syspm_sleep();
46-
#endif /* DEVICE_LPTICKER */
55+
#endif // CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_ACTIVE
56+
// Noop, if the idle mode is active
4757
}
4858

4959
#endif /* DEVICE_SLEEP */

0 commit comments

Comments
 (0)