summaryrefslogtreecommitdiff
path: root/firmware/drivers/rtc/rtc_pcf50606.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/rtc/rtc_pcf50606.c')
-rw-r--r--firmware/drivers/rtc/rtc_pcf50606.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/firmware/drivers/rtc/rtc_pcf50606.c b/firmware/drivers/rtc/rtc_pcf50606.c
new file mode 100644
index 0000000000..25b0c704c0
--- /dev/null
+++ b/firmware/drivers/rtc/rtc_pcf50606.c
@@ -0,0 +1,51 @@
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 "pcf50606.h"
25#include <stdbool.h>
26
27void rtc_init(void)
28{
29}
30
31int rtc_read_datetime(unsigned char* buf) {
32 int rc;
33 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
34
35 rc = pcf50606_read_multiple(0x0a, buf, 7);
36
37 set_irq_level(oldlevel);
38 return rc;
39}
40
41int rtc_write_datetime(unsigned char* buf) {
42 int rc;
43 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
44
45 rc = pcf50606_write_multiple(0x0a, buf, 7);
46
47 set_irq_level(oldlevel);
48
49 return rc;
50}
51