mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/sam0_common/periph: fix rtt reset after hibernation
This commit is contained in:
parent
d469e6d978
commit
7df7886a69
@ -407,29 +407,31 @@ void rtt_init(void)
|
||||
_read_gp(backup);
|
||||
#endif
|
||||
|
||||
_rtt_reset();
|
||||
if (!cpu_woke_from_backup()) {
|
||||
_rtt_reset();
|
||||
|
||||
#ifdef MODULE_PERIPH_RTC_MEM
|
||||
#ifdef RTC_MODE2_CTRLB_GP2EN
|
||||
/* RTC driver does not use COMP[1] or ALARM[1] */
|
||||
/* Use second set of Compare registers as general purpose register */
|
||||
RTC->MODE2.CTRLB.reg = RTC_MODE2_CTRLB_GP2EN;
|
||||
/* RTC driver does not use COMP[1] or ALARM[1] */
|
||||
/* Use second set of Compare registers as general purpose register */
|
||||
RTC->MODE2.CTRLB.reg = RTC_MODE2_CTRLB_GP2EN;
|
||||
#endif
|
||||
_write_gp(backup);
|
||||
_write_gp(backup);
|
||||
#endif /* MODULE_PERIPH_RTC_MEM */
|
||||
|
||||
/* set 32bit counting mode & enable the RTC */
|
||||
/* set 32bit counting mode & enable the RTC */
|
||||
#ifdef REG_RTC_MODE0_CTRLA
|
||||
RTC->MODE0.CTRLA.reg = RTC_MODE0_CTRLA_MODE(0)
|
||||
| RTC_MODE0_CTRLA_ENABLE
|
||||
| RTC_MODE0_CTRLA_COUNTSYNC
|
||||
| RTC_MODE0_PRESCALER;
|
||||
RTC->MODE0.CTRLA.reg = RTC_MODE0_CTRLA_MODE(0)
|
||||
| RTC_MODE0_CTRLA_ENABLE
|
||||
| RTC_MODE0_CTRLA_COUNTSYNC
|
||||
| RTC_MODE0_PRESCALER;
|
||||
#else
|
||||
RTC->MODE0.CTRL.reg = RTC_MODE0_CTRL_MODE(0)
|
||||
| RTC_MODE0_CTRL_ENABLE
|
||||
| RTC_MODE0_PRESCALER;
|
||||
RTC->MODE0.CTRL.reg = RTC_MODE0_CTRL_MODE(0)
|
||||
| RTC_MODE0_CTRL_ENABLE
|
||||
| RTC_MODE0_PRESCALER;
|
||||
#endif
|
||||
_wait_syncbusy();
|
||||
_wait_syncbusy();
|
||||
}
|
||||
|
||||
/* initially clear flag */
|
||||
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0
|
||||
|
Loading…
Reference in New Issue
Block a user