/* Get alarm time from user */
PRINTF("Please input the number of second to wait for alarm and press enter \r\n");
PRINTF("The second must be positive value\r\n");
/* When wakeup from suspend, peripheral's doze & stop requests won't be cleared, need to clear them manually */
IOMUXC_GPR->GPR4 = 0x00000000;
IOMUXC_GPR->GPR7 = 0x00000000;
IOMUXC_GPR->GPR8 = 0x00000000;
IOMUXC_GPR->GPR12 = 0x00000000;
/* Configure UART divider to default */
CLOCK_SetMux(kCLOCK_UartMux, 1); /* Set UART source to OSC 24M */
CLOCK_SetDiv(kCLOCK_UartDiv, 0); /* Set UART divider to 1 */
BOARD_InitDebugConsole();
/* Since SNVS_PMIC_STBY_REQ_GPIO5_IO02 will output a high-level signal under Stop Mode(Suspend Mode) and this pin is
* connected to LCD power switch circuit. So it needs to be configured as a low-level output GPIO to reduce the
* current. */
BOARD_Init_PMIC_STBY_REQ();
BOARD_InitBootPeripherals();
PRINTF("\r\nSelect the desired operation \n\r\n");
PRINTF("Press %c for enter: Over RUN - System Over Run mode\r\n",
(uint8_t)'A' + (uint8_t)LPM_PowerModeOverRun);
PRINTF("Press %c for enter: Full RUN - System Full Run mode\r\n",
(uint8_t)'A' + (uint8_t)LPM_PowerModeFullRun);
PRINTF("Press %c for enter: Low Speed RUN - System Low Speed Run mode\r\n",
(uint8_t)'A' + (uint8_t)LPM_PowerModeLowSpeedRun);
PRINTF("Press %c for enter: Low Power RUN - System Low Power Run mode\r\n",
(uint8_t)'A' + (uint8_t)LPM_PowerModeLowPowerRun);
PRINTF("Press %c for enter: System Idle - System Wait mode\r\n",
(uint8_t)'A' + (uint8_t)LPM_PowerModeSysIdle);
PRINTF("Press %c for enter: Low Power Idle - Low Power Idle mode\r\n",
(uint8_t)'A' + (uint8_t)LPM_PowerModeLPIdle);
PRINTF("Press %c for enter: Suspend - Suspend mode\r\n", (uint8_t)'A' + (uint8_t)LPM_PowerModeSuspend);
#if (HAS_WAKEUP_PIN)
PRINTF("Press %c for enter: SNVS - Shutdown the system\r\n",
(uint8_t)'A' + (uint8_t)LPM_PowerModeSNVS);
#endif
PRINTF("\r\nWaiting for power mode select...\r\n\r\n");
if (s_targetPowerMode <= LPM_PowerModeEnd)
{
/* If could not set the target power mode, loop continue. */
if (!APP_CheckPowerMode(s_curRunMode, s_targetPowerMode))
{
continue;
}
/* If target mode is run mode, don't need to set wakeup source. */
if (s_targetPowerMode <= LPM_PowerModeLowPowerRun)
{
needSetWakeup = false;
}
else
{
needSetWakeup = true;
}