/*** *** The Example has no copyright and can be used by anyone. *** The following example is based on Device File Package *** required to compile the macro definitions used. *** The Device File Package is avaiblable by downloading Atmel Studio 7. ***/ /*** *** In this example the aim is to start a 1s timer. *** RTC in calendar mode (mode 2) using periodic event *** using the XOSC32K 1KHZ output as closk source *** The RTC is also configured to trigger an ADC start conversion every seconds *** based on the Periodic Event PEREO7 ***/ /** Dynamic Power Gating enabled ***/ PM->STDBYCFG.bit.DPGPDSW = PM_STDBYCFG_DPGPDSW_1_Val; /*** 4kB SRAM out of 16kB will be retained in STANDBY ***/ PM->PWCFG.bit.RAMPSWC = PM_PWCFG_RAMPSWC_4KB_Val; /*** Changing Sleep Mode to STANDBY ***/ PM->SLEEPCFG.bit.SLEEPMODE = PM_SLEEPCFG_SLEEPMODE_STANDBY_Val; /*** Ensure register is written before issuing wfi command ***/ while(PM->SLEEPCFG.bit.SLEEPMODE!=PM_SLEEPCFG_SLEEPMODE_STANDBY_Val); /*** WAIT FOR IRQ ***/ __DSB(); __WFI();