I’d like to use the sleep mode and RTC on the Xiao, any idea if there are any functions or include files that are already set up to handle this?
Hi @miller863
Sorry for we have not related files or tutorials that already set up to handle this.
But I found a code related to setting the sleep mode of Xiao.
//#include?“arduino.h”
// Idlemode 0 , 1 , 2
void idle(unsigned char Idlemode)
{
SYSCTRL->XOSC.bit.RUNSTDBY = 1;
SCB->SCR &= ~ SCB_SCR_SLEEPDEEP_Msk;
PM->SLEEP.reg = Idlemode;
__DSB();
__WFI();
SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;
}
void standby(void)
{
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
__DSB();
__WFI();
}
void setup() {
// initialize digital pin LED_BUILTIN as an output.
idle(1);
// standby();
}
// the loop function runs over and over again forever
void loop() {
}
Any more details on the sleep modes. Even with your sample code, I cannot enable any sleep states. Any documentation on how to wake? I’d like to wake via interrupt. Thanks!