summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/rtc/rtc_as3514.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c
index e5db839e77..837806d2ea 100644
--- a/firmware/drivers/rtc/rtc_as3514.c
+++ b/firmware/drivers/rtc/rtc_as3514.c
@@ -93,8 +93,6 @@ void rtc_alarm_poweroff(void)
93 93
94 disable_irq(); 94 disable_irq();
95 95
96 ascodec_write_pmu(0x1a, 4, 0x0); // In_Cntr : disable hearbeat source
97
98 ascodec_write(AS3543_WAKEUP, seconds); 96 ascodec_write(AS3543_WAKEUP, seconds);
99 seconds >>= 8; 97 seconds >>= 8;
100 ascodec_write(AS3543_WAKEUP, seconds); 98 ascodec_write(AS3543_WAKEUP, seconds);
@@ -102,11 +100,15 @@ void rtc_alarm_poweroff(void)
102 seconds |= 1<<7; /* enable bit */ 100 seconds |= 1<<7; /* enable bit */
103 ascodec_write(AS3543_WAKEUP, seconds); 101 ascodec_write(AS3543_WAKEUP, seconds);
104 102
105 /* write our watermark : desired time of wake up */ 103 /* write our desired time of wake up to detect power-up from RTC */
106 ascodec_write(AS3543_WAKEUP, wakeup_h); 104 ascodec_write(AS3543_WAKEUP, wakeup_h);
107 ascodec_write(AS3543_WAKEUP, wakeup_m); 105 ascodec_write(AS3543_WAKEUP, wakeup_m);
108 106
109 ascodec_write(AS3514_SYSTEM, (1<<3) | (1<<0)); // enable hearbeat watchdog 107 /* enable hearbeat watchdog */
108 ascodec_write(AS3514_SYSTEM, (1<<3) | (1<<0));
109
110 /* In_Cntr : disable hearbeat source */
111 ascodec_write_pmu(0x1a, 4, ascodec_read_pmu(0x1a, 4) & ~(3<<2));
110 112
111 while(1); 113 while(1);
112} 114}
@@ -128,7 +130,9 @@ bool rtc_check_alarm_started(bool release_alarm)
128 ascodec_read(AS3543_WAKEUP); /* bits 15:8 */ 130 ascodec_read(AS3543_WAKEUP); /* bits 15:8 */
129 if(ascodec_read(AS3543_WAKEUP) & (1<<7)) /* enable bit */ 131 if(ascodec_read(AS3543_WAKEUP) & (1<<7)) /* enable bit */
130 { 132 {
133#if 0 /* we could have a persistent setting for wake-up time */
131 alarm_enabled = true; 134 alarm_enabled = true;
135#endif
132 136
133 /* subsequent reads give the 16 bytes static SRAM */ 137 /* subsequent reads give the 16 bytes static SRAM */
134 wakeup_h = ascodec_read(AS3543_WAKEUP); 138 wakeup_h = ascodec_read(AS3543_WAKEUP);