summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobert Kukla <roolku@rockbox.org>2007-02-28 13:20:36 +0000
committerRobert Kukla <roolku@rockbox.org>2007-02-28 13:20:36 +0000
commit50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324 (patch)
treed5197ea90c5dcfa574b84743ecbbd7fa2a754e55 /apps
parent343c428f2cf97c82540aecf07d154e43ff40e79a (diff)
downloadrockbox-50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324.zip
rockbox-50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324.tar.gz
rockbox-50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324.tar.bz2
rockbox-50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324.tar.xz
FS#6419 - driver for H1x0 series RTC Mod with runtime detection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12520 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/gwps-common.c7
-rw-r--r--apps/gui/statusbar.c9
-rw-r--r--apps/menus/settings_menu.c30
-rw-r--r--apps/misc.c7
-rw-r--r--apps/plugins/clock.c2
-rw-r--r--apps/recorder/recording.c9
-rw-r--r--apps/scrobbler.c6
7 files changed, 67 insertions, 3 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 70f5565..8fa80c7 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -23,7 +23,9 @@
#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"
@@ -972,6 +974,11 @@ 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 fbd8943..a36ae15 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -28,6 +28,9 @@
#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 */
@@ -239,6 +242,9 @@ 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;
@@ -324,6 +330,9 @@ 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 508f721..818271b 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -38,6 +38,12 @@
#ifdef HAVE_ALARM_MOD
#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 */
@@ -206,7 +212,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), 0, NOICON, &time_set, &timeformat);
+MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), rtc_detect_callback, NOICON, &time_set, &timeformat);
#endif
/* System menu */
@@ -246,7 +252,7 @@ MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer,
setting to the user */
#ifdef HAVE_ALARM_MOD
MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
- (menu_function)alarm_screen, NULL, NOICON);
+ (menu_function)alarm_screen, rtc_detect_callback, NOICON);
#endif
/* Limits menu */
@@ -383,3 +389,23 @@ 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 22f6fb5..339bc1d 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -60,6 +60,7 @@
#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"
@@ -414,6 +415,12 @@ 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/plugins/clock.c b/apps/plugins/clock.c
index 7e52e2b..010e293 100644
--- a/apps/plugins/clock.c
+++ b/apps/plugins/clock.c
@@ -277,7 +277,7 @@ extern const fb_data clock_timesup[];
#define EXIT_BUTTON BUTTON_MENU
#define MODE_NEXT_BUTTON BUTTON_RIGHT
#define MODE_PREV_BUTTON BUTTON_LEFT
-#elif (CONFIG_KEYPAD == IRIVER_H300_PAD)
+#elif (CONFIG_KEYPAD == IRIVER_H300_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD)
#define COUNTER_TOGGLE_BUTTON (BUTTON_ON|BUTTON_REL)
#define COUNTER_RESET_BUTTON (BUTTON_ON|BUTTON_REPEAT)
#define MENU_BUTTON BUTTON_SELECT
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 8eea24d..2c5fc32 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -68,6 +68,9 @@
#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;
@@ -521,6 +524,12 @@ 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 a339429..1c0d98c 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -35,6 +35,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging
#ifdef CONFIG_RTC
#include "time.h"
#include "timefuncs.h"
+#include "rtc.h"
#endif
#include "scrobbler.h"
@@ -208,6 +209,11 @@ 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;