osTimer->tick();
nextTimerTick += TICKS_3_6864_MHZ;
}
- if (passedCycles >= nextRTCTick) {
- //printf("RTC tick\n");
- rtc->run();
- nextRTCTick += TICKS_1_HZ;
- }
+ rtc->run();
gpioController->run();
serial3->run();
intController->run();
RTC::RTC()
{
init_register();
+ mLatestTime = time(nullptr);
}
void RTC::run()
// :SA-1110 Developer's Manual: Wei 2003-Dec-08:
//
// The counter is incremented on rising edges of the 1-Hz clock.
- ++m_RCNR;
+ auto currentTime = time(nullptr);
+ if (currentTime > mLatestTime) {
+ ++m_RCNR;
+ mLatestTime = currentTime;
+ }
// :SA-1110 Developer's Manual: Wei 2003-Dec-08:
//