diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/drivers/rtc.c | 30 | ||||
-rw-r--r-- | firmware/export/config-h300.h | 3 |
3 files changed, 34 insertions, 1 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index ce5ec7f803..7f07598273 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -105,7 +105,7 @@ drivers/pcf50606.c | |||
105 | #if defined(APPLE_IPODCOLOR) || defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO) | 105 | #if defined(APPLE_IPODCOLOR) || defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO) |
106 | drivers/pcf50605.c | 106 | drivers/pcf50605.c |
107 | #endif | 107 | #endif |
108 | #if CONFIG_RTC == RTC_M41ST84W | 108 | #if (CONFIG_RTC == RTC_M41ST84W) || (CONFIG_RTC == RTC_PCF50606) |
109 | drivers/rtc.c | 109 | drivers/rtc.c |
110 | #endif | 110 | #endif |
111 | drivers/serial.c | 111 | drivers/serial.c |
diff --git a/firmware/drivers/rtc.c b/firmware/drivers/rtc.c index b77db8b865..0e6d68eb1a 100644 --- a/firmware/drivers/rtc.c +++ b/firmware/drivers/rtc.c | |||
@@ -21,12 +21,41 @@ | |||
21 | #include "i2c.h" | 21 | #include "i2c.h" |
22 | #include "rtc.h" | 22 | #include "rtc.h" |
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | ||
25 | #include "pcf50606.h" | ||
24 | #include <stdbool.h> | 26 | #include <stdbool.h> |
25 | 27 | ||
26 | #define RTC_ADR 0xd0 | 28 | #define RTC_ADR 0xd0 |
27 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) | 29 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) |
28 | #define RTC_DEV_READ (RTC_ADR | 0x01) | 30 | #define RTC_DEV_READ (RTC_ADR | 0x01) |
29 | 31 | ||
32 | #if CONFIG_RTC == RTC_PCF50606 | ||
33 | void rtc_init(void) | ||
34 | { | ||
35 | } | ||
36 | int rtc_read_datetime(unsigned char* buf) { | ||
37 | int rc; | ||
38 | int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); | ||
39 | |||
40 | rc = pcf50606_read_multiple(0x0a, buf, 7); | ||
41 | |||
42 | set_irq_level(oldlevel); | ||
43 | |||
44 | return rc; | ||
45 | } | ||
46 | |||
47 | int rtc_write_datetime(unsigned char* buf) { | ||
48 | int rc; | ||
49 | int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); | ||
50 | |||
51 | rc = pcf50606_write_multiple(0x0a, buf, 7); | ||
52 | |||
53 | set_irq_level(oldlevel); | ||
54 | |||
55 | return rc; | ||
56 | } | ||
57 | |||
58 | #else | ||
30 | void rtc_init(void) | 59 | void rtc_init(void) |
31 | { | 60 | { |
32 | unsigned char data; | 61 | unsigned char data; |
@@ -278,5 +307,6 @@ int rtc_write_datetime(unsigned char* buf) { | |||
278 | 307 | ||
279 | return rc; | 308 | return rc; |
280 | } | 309 | } |
310 | #endif /* CONFIG_RTC == RTC_PCF50606 */ | ||
281 | 311 | ||
282 | #endif /* CONFIG_RTC */ | 312 | #endif /* CONFIG_RTC */ |
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 54a2ef543f..2698d12098 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -30,6 +30,9 @@ | |||
30 | /* Define this if you do software codec */ | 30 | /* Define this if you do software codec */ |
31 | #define CONFIG_CODEC SWCODEC | 31 | #define CONFIG_CODEC SWCODEC |
32 | 32 | ||
33 | /* define this if you have a real-time clock */ | ||
34 | #define CONFIG_RTC RTC_PCF50606 | ||
35 | |||
33 | /* Define this if you have an remote lcd */ | 36 | /* Define this if you have an remote lcd */ |
34 | #define HAVE_REMOTE_LCD | 37 | #define HAVE_REMOTE_LCD |
35 | 38 | ||