diff options
Diffstat (limited to 'firmware/drivers/rtc')
-rw-r--r-- | firmware/drivers/rtc/rtc_as3514.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c index 65d8359e08..878f204a4e 100644 --- a/firmware/drivers/rtc/rtc_as3514.c +++ b/firmware/drivers/rtc/rtc_as3514.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "rtc.h" | 22 | #include "rtc.h" |
23 | #include "i2c-pp.h" | 23 | #include "i2c-pp.h" |
24 | #include "as3514.h" | 24 | #include "as3514.h" |
25 | #include "ascodec.h" | ||
25 | 26 | ||
26 | #define MINUTE_SECONDS 60 | 27 | #define MINUTE_SECONDS 60 |
27 | #define HOUR_SECONDS 3600 | 28 | #define HOUR_SECONDS 3600 |
@@ -57,7 +58,7 @@ int rtc_read_datetime(unsigned char* buf) | |||
57 | 58 | ||
58 | /* RTC_AS3514's slave address is 0x46*/ | 59 | /* RTC_AS3514's slave address is 0x46*/ |
59 | for (i=0;i<4;i++){ | 60 | for (i=0;i<4;i++){ |
60 | tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, AS3514_RTC_0 + i); | 61 | tmp[i] = ascodec_read(AS3514_RTC_0 + i); |
61 | } | 62 | } |
62 | seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24); | 63 | seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24); |
63 | 64 | ||
@@ -162,7 +163,7 @@ int rtc_write_datetime(unsigned char* buf) | |||
162 | 163 | ||
163 | /* Send data to RTC */ | 164 | /* Send data to RTC */ |
164 | for (i=0;i<4;i++){ | 165 | for (i=0;i<4;i++){ |
165 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); | 166 | ascodec_write(AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); |
166 | } | 167 | } |
167 | return 1; | 168 | return 1; |
168 | } | 169 | } |