From d2ebc534eaba1bcda0ba50250c8c3f6cadfd4ed9 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Mon, 29 Nov 2010 23:33:46 +0000 Subject: RTC s35380a - fix initialization. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28711 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/rtc/rtc_s35380a.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'firmware/drivers') 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) -- cgit v1.2.3