diff options
author | Uwe Freese <thebreaker@rockbox.org> | 2003-01-22 12:50:34 +0000 |
---|---|---|
committer | Uwe Freese <thebreaker@rockbox.org> | 2003-01-22 12:50:34 +0000 |
commit | 86352ccc3f47bc0f6bdcdcdc7b752f0836900fcd (patch) | |
tree | 6bb892fcae88e04a3a45239236cd3dde97d8d7ce | |
parent | fa2229559802f7066b55cc2ab0761c9e742658f7 (diff) | |
download | rockbox-86352ccc3f47bc0f6bdcdcdc7b752f0836900fcd.tar.gz rockbox-86352ccc3f47bc0f6bdcdcdc7b752f0836900fcd.zip |
Code for alarm mod. Enable with adding -DHAVE_ALARM_MOD in Makefile (EXTRA_DEFINES).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3150 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/alarm_menu.c | 154 | ||||
-rw-r--r-- | apps/alarm_menu.h | 24 | ||||
-rw-r--r-- | apps/lang/deutsch.lang | 80 | ||||
-rw-r--r-- | apps/lang/english.lang | 30 | ||||
-rw-r--r-- | apps/main_menu.c | 13 | ||||
-rw-r--r-- | firmware/drivers/rtc.c | 80 | ||||
-rw-r--r-- | firmware/drivers/rtc.h | 13 |
7 files changed, 388 insertions, 6 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c new file mode 100644 index 0000000000..ba16743c82 --- /dev/null +++ b/apps/alarm_menu.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2003 Uwe Freese | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "options.h" | ||
21 | |||
22 | #include "lcd.h" | ||
23 | #include "font.h" | ||
24 | #include "button.h" | ||
25 | #include "kernel.h" | ||
26 | #include "sprintf.h" | ||
27 | #include <string.h> | ||
28 | #include "settings.h" | ||
29 | #include "power.h" | ||
30 | #include "status.h" | ||
31 | #include "rtc.h" | ||
32 | #include <stdbool.h> | ||
33 | |||
34 | #include "lang.h" | ||
35 | #include "power.h" | ||
36 | #include "alarm_menu.h" | ||
37 | #include "backlight.h" | ||
38 | |||
39 | #ifdef HAVE_ALARM_MOD | ||
40 | |||
41 | bool alarm_screen(void) | ||
42 | { | ||
43 | /* get alarm time from RTC */ | ||
44 | |||
45 | int h, m, hour, minute; | ||
46 | |||
47 | rtc_get_alarm(&h, &m); | ||
48 | |||
49 | m = m / 5 * 5; /* 5 min accuracy should be enough */ | ||
50 | |||
51 | bool done=false; | ||
52 | char buf[32]; | ||
53 | |||
54 | lcd_clear_display(); | ||
55 | lcd_puts(0,1, str(LANG_ALARM_MOD_KEYS)); | ||
56 | |||
57 | while(!done) { | ||
58 | snprintf(buf, 32, str(LANG_ALARM_MOD_TIME), h, m); | ||
59 | lcd_puts(0,0, buf); | ||
60 | lcd_update(); | ||
61 | |||
62 | switch(button_get(true)) { | ||
63 | case BUTTON_PLAY: | ||
64 | /* prevent that an alarm occurs in the shutdown procedure */ | ||
65 | /* accept alarms only if they are in 2 minutes or more */ | ||
66 | hour = rtc_read(0x03); | ||
67 | hour = ((hour & 0x30) >> 4) * 10 + (hour & 0x0f); | ||
68 | minute = rtc_read(0x02); | ||
69 | minute = ((minute & 0x70) >> 4) * 10 + (minute & 0x0f); | ||
70 | int togo = (m + h * 60 - minute - hour * 60 + 1440) % 1440; | ||
71 | if (togo > 1) { | ||
72 | lcd_clear_display(); | ||
73 | snprintf(buf, 32, str(LANG_ALARM_MOD_TIME_TO_GO), togo / 60, togo % 60); | ||
74 | lcd_puts(0,0, buf); | ||
75 | lcd_update(); | ||
76 | rtc_init(); | ||
77 | rtc_set_alarm(h,m); | ||
78 | /* in some cases enabling the alarm results in an activated AF flag */ | ||
79 | /* this should not happen, but it does */ | ||
80 | /* if you know why, tell me! */ | ||
81 | /* for now, we try again forever in this case */ | ||
82 | while (rtc_enable_alarm(true)) { /* error occured */ | ||
83 | sleep(HZ / 10); | ||
84 | rtc_init(); | ||
85 | rtc_set_alarm(h,m); | ||
86 | } | ||
87 | sleep(HZ); | ||
88 | lcd_puts(0,1,str(LANG_ALARM_MOD_SHUTDOWN)); | ||
89 | lcd_update(); | ||
90 | sleep(HZ); | ||
91 | power_off(); | ||
92 | } else { | ||
93 | lcd_clear_display(); | ||
94 | lcd_puts(0,0,str(LANG_ALARM_MOD_ERROR)); | ||
95 | lcd_update(); | ||
96 | sleep(HZ); | ||
97 | lcd_clear_display(); | ||
98 | lcd_puts(0,1,str(LANG_ALARM_MOD_KEYS)); | ||
99 | } | ||
100 | break; | ||
101 | |||
102 | /* inc(m) */ | ||
103 | case BUTTON_RIGHT: | ||
104 | case BUTTON_RIGHT | BUTTON_REPEAT: | ||
105 | m += 5; | ||
106 | if (m == 60) { | ||
107 | h += 1; | ||
108 | m = 0; | ||
109 | } | ||
110 | if (h == 24) | ||
111 | h = 0; | ||
112 | break; | ||
113 | |||
114 | /* dec(m) */ | ||
115 | case BUTTON_LEFT: | ||
116 | case BUTTON_LEFT | BUTTON_REPEAT: | ||
117 | m -= 5; | ||
118 | if (m == -5) { | ||
119 | h -= 1; | ||
120 | m = 55; | ||
121 | } | ||
122 | if (h == -1) | ||
123 | h = 23; | ||
124 | break; | ||
125 | |||
126 | #ifdef HAVE_RECORDER_KEYPAD | ||
127 | /* inc(h) */ | ||
128 | case BUTTON_UP: | ||
129 | case BUTTON_UP | BUTTON_REPEAT: | ||
130 | h = (h+1) % 24; | ||
131 | break; | ||
132 | |||
133 | /* dec(h) */ | ||
134 | case BUTTON_DOWN: | ||
135 | case BUTTON_DOWN | BUTTON_REPEAT: | ||
136 | h = (h+23) % 24; | ||
137 | break; | ||
138 | #endif | ||
139 | |||
140 | #ifdef HAVE_RECORDER_KEYPAD | ||
141 | case BUTTON_OFF: | ||
142 | #else | ||
143 | case BUTTON_STOP: | ||
144 | case BUTTON_MENU: | ||
145 | #endif | ||
146 | done = true; | ||
147 | break; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | return false; | ||
152 | } | ||
153 | |||
154 | #endif /* HAVE_ALARM_MOD */ \ No newline at end of file | ||
diff --git a/apps/alarm_menu.h b/apps/alarm_menu.h new file mode 100644 index 0000000000..8ad062e419 --- /dev/null +++ b/apps/alarm_menu.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2003 Uwe Freese | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _ALARM_MENU_H | ||
20 | #define _ALARM_MENU_H | ||
21 | |||
22 | bool alarm_screen(void); | ||
23 | |||
24 | #endif | ||
diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang index e5914cff03..8607769132 100644 --- a/apps/lang/deutsch.lang +++ b/apps/lang/deutsch.lang | |||
@@ -1208,3 +1208,83 @@ id: LANG_QUEUE_TOTAL | |||
1208 | desc: number of queued tracks %d | 1208 | desc: number of queued tracks %d |
1209 | eng: "Total queued: %d" | 1209 | eng: "Total queued: %d" |
1210 | new: "Anzahl: %d" | 1210 | new: "Anzahl: %d" |
1211 | |||
1212 | id: LANG_ALARM_MOD_ALARM_MENU | ||
1213 | desc: The name of the additional entry in the main menu for the RTC alarm mod. | ||
1214 | eng: "Wake-Up Alarm" | ||
1215 | new: "Wecker" | ||
1216 | |||
1217 | id: LANG_ALARM_MOD_ERROR | ||
1218 | desc: The text that tells that the time is incorrect (for the RTC alarm mod). | ||
1219 | eng: "Alarm time is too soon!" | ||
1220 | new: "Weckzeit ist zu früh!" | ||
1221 | |||
1222 | id: LANG_ALARM_MOD_KEYS | ||
1223 | desc: Shown key functions in alarm menu (for the RTC alarm mod). | ||
1224 | eng: "PLAY=Set OFF=Cancel" | ||
1225 | new: "PLAY=OK OFF=Abbruch" | ||
1226 | |||
1227 | id: LANG_ALARM_MOD_SHUTDOWN | ||
1228 | desc: The text that tells the user that the alarm time is ok and the device shuts off (for the RTC alarm mod). | ||
1229 | eng: "Shutting down..." | ||
1230 | new: "Schalte aus..." | ||
1231 | |||
1232 | id: LANG_ALARM_MOD_TIME | ||
1233 | desc: The current alarm time shown in the alarm menu for the RTC alarm mod. | ||
1234 | eng: "Alarm time: %02d:%02d" | ||
1235 | new: "Weckzeit: %02d:%02d" | ||
1236 | |||
1237 | id: LANG_ALARM_MOD_TIME_TO_GO | ||
1238 | desc: The time until the alarm will go off shown in the alarm menu for the RTC alarm mod. | ||
1239 | eng: "Waking up in %d:%02d" | ||
1240 | new: "Einschalten in %d:%02d" | ||
1241 | |||
1242 | id: LANG_DELETE | ||
1243 | desc: The verb/action Delete | ||
1244 | eng: "Delete" | ||
1245 | new: "Löschen" | ||
1246 | |||
1247 | id: LANG_DELETED | ||
1248 | desc: A file has beed deleted | ||
1249 | eng: "Deleted" | ||
1250 | new: "Gelöscht" | ||
1251 | |||
1252 | id: LANG_FAILED | ||
1253 | desc: Something failed. To be appended after above actions | ||
1254 | eng: "failed" | ||
1255 | new: "fehlgeschlagen" | ||
1256 | |||
1257 | id: LANG_MENU_SETTING_CANCEL | ||
1258 | desc: Visual confirmation of canceling a changed setting | ||
1259 | eng: "Canceled" | ||
1260 | new: "Abgebrochen" | ||
1261 | |||
1262 | id: LANG_MENU_SETTING_OK | ||
1263 | desc: Visual confirmation of changing a setting | ||
1264 | eng: "OK" | ||
1265 | new: "OK" | ||
1266 | |||
1267 | id: LANG_PLAYER_ONPLAY_1 | ||
1268 | desc: | ||
1269 | eng: "\x81 Queue" | ||
1270 | new: "\x81 Warteschlange" | ||
1271 | |||
1272 | id: LANG_PLAYER_ONPLAY_2 | ||
1273 | desc: | ||
1274 | eng: "- Ren + Del" | ||
1275 | new: "- Umb + Ent" | ||
1276 | |||
1277 | id: LANG_QUEUE | ||
1278 | desc: The verb/action Queue | ||
1279 | eng: "Queue" | ||
1280 | new: "in Warteschlange stellen" | ||
1281 | |||
1282 | id: LANG_REALLY_DELETE | ||
1283 | desc: Really Delete? | ||
1284 | eng: "Delete?" | ||
1285 | new: "Löschen?" | ||
1286 | |||
1287 | id: LANG_RENAME | ||
1288 | desc: The verb/action Rename | ||
1289 | eng: "Rename" | ||
1290 | new: "Umbenennen" | ||
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index aa47808805..9e80f95cd2 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1286,3 +1286,33 @@ id: LANG_FAILED | |||
1286 | desc: Something failed. To be appended after above actions | 1286 | desc: Something failed. To be appended after above actions |
1287 | eng: "failed" | 1287 | eng: "failed" |
1288 | new: | 1288 | new: |
1289 | |||
1290 | id: LANG_ALARM_MOD_ALARM_MENU | ||
1291 | desc: The name of the additional entry in the main menu for the RTC alarm mod. | ||
1292 | eng: "Wake-Up Alarm" | ||
1293 | new: | ||
1294 | |||
1295 | id: LANG_ALARM_MOD_TIME | ||
1296 | desc: The current alarm time shown in the alarm menu for the RTC alarm mod. | ||
1297 | eng: "Alarm time: %02d:%02d" | ||
1298 | new: | ||
1299 | |||
1300 | id: LANG_ALARM_MOD_TIME_TO_GO | ||
1301 | desc: The time until the alarm will go off shown in the alarm menu for the RTC alarm mod. | ||
1302 | eng: "Waking up in %d:%02d" | ||
1303 | new: | ||
1304 | |||
1305 | id: LANG_ALARM_MOD_SHUTDOWN | ||
1306 | desc: The text that tells the user that the alarm time is ok and the device shuts off (for the RTC alarm mod). | ||
1307 | eng: "Shutting down..." | ||
1308 | new: | ||
1309 | |||
1310 | id: LANG_ALARM_MOD_ERROR | ||
1311 | desc: The text that tells that the time is incorrect (for the RTC alarm mod). | ||
1312 | eng: "Alarm time is too soon!" | ||
1313 | new: | ||
1314 | |||
1315 | id: LANG_ALARM_MOD_KEYS | ||
1316 | desc: Shown key functions in alarm menu (for the RTC alarm mod). | ||
1317 | eng: "PLAY=Set OFF=Cancel" | ||
1318 | new: | ||
diff --git a/apps/main_menu.c b/apps/main_menu.c index 0b51a798ab..9eb6643aef 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -47,6 +47,10 @@ | |||
47 | #include "recording.h" | 47 | #include "recording.h" |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #ifdef HAVE_ALARM_MOD | ||
51 | #include "alarm_menu.h" | ||
52 | #endif | ||
53 | |||
50 | #ifdef HAVE_LCD_BITMAP | 54 | #ifdef HAVE_LCD_BITMAP |
51 | #include "bmp.h" | 55 | #include "bmp.h" |
52 | #include "icons.h" | 56 | #include "icons.h" |
@@ -253,10 +257,13 @@ bool main_menu(void) | |||
253 | struct menu_items items[] = { | 257 | struct menu_items items[] = { |
254 | { str(LANG_SOUND_SETTINGS), sound_menu }, | 258 | { str(LANG_SOUND_SETTINGS), sound_menu }, |
255 | { str(LANG_GENERAL_SETTINGS), settings_menu }, | 259 | { str(LANG_GENERAL_SETTINGS), settings_menu }, |
256 | { str(LANG_SLEEP_TIMER), sleeptimer_screen }, | 260 | { str(LANG_SLEEP_TIMER), sleeptimer_screen }, |
261 | #ifdef HAVE_ALARM_MOD | ||
262 | { str(LANG_ALARM_MOD_ALARM_MENU), alarm_screen }, | ||
263 | #endif | ||
257 | #ifdef HAVE_MAS3587F | 264 | #ifdef HAVE_MAS3587F |
258 | { str(LANG_RECORDING_SETTINGS), recording_menu }, | 265 | { str(LANG_RECORDING_SETTINGS), recording_menu }, |
259 | { str(LANG_RECORDING), recording_screen }, | 266 | { str(LANG_RECORDING), recording_screen }, |
260 | #endif | 267 | #endif |
261 | #ifdef HAVE_LCD_BITMAP | 268 | #ifdef HAVE_LCD_BITMAP |
262 | #ifdef USE_GAMES | 269 | #ifdef USE_GAMES |
diff --git a/firmware/drivers/rtc.c b/firmware/drivers/rtc.c index d052247986..20b0b00a75 100644 --- a/firmware/drivers/rtc.c +++ b/firmware/drivers/rtc.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | 10 | * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -20,6 +20,7 @@ | |||
20 | #ifdef HAVE_RTC | 20 | #ifdef HAVE_RTC |
21 | #include "i2c.h" | 21 | #include "i2c.h" |
22 | #include "rtc.h" | 22 | #include "rtc.h" |
23 | #include <stdbool.h> | ||
23 | 24 | ||
24 | #define RTC_ADR 0xd0 | 25 | #define RTC_ADR 0xd0 |
25 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) | 26 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) |
@@ -43,8 +44,85 @@ void rtc_init(void) | |||
43 | data &= ~0x40; | 44 | data &= ~0x40; |
44 | rtc_write(0x0c,data); | 45 | rtc_write(0x0c,data); |
45 | } | 46 | } |
47 | |||
48 | #ifdef HAVE_ALARM_MOD | ||
49 | |||
50 | /* Clear Trec bit, write-protecting the RTC for 200ms when shutting off */ | ||
51 | /* without this, the alarm won't work! */ | ||
52 | |||
53 | data = rtc_read(0x04); | ||
54 | if (data & 0x80) | ||
55 | { | ||
56 | data &= ~0x80; | ||
57 | rtc_write(0x04, data); | ||
58 | } | ||
59 | |||
60 | rtc_enable_alarm(false); | ||
61 | #endif | ||
62 | } | ||
63 | |||
64 | #ifdef HAVE_ALARM_MOD | ||
65 | |||
66 | /* set alarm time registers to the given time (repeat once per day) */ | ||
67 | void rtc_set_alarm(int h, int m) | ||
68 | { | ||
69 | unsigned char data; | ||
70 | |||
71 | /* for daily alarm, RPT5=RPT4=on, RPT1=RPT2=RPT3=off */ | ||
72 | |||
73 | rtc_write(0x0e, 0x00); /* seconds 0 and RTP1 */ | ||
74 | rtc_write(0x0d, ((m / 10) << 4) | (m % 10)); /* minutes and RPT2 */ | ||
75 | rtc_write(0x0c, ((h / 10) << 4) | (h % 10)); /* hour and RPT3 */ | ||
76 | rtc_write(0x0b, 0xc1); /* set date 01 and RPT4 and RTP5 */ | ||
77 | |||
78 | /* set month to 1, if it's invalid, the rtc does an alarm every second instead */ | ||
79 | data = rtc_read(0x0a); | ||
80 | data &= 0xe0; | ||
81 | data |= 0x01; | ||
82 | rtc_write(0x0a, data); | ||
46 | } | 83 | } |
47 | 84 | ||
85 | /* read out the current alarm time */ | ||
86 | void rtc_get_alarm(int *h, int *m) | ||
87 | { | ||
88 | unsigned char data; | ||
89 | |||
90 | data = rtc_read(0x0c); | ||
91 | *h = ((data & 0x30) >> 4) * 10 + (data & 0x0f); | ||
92 | |||
93 | data = rtc_read(0x0d); | ||
94 | *m = ((data & 0x70) >> 4) * 10 + (data & 0x0f); | ||
95 | } | ||
96 | |||
97 | /* turn alarm on or off by setting the alarm flag enable */ | ||
98 | /* the alarm is automatically disabled when the RTC gets Vcc power at startup */ | ||
99 | /* avoid that an alarm occurs when the device is on because this locks the ON key forever */ | ||
100 | /* returns false if alarm was set and alarm flag (output) is off */ | ||
101 | /* returns true if alarm flag went on, which would lock the device, so the alarm was disabled again */ | ||
102 | bool rtc_enable_alarm(bool enable) | ||
103 | { | ||
104 | unsigned char data = rtc_read(0x0a); | ||
105 | if (enable) | ||
106 | { | ||
107 | data |= 0xa0; /* turn bit d7=AFE and d5=ABE on */ | ||
108 | } | ||
109 | else | ||
110 | data &= 0x5f; /* turn bit d7=AFE and d5=ABE off */ | ||
111 | rtc_write(0x0a, data); | ||
112 | |||
113 | /* check if alarm flag AF is off (as it sould be) */ | ||
114 | if ((rtc_read(0x0f) & 0x40) != 0) /* on */ | ||
115 | { | ||
116 | data &= 0x5f; /* turn bit d7=AFE and d5=ABE off */ | ||
117 | rtc_write(0x0a, data); | ||
118 | return true; | ||
119 | } else { | ||
120 | return false; /* all ok */ | ||
121 | } | ||
122 | } | ||
123 | |||
124 | #endif /* HAVE_ALARM_MOD */ | ||
125 | |||
48 | int rtc_write(unsigned char address, unsigned char value) | 126 | int rtc_write(unsigned char address, unsigned char value) |
49 | { | 127 | { |
50 | int ret = 0; | 128 | int ret = 0; |
diff --git a/firmware/drivers/rtc.h b/firmware/drivers/rtc.h index 7b101ee62e..fd1cd50274 100644 --- a/firmware/drivers/rtc.h +++ b/firmware/drivers/rtc.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | 10 | * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -19,11 +19,20 @@ | |||
19 | #ifndef _RTC_H_ | 19 | #ifndef _RTC_H_ |
20 | #define _RTC_H_ | 20 | #define _RTC_H_ |
21 | 21 | ||
22 | #include <stdbool.h> | ||
23 | |||
22 | #ifdef HAVE_RTC | 24 | #ifdef HAVE_RTC |
23 | void rtc_init(void); | 25 | void rtc_init(void); |
24 | int rtc_read(unsigned char address); | 26 | int rtc_read(unsigned char address); |
25 | int rtc_read_multiple(unsigned char address, unsigned char *buf, int numbytes); | 27 | int rtc_read_multiple(unsigned char address, unsigned char *buf, int numbytes); |
26 | int rtc_write(unsigned char address, unsigned char value); | 28 | int rtc_write(unsigned char address, unsigned char value); |
27 | #endif | 29 | |
30 | #ifdef HAVE_ALARM_MOD | ||
31 | void rtc_set_alarm(int h, int m); | ||
32 | void rtc_get_alarm(int *h, int *m); | ||
33 | bool rtc_enable_alarm(bool enable); | ||
34 | #endif /* HAVE_ALARM_MOD */ | ||
35 | |||
36 | #endif /* HAVE_RTC */ | ||
28 | 37 | ||
29 | #endif | 38 | #endif |