diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-08-06 06:21:53 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-08-06 06:21:53 +0000 |
commit | 047174872ad61562fb3a9dea8e14aafc024aaf8b (patch) | |
tree | 60742a9ea324175be6320ce8ed133fc5ac712c38 | |
parent | 93c1b40b8db15b50654b45544178dc1ea8d509e8 (diff) | |
download | rockbox-047174872ad61562fb3a9dea8e14aafc024aaf8b.tar.gz rockbox-047174872ad61562fb3a9dea8e14aafc024aaf8b.zip |
rtc_read() now sends a stop condition. This hopefully fixes the stopping clock updates.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1539 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/rtc.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/firmware/drivers/rtc.c b/firmware/drivers/rtc.c index 66b37fccb7..2882c975b7 100644 --- a/firmware/drivers/rtc.c +++ b/firmware/drivers/rtc.c | |||
@@ -25,6 +25,14 @@ | |||
25 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) | 25 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) |
26 | #define RTC_DEV_READ (RTC_ADR | 0x01) | 26 | #define RTC_DEV_READ (RTC_ADR | 0x01) |
27 | 27 | ||
28 | void rtc_init(void) | ||
29 | { | ||
30 | unsigned char data; | ||
31 | data = (unsigned int)rtc_read(0x0c); | ||
32 | data &= 0xbf; | ||
33 | rtc_write(0x0c,data); | ||
34 | } | ||
35 | |||
28 | int rtc_write(unsigned char address, unsigned char value) | 36 | int rtc_write(unsigned char address, unsigned char value) |
29 | { | 37 | { |
30 | int ret = 0; | 38 | int ret = 0; |
@@ -55,7 +63,7 @@ int rtc_read(unsigned char address) | |||
55 | 63 | ||
56 | buf[0] = address; | 64 | buf[0] = address; |
57 | 65 | ||
58 | /* send run command */ | 66 | /* send read command */ |
59 | if (i2c_write(RTC_DEV_READ,buf,1) >= 0) | 67 | if (i2c_write(RTC_DEV_READ,buf,1) >= 0) |
60 | { | 68 | { |
61 | i2c_start(); | 69 | i2c_start(); |
@@ -66,6 +74,8 @@ int rtc_read(unsigned char address) | |||
66 | } | 74 | } |
67 | } | 75 | } |
68 | 76 | ||
77 | i2c_stop(); | ||
78 | |||
69 | i2c_end(); | 79 | i2c_end(); |
70 | return value; | 80 | return value; |
71 | } | 81 | } |