communicating with the MCU.
Code: Select all
static void cmd_sleep(BaseSequentialStream *chp, int argc, char *argv[]) {
uint8_t status;
(void)argv;
if (argc > 0)
{
if (strstr(argv[0], "zzzz") != NULL)
{
chThdSleepMilliseconds(1000);
chprintf(chp, "Entering sleep mode..... \r\n");
chThdSleepMilliseconds(1000);
PWR->CR &= ~PWR_CR_PDDS;
PWR->CR |= (PWR_CR_LPDS | PWR_CR_CSBF | PWR_CR_CWUF);
SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;
__WFI();
return;
}
}
}
Will this put the MCU to sleep ? and will it wait for EXT interrupt ?