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
Diff: Mechanism/RtcMechanism.cpp
- Revision:
- 4:75ed86b78045
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Mechanism/RtcMechanism.cpp Sun Feb 23 00:16:54 2014 +0000 @@ -0,0 +1,40 @@ +#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(); +}