From 19f4c2a093698940482aad6df0bd8478a82f2a9d Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Thu, 9 Mar 2006 19:47:12 +0000 Subject: 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 --- firmware/common/timefuncs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'firmware/common') 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) { #ifndef SIMULATOR #ifdef CONFIG_RTC - static long last_tick = 0; + static long timeout = 0; - /* Don't read the RTC more than 4 times per second */ - if (last_tick + HZ < current_tick) { + /* Don't read the RTC more than once per second */ + if (current_tick > timeout) { char rtcbuf[7]; - last_tick = HZ * (current_tick / HZ); + /* Once per second, 1/10th of a second off */ + timeout = HZ * (current_tick / HZ + 1) + HZ / 5; rtc_read_datetime(rtcbuf); tm.tm_sec = ((rtcbuf[0] & 0x70) >> 4) * 10 + (rtcbuf[0] & 0x0f); -- cgit v1.2.3