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
SyncModule.cpp
00001 #include "mbed.h" 00002 #include "SyncModule.h" 00003 #include "extra_chars.h" 00004 00005 SyncModule::SyncModule 00006 ( 00007 Serial & in_cDisplay, 00008 RTclock & in_cClock 00009 ) 00010 : Module(in_cDisplay) 00011 , m_cClock(in_cClock) 00012 , m_eMode(eModeLast) 00013 , m_bSync(false) 00014 { 00015 } 00016 00017 SyncModule::~SyncModule() 00018 { 00019 } 00020 00021 void SyncModule::change 00022 ( 00023 size_t /* in_nIndex */, 00024 bool /* in_bUp */ 00025 ) 00026 { 00027 m_bSync = (m_bSync) ? false : true; 00028 } 00029 00030 int SyncModule::getCursorOffset(size_t & inout_nIndex) 00031 { 00032 return m_bSync ? 13 : 12; 00033 } 00034 00035 void SyncModule::onModeChange(EModes in_eMode) 00036 { 00037 EModes eOldMode = m_eMode; 00038 m_eMode = in_eMode; 00039 00040 if (eModeChange != eOldMode) return; 00041 if (eModeMenu != m_eMode) return; 00042 00043 if (m_bSync) 00044 { 00045 // Sync the internal mbed clock (stdlib) 00046 m_cClock.mapTime(); 00047 m_bSync = false; 00048 } 00049 } 00050 00051 void SyncModule::show(bool /*in_bRefresh*/) 00052 { 00053 switch (m_eMode) 00054 { 00055 case eModeChange: 00056 case eModeSelect: 00057 m_cDisplay.printf("Sync Time? %s ",m_bSync ? "yes" : "no"); 00058 break; 00059 00060 default: 00061 m_cDisplay.printf("Sync Time %c ",eRight); 00062 } 00063 }
Generated on Thu Jul 14 2022 00:55:23 by
1.7.2
