forked from len0rd/rockbox
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
This commit is contained in:
parent
93c1b40b8d
commit
047174872a
1 changed files with 11 additions and 1 deletions
|
|
@ -25,6 +25,14 @@
|
|||
#define RTC_DEV_WRITE (RTC_ADR | 0x00)
|
||||
#define RTC_DEV_READ (RTC_ADR | 0x01)
|
||||
|
||||
void rtc_init(void)
|
||||
{
|
||||
unsigned char data;
|
||||
data = (unsigned int)rtc_read(0x0c);
|
||||
data &= 0xbf;
|
||||
rtc_write(0x0c,data);
|
||||
}
|
||||
|
||||
int rtc_write(unsigned char address, unsigned char value)
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
@ -55,7 +63,7 @@ int rtc_read(unsigned char address)
|
|||
|
||||
buf[0] = address;
|
||||
|
||||
/* send run command */
|
||||
/* send read command */
|
||||
if (i2c_write(RTC_DEV_READ,buf,1) >= 0)
|
||||
{
|
||||
i2c_start();
|
||||
|
|
@ -66,6 +74,8 @@ int rtc_read(unsigned char address)
|
|||
}
|
||||
}
|
||||
|
||||
i2c_stop();
|
||||
|
||||
i2c_end();
|
||||
return value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue