summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-03-09 19:47:12 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-03-09 19:47:12 +0000
commit19f4c2a093698940482aad6df0bd8478a82f2a9d (patch)
tree66de55749bcaaf45d95b828423ffca8c715b7112 /firmware/common
parent5ecac908a2738e7a83dc0227daef3aaf16787dbc (diff)
downloadrockbox-19f4c2a093698940482aad6df0bd8478a82f2a9d.tar.gz
rockbox-19f4c2a093698940482aad6df0bd8478a82f2a9d.zip
Improve ipod i2c driver somewhat by at least taking advantage of the in-device addressing in the pcf50605, also switch to a 10bit resistive divider for the ipod battery reading, this is easily configurable if it needs changing, or even to become a user/runtime setting
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8980 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/timefuncs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c
index 275fc6c782..5cf1a35a77 100644
--- a/firmware/common/timefuncs.c
+++ b/firmware/common/timefuncs.c
@@ -47,12 +47,13 @@ struct tm *get_time(void)
47{ 47{
48#ifndef SIMULATOR 48#ifndef SIMULATOR
49#ifdef CONFIG_RTC 49#ifdef CONFIG_RTC
50 static long last_tick = 0; 50 static long timeout = 0;
51 51
52 /* Don't read the RTC more than 4 times per second */ 52 /* Don't read the RTC more than once per second */
53 if (last_tick + HZ < current_tick) { 53 if (current_tick > timeout) {
54 char rtcbuf[7]; 54 char rtcbuf[7];
55 last_tick = HZ * (current_tick / HZ); 55 /* Once per second, 1/10th of a second off */
56 timeout = HZ * (current_tick / HZ + 1) + HZ / 5;
56 rtc_read_datetime(rtcbuf); 57 rtc_read_datetime(rtcbuf);
57 58
58 tm.tm_sec = ((rtcbuf[0] & 0x70) >> 4) * 10 + (rtcbuf[0] & 0x0f); 59 tm.tm_sec = ((rtcbuf[0] & 0x70) >> 4) * 10 + (rtcbuf[0] & 0x0f);