diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2010-11-29 23:33:46 +0000 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2010-11-29 23:33:46 +0000 |
commit | d2ebc534eaba1bcda0ba50250c8c3f6cadfd4ed9 (patch) | |
tree | 46a6df7c444b30a91d7d3fe87fe76f9931afe77a /firmware/drivers | |
parent | 9929512682a999c440606cc9e4d4074a294ca616 (diff) |
RTC s35380a - fix initialization.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28711 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/rtc/rtc_s35380a.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/firmware/drivers/rtc/rtc_s35380a.c b/firmware/drivers/rtc/rtc_s35380a.c index 7a7bf81118..28b843a60a 100644 --- a/firmware/drivers/rtc/rtc_s35380a.c +++ b/firmware/drivers/rtc/rtc_s35380a.c @@ -40,15 +40,17 @@ #define CLOCK_CORR_REG 6 #define FREE_REG 7 -/* STATUS_REG1 flags */ -#define STATUS_REG1_POC 0x80 -#define STATUS_REG1_BLD 0x40 -#define STATUS_REG1_INT2 0x20 -#define STATUS_REG1_INT1 0x10 -#define STATUS_REG1_SC1 0x08 -#define STATUS_REG1_SC0 0x04 -#define STATUS_REG1_H1224 0x02 -#define STATUS_REG1_RESET 0x01 +/* STATUS_REG1 flags + * bits order is reversed + */ +#define STATUS_REG1_POC 0x01 +#define STATUS_REG1_BLD 0x02 +#define STATUS_REG1_INT2 0x04 +#define STATUS_REG1_INT1 0x08 +#define STATUS_REG1_SC1 0x10 +#define STATUS_REG1_SC0 0x20 +#define STATUS_REG1_H1224 0x40 +#define STATUS_REG1_RESET 0x80 static void reverse_bits(unsigned char* v, int size) @@ -76,6 +78,10 @@ void rtc_init(void) status_reg |= STATUS_REG1_RESET; i2c_write(I2C_IFACE_1, RTC_ADDR | (STATUS_REG1<<1), &status_reg, 1); } + + /* setup 24h time format */ + status_reg = STATUS_REG1_H1224; + i2c_write(I2C_IFACE_1, RTC_ADDR | (STATUS_REG1<<1), &status_reg, 1); } int rtc_read_datetime(struct tm *tm) |