diff options
Diffstat (limited to 'firmware/drivers/rtc/rtc_pcf50605.c')
-rw-r--r-- | firmware/drivers/rtc/rtc_pcf50605.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/firmware/drivers/rtc/rtc_pcf50605.c b/firmware/drivers/rtc/rtc_pcf50605.c new file mode 100644 index 0000000000..1bc40146ff --- /dev/null +++ b/firmware/drivers/rtc/rtc_pcf50605.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "i2c.h" | ||
21 | #include "rtc.h" | ||
22 | #include "kernel.h" | ||
23 | #include "system.h" | ||
24 | #include "pcf50605.h" | ||
25 | #include <stdbool.h> | ||
26 | |||
27 | void rtc_init(void) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | int rtc_read_datetime(unsigned char* buf) | ||
32 | { | ||
33 | return pcf50605_read_multiple(0x0a, buf, 7); | ||
34 | } | ||
35 | |||
36 | int rtc_write_datetime(unsigned char* buf) | ||
37 | { | ||
38 | int i; | ||
39 | |||
40 | for (i=0;i<7;i++) { | ||
41 | pcf50605_write(0x0a+i, buf[i]); | ||
42 | } | ||
43 | |||
44 | return 1; | ||
45 | } | ||