diff options
-rw-r--r-- | apps/gui/gwps-common.c | 7 | ||||
-rw-r--r-- | apps/gui/statusbar.c | 9 | ||||
-rw-r--r-- | apps/menus/settings_menu.c | 30 | ||||
-rw-r--r-- | apps/misc.c | 7 | ||||
-rw-r--r-- | apps/recorder/recording.c | 9 | ||||
-rw-r--r-- | apps/scrobbler.c | 6 | ||||
-rw-r--r-- | firmware/common/timefuncs.c | 13 | ||||
-rw-r--r-- | firmware/drivers/fat.c | 20 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_ds1339_ds3231.c | 12 | ||||
-rw-r--r-- | firmware/export/config-h120.h | 11 | ||||
-rw-r--r-- | firmware/export/rtc.h | 7 |
11 files changed, 11 insertions, 120 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index d59ac130fc..b321d3b133 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -23,9 +23,7 @@ | |||
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "settings.h" | 25 | #include "settings.h" |
26 | #ifdef CONFIG_RTC | ||
27 | #include "rtc.h" | 26 | #include "rtc.h" |
28 | #endif | ||
29 | #include "audio.h" | 27 | #include "audio.h" |
30 | #include "status.h" | 28 | #include "status.h" |
31 | #include "power.h" | 29 | #include "power.h" |
@@ -974,11 +972,6 @@ static char* get_tag(struct wps_data* wps_data, | |||
974 | #ifdef CONFIG_RTC | 972 | #ifdef CONFIG_RTC |
975 | case 'c': /* Real Time Clock display */ | 973 | case 'c': /* Real Time Clock display */ |
976 | *flags |= WPS_REFRESH_DYNAMIC; | 974 | *flags |= WPS_REFRESH_DYNAMIC; |
977 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
978 | if(!rtc_detected) | ||
979 | return NULL; | ||
980 | else | ||
981 | #endif | ||
982 | { | 975 | { |
983 | int value; | 976 | int value; |
984 | char *format = 0; | 977 | char *format = 0; |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index a36ae15974..fbd8943315 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -28,9 +28,6 @@ | |||
28 | #include "powermgmt.h" | 28 | #include "powermgmt.h" |
29 | #include "usb.h" | 29 | #include "usb.h" |
30 | #include "led.h" | 30 | #include "led.h" |
31 | #ifdef CONFIG_RTC | ||
32 | #include "rtc.h" | ||
33 | #endif | ||
34 | 31 | ||
35 | #include "status.h" /* needed for battery_state global var */ | 32 | #include "status.h" /* needed for battery_state global var */ |
36 | #include "action.h" /* for keys_locked */ | 33 | #include "action.h" /* for keys_locked */ |
@@ -242,9 +239,6 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
242 | bar->info.led = led_read(HZ/2); /* delay should match polling interval */ | 239 | bar->info.led = led_read(HZ/2); /* delay should match polling interval */ |
243 | #endif | 240 | #endif |
244 | #ifdef CONFIG_RTC | 241 | #ifdef CONFIG_RTC |
245 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
246 | if(rtc_detected) | ||
247 | #endif | ||
248 | { | 242 | { |
249 | struct tm* tm = get_time(); | 243 | struct tm* tm = get_time(); |
250 | bar->info.hour = tm->tm_hour; | 244 | bar->info.hour = tm->tm_hour; |
@@ -330,9 +324,6 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
330 | gui_statusbar_icon_lock_remote(display); | 324 | gui_statusbar_icon_lock_remote(display); |
331 | #endif | 325 | #endif |
332 | #ifdef CONFIG_RTC | 326 | #ifdef CONFIG_RTC |
333 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
334 | if(rtc_detected) | ||
335 | #endif | ||
336 | gui_statusbar_time(display, bar->info.hour, bar->info.minute); | 327 | gui_statusbar_time(display, bar->info.hour, bar->info.minute); |
337 | #endif /* CONFIG_RTC */ | 328 | #endif /* CONFIG_RTC */ |
338 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | 329 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) |
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 050bf88d82..8caa5fd8b0 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c | |||
@@ -38,12 +38,6 @@ | |||
38 | #ifdef HAVE_RTC_ALARM | 38 | #ifdef HAVE_RTC_ALARM |
39 | #include "alarm_menu.h" | 39 | #include "alarm_menu.h" |
40 | #endif | 40 | #endif |
41 | #ifdef CONFIG_RTC | ||
42 | #include "rtc.h" | ||
43 | #endif | ||
44 | |||
45 | /* callback to display rtc menus dynamically */ | ||
46 | int rtc_detect_callback(int action,const struct menu_item_ex *this_item); | ||
47 | 41 | ||
48 | /***********************************/ | 42 | /***********************************/ |
49 | /* TAGCACHE MENU */ | 43 | /* TAGCACHE MENU */ |
@@ -208,7 +202,7 @@ static int timedate_set(void) | |||
208 | 202 | ||
209 | MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL, NOICON); | 203 | MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL, NOICON); |
210 | MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL); | 204 | MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL); |
211 | MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), rtc_detect_callback, NOICON, &time_set, &timeformat); | 205 | MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, NOICON, &time_set, &timeformat); |
212 | #endif | 206 | #endif |
213 | 207 | ||
214 | /* System menu */ | 208 | /* System menu */ |
@@ -216,7 +210,7 @@ MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL); | |||
216 | 210 | ||
217 | #ifdef HAVE_RTC_ALARM | 211 | #ifdef HAVE_RTC_ALARM |
218 | MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU), | 212 | MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU), |
219 | (menu_function)alarm_screen, rtc_detect_callback, NOICON); | 213 | (menu_function)alarm_screen, NULL, NOICON); |
220 | #endif | 214 | #endif |
221 | 215 | ||
222 | /* Limits menu */ | 216 | /* Limits menu */ |
@@ -358,23 +352,3 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0, | |||
358 | &bookmark_settings_menu, &browse_langs, &voice_settings_menu ); | 352 | &bookmark_settings_menu, &browse_langs, &voice_settings_menu ); |
359 | /* SETTINGS MENU */ | 353 | /* SETTINGS MENU */ |
360 | /***********************************/ | 354 | /***********************************/ |
361 | |||
362 | /* callback to display rtc menus dynamically */ | ||
363 | int rtc_detect_callback(int action,const struct menu_item_ex *this_item) | ||
364 | { | ||
365 | if (action != ACTION_REQUEST_MENUITEM) | ||
366 | return action; | ||
367 | |||
368 | #if defined(CONFIG_RTC) && CONFIG_RTC == RTC_DS1339_DS3231 | ||
369 | if ((this_item == &time_menu) || | ||
370 | (this_item == &alarm_screen_call)) | ||
371 | { | ||
372 | if (!rtc_detected) | ||
373 | return ACTION_EXIT_MENUITEM; | ||
374 | } | ||
375 | #else | ||
376 | (void)this_item; | ||
377 | #endif | ||
378 | |||
379 | return action; | ||
380 | } | ||
diff --git a/apps/misc.c b/apps/misc.c index 339bc1d0b7..22f6fb50a6 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -60,7 +60,6 @@ | |||
60 | #include "gui/gwps-common.h" | 60 | #include "gui/gwps-common.h" |
61 | 61 | ||
62 | #include "misc.h" | 62 | #include "misc.h" |
63 | #include "rtc.h" | ||
64 | 63 | ||
65 | /* Format a large-range value for output, using the appropriate unit so that | 64 | /* Format a large-range value for output, using the appropriate unit so that |
66 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" | 65 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" |
@@ -415,12 +414,6 @@ void screen_dump(void) | |||
415 | #endif | 414 | #endif |
416 | 415 | ||
417 | #ifdef CONFIG_RTC | 416 | #ifdef CONFIG_RTC |
418 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
419 | if(!rtc_detected) | ||
420 | create_numbered_filename(filename, "", "dump_", ".bmp", 4 | ||
421 | IF_CNFN_NUM_(, NULL)); | ||
422 | else | ||
423 | #endif | ||
424 | create_datetime_filename(filename, "", "dump ", ".bmp", false); | 417 | create_datetime_filename(filename, "", "dump ", ".bmp", false); |
425 | #else | 418 | #else |
426 | create_numbered_filename(filename, "", "dump_", ".bmp", 4 | 419 | create_numbered_filename(filename, "", "dump_", ".bmp", 4 |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 2c5fc32b28..8eea24d82d 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -68,9 +68,6 @@ | |||
68 | #include "screen_access.h" | 68 | #include "screen_access.h" |
69 | #include "action.h" | 69 | #include "action.h" |
70 | #include "radio.h" | 70 | #include "radio.h" |
71 | #ifdef CONFIG_RTC | ||
72 | #include "rtc.h" | ||
73 | #endif | ||
74 | #ifdef HAVE_RECORDING | 71 | #ifdef HAVE_RECORDING |
75 | 72 | ||
76 | static bool in_screen = false; | 73 | static bool in_screen = false; |
@@ -524,12 +521,6 @@ char *rec_create_filename(char *buffer) | |||
524 | #ifdef CONFIG_RTC | 521 | #ifdef CONFIG_RTC |
525 | /* We'll wait at least up to the start of the next second so no duplicate | 522 | /* We'll wait at least up to the start of the next second so no duplicate |
526 | names are created */ | 523 | names are created */ |
527 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
528 | if(!rtc_detected) | ||
529 | return create_numbered_filename(buffer, buffer, "rec_", ext, 4 | ||
530 | IF_CNFN_NUM_(, &file_number)); | ||
531 | else | ||
532 | #endif | ||
533 | return create_datetime_filename(buffer, buffer, "R", ext, true); | 524 | return create_datetime_filename(buffer, buffer, "R", ext, true); |
534 | #else | 525 | #else |
535 | return create_numbered_filename(buffer, buffer, "rec_", ext, 4 | 526 | return create_numbered_filename(buffer, buffer, "rec_", ext, 4 |
diff --git a/apps/scrobbler.c b/apps/scrobbler.c index 1c0d98cbc6..a339429cab 100644 --- a/apps/scrobbler.c +++ b/apps/scrobbler.c | |||
@@ -35,7 +35,6 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging | |||
35 | #ifdef CONFIG_RTC | 35 | #ifdef CONFIG_RTC |
36 | #include "time.h" | 36 | #include "time.h" |
37 | #include "timefuncs.h" | 37 | #include "timefuncs.h" |
38 | #include "rtc.h" | ||
39 | #endif | 38 | #endif |
40 | 39 | ||
41 | #include "scrobbler.h" | 40 | #include "scrobbler.h" |
@@ -209,11 +208,6 @@ void scrobbler_change_event(struct mp3entry *id) | |||
209 | logf("SCROBBLER: add pending"); | 208 | logf("SCROBBLER: add pending"); |
210 | copy_mp3entry(&scrobbler_entry, id); | 209 | copy_mp3entry(&scrobbler_entry, id); |
211 | #ifdef CONFIG_RTC | 210 | #ifdef CONFIG_RTC |
212 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
213 | if(!rtc_detected) | ||
214 | timestamp = 0; | ||
215 | else | ||
216 | #endif | ||
217 | timestamp = mktime(get_time()); | 211 | timestamp = mktime(get_time()); |
218 | #else | 212 | #else |
219 | timestamp = 0; | 213 | timestamp = 0; |
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c index 881bc23e53..e48aadd0a2 100644 --- a/firmware/common/timefuncs.c +++ b/firmware/common/timefuncs.c | |||
@@ -49,19 +49,6 @@ struct tm *get_time(void) | |||
49 | #ifdef CONFIG_RTC | 49 | #ifdef CONFIG_RTC |
50 | static long timeout = 0; | 50 | static long timeout = 0; |
51 | 51 | ||
52 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
53 | if(!rtc_detected) { | ||
54 | tm.tm_sec = 0; | ||
55 | tm.tm_min = 0; | ||
56 | tm.tm_hour = 0; | ||
57 | tm.tm_mday = 1; | ||
58 | tm.tm_mon = 0; | ||
59 | tm.tm_year = 70; | ||
60 | tm.tm_wday = 1; | ||
61 | tm.tm_yday = 0; /* Not implemented for now */ | ||
62 | tm.tm_isdst = -1; /* Not implemented for now */ | ||
63 | } else | ||
64 | #endif | ||
65 | /* Don't read the RTC more than once per second */ | 52 | /* Don't read the RTC more than once per second */ |
66 | if (current_tick > timeout) { | 53 | if (current_tick > timeout) { |
67 | char rtcbuf[7]; | 54 | char rtcbuf[7]; |
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index e4e77627d0..e3e1a755cb 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -31,9 +31,6 @@ | |||
31 | #include "rbunicode.h" | 31 | #include "rbunicode.h" |
32 | #include "logf.h" | 32 | #include "logf.h" |
33 | #include "atoi.h" | 33 | #include "atoi.h" |
34 | #ifdef CONFIG_RTC | ||
35 | #include "rtc.h" | ||
36 | #endif | ||
37 | 34 | ||
38 | #define BYTES2INT16(array,pos) \ | 35 | #define BYTES2INT16(array,pos) \ |
39 | (array[pos] | (array[pos+1] << 8 )) | 36 | (array[pos] | (array[pos+1] << 8 )) |
@@ -948,10 +945,6 @@ static void fat_time(unsigned short* date, | |||
948 | { | 945 | { |
949 | #ifdef CONFIG_RTC | 946 | #ifdef CONFIG_RTC |
950 | struct tm* tm = get_time(); | 947 | struct tm* tm = get_time(); |
951 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
952 | if(rtc_detected) | ||
953 | { | ||
954 | #endif /* CONFIG_RTC == RTC_DS1339_DS3231 */ | ||
955 | 948 | ||
956 | if (date) | 949 | if (date) |
957 | *date = ((tm->tm_year - 80) << 9) | | 950 | *date = ((tm->tm_year - 80) << 9) | |
@@ -965,14 +958,7 @@ static void fat_time(unsigned short* date, | |||
965 | 958 | ||
966 | if (tenth) | 959 | if (tenth) |
967 | *tenth = (tm->tm_sec & 1) * 100; | 960 | *tenth = (tm->tm_sec & 1) * 100; |
968 | 961 | #else | |
969 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
970 | } | ||
971 | else | ||
972 | #endif /* CONFIG_RTC == RTC_DS1339_DS3231 */ | ||
973 | #endif /* CONFIG_RTC */ | ||
974 | #if !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231 | ||
975 | { | ||
976 | /* non-RTC version returns an increment from the supplied time, or a | 962 | /* non-RTC version returns an increment from the supplied time, or a |
977 | * fixed standard time/date if no time given as input */ | 963 | * fixed standard time/date if no time given as input */ |
978 | bool next_day = false; | 964 | bool next_day = false; |
@@ -1039,9 +1025,9 @@ static void fat_time(unsigned short* date, | |||
1039 | } | 1025 | } |
1040 | if (tenth) | 1026 | if (tenth) |
1041 | *tenth = 0; | 1027 | *tenth = 0; |
1042 | } | 1028 | #endif /* CONFIG_RTC */ |
1043 | #endif /* !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231 */ | ||
1044 | } | 1029 | } |
1030 | |||
1045 | static int write_long_name(struct fat_file* file, | 1031 | static int write_long_name(struct fat_file* file, |
1046 | unsigned int firstentry, | 1032 | unsigned int firstentry, |
1047 | unsigned int numentries, | 1033 | unsigned int numentries, |
diff --git a/firmware/drivers/rtc/rtc_ds1339_ds3231.c b/firmware/drivers/rtc/rtc_ds1339_ds3231.c index 7396c2e0a1..e343c96169 100644 --- a/firmware/drivers/rtc/rtc_ds1339_ds3231.c +++ b/firmware/drivers/rtc/rtc_ds1339_ds3231.c | |||
@@ -22,17 +22,10 @@ | |||
22 | 22 | ||
23 | #define RTC_ADDR 0xD0 | 23 | #define RTC_ADDR 0xD0 |
24 | 24 | ||
25 | bool rtc_detected = false; | ||
26 | |||
27 | void rtc_init(void) | 25 | void rtc_init(void) |
28 | { | 26 | { |
29 | char byte; | ||
30 | |||
31 | sw_i2c_init(); | 27 | sw_i2c_init(); |
32 | 28 | ||
33 | /* read one byte from RTC; 0 on success */ | ||
34 | rtc_detected = !sw_i2c_read(RTC_ADDR, 0, &byte, 1); | ||
35 | |||
36 | #ifdef HAVE_RTC_ALARM | 29 | #ifdef HAVE_RTC_ALARM |
37 | /* Check + save alarm bit first, before the power thread starts watching */ | 30 | /* Check + save alarm bit first, before the power thread starts watching */ |
38 | rtc_check_alarm_started(false); | 31 | rtc_check_alarm_started(false); |
@@ -72,7 +65,8 @@ bool rtc_check_alarm_flag(void) | |||
72 | sw_i2c_read(RTC_ADDR, 0x0f, buf, 1); | 65 | sw_i2c_read(RTC_ADDR, 0x0f, buf, 1); |
73 | if (buf[0] & 0x02) flag = true; | 66 | if (buf[0] & 0x02) flag = true; |
74 | 67 | ||
75 | rtc_enable_alarm(false); | 68 | buf[0] = 0x00; |
69 | sw_i2c_write(RTC_ADDR, 0x0f, buf, 1); | ||
76 | 70 | ||
77 | return flag; | 71 | return flag; |
78 | } | 72 | } |
@@ -109,7 +103,7 @@ bool rtc_enable_alarm(bool enable) | |||
109 | { | 103 | { |
110 | unsigned char buf[2]; | 104 | unsigned char buf[2]; |
111 | 105 | ||
112 | buf[0] = enable ? 0x26 : 0x04; /* BBSQI INTCN A2IE vs INTCH only */ | 106 | buf[0] = enable ? 0x26 : 0x24; /* BBSQI INTCN A2IE vs INTCH only */ |
113 | buf[1] = 0x00; /* reset alarm flags (and OSF for good measure) */ | 107 | buf[1] = 0x00; /* reset alarm flags (and OSF for good measure) */ |
114 | 108 | ||
115 | sw_i2c_write(RTC_ADDR, 0x0e, buf, 2); | 109 | sw_i2c_write(RTC_ADDR, 0x0e, buf, 2); |
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index 1791bdf78b..e7fb73ea0f 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h | |||
@@ -45,16 +45,7 @@ | |||
45 | /* Define this if you do software codec */ | 45 | /* Define this if you do software codec */ |
46 | #define CONFIG_CODEC SWCODEC | 46 | #define CONFIG_CODEC SWCODEC |
47 | 47 | ||
48 | /* Set to 1 if you want to build with RTC support */ | 48 | /* Define this if you have an remote lcd */ |
49 | #if 0 | ||
50 | #ifndef SIMULATOR | ||
51 | /* RTC is autodetected on target only */ | ||
52 | #define CONFIG_RTC RTC_DS1339_DS3231 | ||
53 | #define HAVE_RTC_ALARM | ||
54 | #endif | ||
55 | #endif | ||
56 | |||
57 | /* Define this if you have an remote lcd */ | ||
58 | #define HAVE_REMOTE_LCD | 49 | #define HAVE_REMOTE_LCD |
59 | 50 | ||
60 | #define CONFIG_LCD LCD_S1D15E06 | 51 | #define CONFIG_LCD LCD_S1D15E06 |
diff --git a/firmware/export/rtc.h b/firmware/export/rtc.h index 1b0d215371..eea83d85bb 100644 --- a/firmware/export/rtc.h +++ b/firmware/export/rtc.h | |||
@@ -20,7 +20,8 @@ | |||
20 | #define _RTC_H_ | 20 | #define _RTC_H_ |
21 | 21 | ||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include <system.h> | 23 | #include "system.h" |
24 | #include "config.h" | ||
24 | 25 | ||
25 | #ifdef CONFIG_RTC | 26 | #ifdef CONFIG_RTC |
26 | 27 | ||
@@ -28,10 +29,6 @@ extern const int dayname[]; | |||
28 | 29 | ||
29 | extern const int monthname[]; | 30 | extern const int monthname[]; |
30 | 31 | ||
31 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
32 | extern bool rtc_detected; | ||
33 | #endif | ||
34 | |||
35 | /* Common functions for all targets */ | 32 | /* Common functions for all targets */ |
36 | void rtc_init(void); | 33 | void rtc_init(void); |
37 | int rtc_read_datetime(unsigned char* buf); | 34 | int rtc_read_datetime(unsigned char* buf); |