Clock with Real-Time Clock (RTC-8564) and I2C LCD module(SB1062B).
Dependencies: DebouncedEdgeIn I2cLCD_cursor Rtc8564 mbed beep
RtcMechanism.cpp
00001 #include "RtcMechanism.h" 00002 00003 RtcMechanism::RtcMechanism() 00004 :m_mode(Model::CLOCK), 00005 m_clock(0), 00006 m_dateTime(0), 00007 m_rtc(0) 00008 { 00009 } 00010 00011 void RtcMechanism::setClock(Model::Clock* clock) 00012 { 00013 m_clock = clock; 00014 m_dateTime = m_clock->getDateTime(); 00015 } 00016 00017 void RtcMechanism::setRtc(Rtc8564* rtc) 00018 { 00019 m_rtc = rtc; 00020 m_rtc->clock(this, &RtcMechanism::update); 00021 } 00022 00023 void RtcMechanism::setPresentTime() 00024 { 00025 m_rtc->setTime(m_dateTime); 00026 } 00027 00028 void RtcMechanism::mode(Model::OperationMode mode) 00029 { 00030 m_mode = mode; 00031 } 00032 00033 void RtcMechanism::update() 00034 { 00035 if(m_mode != Model::CLOCK) return; 00036 00037 m_rtc->getTime(m_dateTime); 00038 00039 m_clock->renew(); 00040 }
Generated on Wed Jul 13 2022 02:25:45 by 1.7.2