AMSv2 RTC: no need to write to RTC_WAKEUP register
The wakeup alarm will be disabled when powering off anyway OF database refresh of µSD now only happens if the wakeup was explicitely enabled There still seems to be a freeze problem when powering off (sometimes) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26875 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
604b17aa08
commit
ba07b2055c
1 changed files with 9 additions and 24 deletions
|
@ -122,36 +122,21 @@ bool rtc_check_alarm_started(bool release_alarm)
|
|||
{
|
||||
(void) release_alarm;
|
||||
|
||||
/* was it an alarm that triggered power on ? */
|
||||
bool alarm_start = false;
|
||||
|
||||
/* 3 first reads give the 23 bits counter and enable bit */
|
||||
ascodec_read(AS3543_WAKEUP); /* bits 7:0 */
|
||||
ascodec_read(AS3543_WAKEUP); /* bits 15:8 */
|
||||
if(ascodec_read(AS3543_WAKEUP) & (1<<7)) /* enable bit */
|
||||
{
|
||||
#if 0 /* we could have a persistent setting for wake-up time */
|
||||
alarm_enabled = true;
|
||||
#endif
|
||||
if(!(ascodec_read(AS3543_WAKEUP) & (1<<7))) /* enable bit */
|
||||
return false;
|
||||
|
||||
/* subsequent reads give the 16 bytes static SRAM */
|
||||
wakeup_h = ascodec_read(AS3543_WAKEUP);
|
||||
wakeup_m = ascodec_read(AS3543_WAKEUP);
|
||||
/* subsequent reads give the 16 bytes static SRAM */
|
||||
wakeup_h = ascodec_read(AS3543_WAKEUP);
|
||||
wakeup_m = ascodec_read(AS3543_WAKEUP);
|
||||
|
||||
struct tm tm;
|
||||
rtc_read_datetime(&tm);
|
||||
struct tm tm;
|
||||
rtc_read_datetime(&tm);
|
||||
|
||||
/* do we wake up at the programmed time, or for another reason ? */
|
||||
if(wakeup_h == tm.tm_hour && wakeup_m == tm.tm_min)
|
||||
alarm_start = true;
|
||||
}
|
||||
|
||||
/* disable alarm */
|
||||
ascodec_write(AS3543_WAKEUP, 0); /* bits 7:0 */
|
||||
ascodec_write(AS3543_WAKEUP, 0); /* bits 15:8 */
|
||||
ascodec_write(AS3543_WAKEUP, 0); /* bits 22:16 + enable bit */
|
||||
|
||||
return alarm_start;
|
||||
/* were we powered up at the programmed time ? */
|
||||
return wakeup_h == tm.tm_hour && wakeup_m == tm.tm_min;
|
||||
}
|
||||
|
||||
bool rtc_check_alarm_flag(void)
|
||||
|
|
Loading…
Reference in a new issue