|
|
| version 1.2, 2004/08/05 11:30:12 | version 1.3, 2004/08/12 14:03:14 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "parts.h" | #include "parts.h" |
| #include "timemng.h" | #include "timemng.h" |
| #include "pccore.h" | |
| #include "nevent.h" | |
| #include "calendar.h" | #include "calendar.h" |
| Line 62 secinc_exit: | Line 64 secinc_exit: |
| // ---- | // ---- |
| void calendar_initialize(void) { | |
| timemng_gettime(&cal.dt); | |
| } | |
| void calendar_inc(void) { | |
| cal.steps++; | |
| if (cal.steps >= 60) { | |
| cal.steps = 0; | |
| secinc(&cal.dt); | |
| } | |
| } | |
| void calendar_getdate(UINT8 *bcd) { | void calendar_getdate(UINT8 *bcd) { |
| bcd[0] = AdjustAfterMultiply((UINT8)(cal.dt.year % 100)); | bcd[0] = AdjustAfterMultiply((UINT8)(cal.dt.year % 100)); |
| Line 111 void calendar_settime(const UINT8 *bcd) | Line 99 void calendar_settime(const UINT8 *bcd) |
| cal.dt.second = AdjustBeforeDivision(bcd[2]); | cal.dt.second = AdjustBeforeDivision(bcd[2]); |
| } | } |
| // ---- | |
| void neitem_rtc(UINT id) { | |
| nevent_repeat(id); | |
| cal.steps++; | |
| if (cal.steps >= 5) { | |
| cal.steps -= 5; | |
| secinc(&cal.dt); | |
| } | |
| } | |
| void calendar_reset(void) { | |
| timemng_gettime(&cal.dt); | |
| nevent_set(NEVENT_RTC, pccore.realclock / 5, neitem_rtc, NEVENT_RELATIVE); | |
| } | |