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 @@ #include <stdlib.h> #include "system.h" #include "settings.h" -#ifdef CONFIG_RTC #include "rtc.h" -#endif #include "audio.h" #include "status.h" #include "power.h" @@ -974,11 +972,6 @@ static char* get_tag(struct wps_data* wps_data, #ifdef CONFIG_RTC case 'c': /* Real Time Clock display */ *flags |= WPS_REFRESH_DYNAMIC; -#if CONFIG_RTC == RTC_DS1339_DS3231 - if(!rtc_detected) - return NULL; - else -#endif { int value; 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 @@ #include "powermgmt.h" #include "usb.h" #include "led.h" -#ifdef CONFIG_RTC -#include "rtc.h" -#endif #include "status.h" /* needed for battery_state global var */ #include "action.h" /* for keys_locked */ @@ -242,9 +239,6 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) bar->info.led = led_read(HZ/2); /* delay should match polling interval */ #endif #ifdef CONFIG_RTC -#if CONFIG_RTC == RTC_DS1339_DS3231 - if(rtc_detected) -#endif { struct tm* tm = get_time(); bar->info.hour = tm->tm_hour; @@ -330,9 +324,6 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) gui_statusbar_icon_lock_remote(display); #endif #ifdef CONFIG_RTC -#if CONFIG_RTC == RTC_DS1339_DS3231 - if(rtc_detected) -#endif gui_statusbar_time(display, bar->info.hour, bar->info.minute); #endif /* CONFIG_RTC */ #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 @@ #ifdef HAVE_RTC_ALARM #include "alarm_menu.h" #endif -#ifdef CONFIG_RTC -#include "rtc.h" -#endif - -/* callback to display rtc menus dynamically */ -int rtc_detect_callback(int action,const struct menu_item_ex *this_item); /***********************************/ /* TAGCACHE MENU */ @@ -208,7 +202,7 @@ static int timedate_set(void) MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL, NOICON); MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL); -MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), rtc_detect_callback, NOICON, &time_set, &timeformat); +MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, NOICON, &time_set, &timeformat); #endif /* System menu */ @@ -216,7 +210,7 @@ MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL); #ifdef HAVE_RTC_ALARM MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU), - (menu_function)alarm_screen, rtc_detect_callback, NOICON); + (menu_function)alarm_screen, NULL, NOICON); #endif /* Limits menu */ @@ -358,23 +352,3 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0, &bookmark_settings_menu, &browse_langs, &voice_settings_menu ); /* SETTINGS MENU */ /***********************************/ - -/* callback to display rtc menus dynamically */ -int rtc_detect_callback(int action,const struct menu_item_ex *this_item) -{ - if (action != ACTION_REQUEST_MENUITEM) - return action; - -#if defined(CONFIG_RTC) && CONFIG_RTC == RTC_DS1339_DS3231 - if ((this_item == &time_menu) || - (this_item == &alarm_screen_call)) - { - if (!rtc_detected) - return ACTION_EXIT_MENUITEM; - } -#else - (void)this_item; -#endif - - return action; -} 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 @@ #include "gui/gwps-common.h" #include "misc.h" -#include "rtc.h" /* Format a large-range value for output, using the appropriate unit so that * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" @@ -415,12 +414,6 @@ void screen_dump(void) #endif #ifdef CONFIG_RTC -#if CONFIG_RTC == RTC_DS1339_DS3231 - if(!rtc_detected) - create_numbered_filename(filename, "", "dump_", ".bmp", 4 - IF_CNFN_NUM_(, NULL)); - else -#endif create_datetime_filename(filename, "", "dump ", ".bmp", false); #else 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 @@ #include "screen_access.h" #include "action.h" #include "radio.h" -#ifdef CONFIG_RTC -#include "rtc.h" -#endif #ifdef HAVE_RECORDING static bool in_screen = false; @@ -524,12 +521,6 @@ char *rec_create_filename(char *buffer) #ifdef CONFIG_RTC /* We'll wait at least up to the start of the next second so no duplicate names are created */ -#if CONFIG_RTC == RTC_DS1339_DS3231 - if(!rtc_detected) - return create_numbered_filename(buffer, buffer, "rec_", ext, 4 - IF_CNFN_NUM_(, &file_number)); - else -#endif return create_datetime_filename(buffer, buffer, "R", ext, true); #else 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 #ifdef CONFIG_RTC #include "time.h" #include "timefuncs.h" -#include "rtc.h" #endif #include "scrobbler.h" @@ -209,11 +208,6 @@ void scrobbler_change_event(struct mp3entry *id) logf("SCROBBLER: add pending"); copy_mp3entry(&scrobbler_entry, id); #ifdef CONFIG_RTC -#if CONFIG_RTC == RTC_DS1339_DS3231 - if(!rtc_detected) - timestamp = 0; - else -#endif timestamp = mktime(get_time()); #else 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) #ifdef CONFIG_RTC static long timeout = 0; -#if CONFIG_RTC == RTC_DS1339_DS3231 - if(!rtc_detected) { - tm.tm_sec = 0; - tm.tm_min = 0; - tm.tm_hour = 0; - tm.tm_mday = 1; - tm.tm_mon = 0; - tm.tm_year = 70; - tm.tm_wday = 1; - tm.tm_yday = 0; /* Not implemented for now */ - tm.tm_isdst = -1; /* Not implemented for now */ - } else -#endif /* Don't read the RTC more than once per second */ if (current_tick > timeout) { 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 @@ #include "rbunicode.h" #include "logf.h" #include "atoi.h" -#ifdef CONFIG_RTC -#include "rtc.h" -#endif #define BYTES2INT16(array,pos) \ (array[pos] | (array[pos+1] << 8 )) @@ -948,10 +945,6 @@ static void fat_time(unsigned short* date, { #ifdef CONFIG_RTC struct tm* tm = get_time(); -#if CONFIG_RTC == RTC_DS1339_DS3231 - if(rtc_detected) - { -#endif /* CONFIG_RTC == RTC_DS1339_DS3231 */ if (date) *date = ((tm->tm_year - 80) << 9) | @@ -965,14 +958,7 @@ static void fat_time(unsigned short* date, if (tenth) *tenth = (tm->tm_sec & 1) * 100; - -#if CONFIG_RTC == RTC_DS1339_DS3231 - } - else -#endif /* CONFIG_RTC == RTC_DS1339_DS3231 */ -#endif /* CONFIG_RTC */ -#if !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231 - { +#else /* non-RTC version returns an increment from the supplied time, or a * fixed standard time/date if no time given as input */ bool next_day = false; @@ -1039,9 +1025,9 @@ static void fat_time(unsigned short* date, } if (tenth) *tenth = 0; - } -#endif /* !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231 */ +#endif /* CONFIG_RTC */ } + static int write_long_name(struct fat_file* file, unsigned int firstentry, 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 @@ #define RTC_ADDR 0xD0 -bool rtc_detected = false; - void rtc_init(void) { - char byte; - sw_i2c_init(); - /* read one byte from RTC; 0 on success */ - rtc_detected = !sw_i2c_read(RTC_ADDR, 0, &byte, 1); - #ifdef HAVE_RTC_ALARM /* Check + save alarm bit first, before the power thread starts watching */ rtc_check_alarm_started(false); @@ -72,7 +65,8 @@ bool rtc_check_alarm_flag(void) sw_i2c_read(RTC_ADDR, 0x0f, buf, 1); if (buf[0] & 0x02) flag = true; - rtc_enable_alarm(false); + buf[0] = 0x00; + sw_i2c_write(RTC_ADDR, 0x0f, buf, 1); return flag; } @@ -109,7 +103,7 @@ bool rtc_enable_alarm(bool enable) { unsigned char buf[2]; - buf[0] = enable ? 0x26 : 0x04; /* BBSQI INTCN A2IE vs INTCH only */ + buf[0] = enable ? 0x26 : 0x24; /* BBSQI INTCN A2IE vs INTCH only */ buf[1] = 0x00; /* reset alarm flags (and OSF for good measure) */ 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 @@ /* Define this if you do software codec */ #define CONFIG_CODEC SWCODEC -/* Set to 1 if you want to build with RTC support */ -#if 0 -#ifndef SIMULATOR -/* RTC is autodetected on target only */ -#define CONFIG_RTC RTC_DS1339_DS3231 -#define HAVE_RTC_ALARM -#endif -#endif - - /* Define this if you have an remote lcd */ +/* Define this if you have an remote lcd */ #define HAVE_REMOTE_LCD #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 @@ #define _RTC_H_ #include <stdbool.h> -#include <system.h> +#include "system.h" +#include "config.h" #ifdef CONFIG_RTC @@ -28,10 +29,6 @@ extern const int dayname[]; extern const int monthname[]; -#if CONFIG_RTC == RTC_DS1339_DS3231 -extern bool rtc_detected; -#endif - /* Common functions for all targets */ void rtc_init(void); int rtc_read_datetime(unsigned char* buf); |