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: AdaFruit_RGBLCDShield MCP23017 mbed RTclock
Fork of MCP_test by
TitleModule.cpp
00001 #include "mbed.h" 00002 #include "TitleModule.h" 00003 #include "time_helper.h" 00004 00005 TitleModule::TitleModule 00006 ( 00007 Serial & in_cDisplay, 00008 RTclock & in_cRTclock 00009 ) 00010 : Module(in_cDisplay) 00011 , m_cRTclock(in_cRTclock) 00012 { 00013 ::memset(&m_sLastTM,0,sizeof(m_sLastTM)); 00014 } 00015 00016 TitleModule::~TitleModule() 00017 { 00018 } 00019 00020 void TitleModule::show(bool in_bRefresh) 00021 { 00022 tm sTM; 00023 00024 // to get the current time information 00025 if (!m_cRTclock.getTime(sTM)) GetTime(sTM); 00026 00027 // if refreshing - only update if there's a change 00028 if (in_bRefresh) 00029 { 00030 // Check for change based on hour (rest is irrelevant) 00031 if (sTM.tm_hour == m_sLastTM.tm_hour) return; 00032 } 00033 00034 // Ensure internal struct has new TM data 00035 ::memcpy(&m_sLastTM,&sTM,sizeof(m_sLastTM)); 00036 if (sTM.tm_hour < 6) m_cDisplay.printf("Night Time "); 00037 else if (sTM.tm_hour < 12) m_cDisplay.printf("Morning Time "); 00038 else if (sTM.tm_hour < 18) m_cDisplay.printf("Afternoon Time "); 00039 else if (sTM.tm_hour < 21) m_cDisplay.printf("Evening Time "); 00040 else m_cDisplay.printf("Bedtime "); 00041 }
Generated on Thu Jul 14 2022 00:55:23 by
1.7.2
