bool CRP5C01::step() { if (pPC->pTIMER->msElapsed(statelog)>1000) { QDateTime lastDateTime = QDateTime::currentDateTime(); rtc_clock_updated(lastDateTime.date().year()%100, lastDateTime.date().month(), lastDateTime.date().day(), lastDateTime.date().dayOfWeek(), lastDateTime.time().hour(), lastDateTime.time().minute(), lastDateTime.time().second()); statelog = pPC->pTIMER->state; } return true; }
void device_rtc_interface::set_time(bool update, int year, int month, int day, int day_of_week, int hour, int minute, int second) { if (!rtc_feature_y2k()) { year %= 100; } set_clock_register(RTC_YEAR, year); set_clock_register(RTC_MONTH, month); set_clock_register(RTC_DAY, day); set_clock_register(RTC_DAY_OF_WEEK, day_of_week); set_clock_register(RTC_HOUR, hour); set_clock_register(RTC_MINUTE, minute); set_clock_register(RTC_SECOND, second); if (update) { rtc_clock_updated(m_register[RTC_YEAR], m_register[RTC_MONTH], m_register[RTC_DAY], m_register[RTC_DAY_OF_WEEK], m_register[RTC_HOUR], m_register[RTC_MINUTE], m_register[RTC_SECOND]); } }
bool CRP5C01::init() { // allocate timers // m_clock_timer = timer_alloc(TIMER_CLOCK); // m_clock_timer->adjust(attotime::from_hz(clock() / 16384), 0, attotime::from_hz(clock() / 16384)); // m_16hz_timer = timer_alloc(TIMER_16HZ); // m_16hz_timer->adjust(attotime::from_hz(clock() / 1024), 0, attotime::from_hz(clock() / 1024)); QDateTime lastDateTime = QDateTime::currentDateTime(); rtc_clock_updated(lastDateTime.date().year()%100, lastDateTime.date().month(), lastDateTime.date().day(), lastDateTime.date().dayOfWeek(), lastDateTime.time().hour(), lastDateTime.time().minute(), lastDateTime.time().second()); statelog = pPC->pTIMER->state; return true; }
void device_rtc_interface::clock_updated() { rtc_clock_updated(m_register[RTC_YEAR], m_register[RTC_MONTH], m_register[RTC_DAY], m_register[RTC_DAY_OF_WEEK], m_register[RTC_HOUR], m_register[RTC_MINUTE], m_register[RTC_SECOND]); }