Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DebouncedEdgeIn I2cLCD_cursor Rtc8564 mbed beep
Mechanism/RtcMechanism.cpp
- Committer:
- togayan
- Date:
- 2014-02-23
- Revision:
- 4:75ed86b78045
File content as of revision 4:75ed86b78045:
#include "RtcMechanism.h"
RtcMechanism::RtcMechanism()
:m_mode(Model::CLOCK),
m_clock(0),
m_dateTime(0),
m_rtc(0)
{
}
void RtcMechanism::setClock(Model::Clock* clock)
{
m_clock = clock;
m_dateTime = m_clock->getDateTime();
}
void RtcMechanism::setRtc(Rtc8564* rtc)
{
m_rtc = rtc;
m_rtc->clock(this, &RtcMechanism::update);
}
void RtcMechanism::setPresentTime()
{
m_rtc->setTime(m_dateTime);
}
void RtcMechanism::mode(Model::OperationMode mode)
{
m_mode = mode;
}
void RtcMechanism::update()
{
if(m_mode != Model::CLOCK) return;
m_rtc->getTime(m_dateTime);
m_clock->renew();
}