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.
Dependents: DetectFreqAboveTH RN41
myTimer.cpp
00001 #include "myTimer.h" 00002 00003 00004 myTimer::myTimer() 00005 { 00006 this->stop(); 00007 this->reset(); 00008 } 00009 00010 void myTimer::stop() 00011 { 00012 this->timer.stop(); 00013 return; 00014 } 00015 00016 void myTimer::reset() 00017 { 00018 this->timer.reset(); 00019 return; 00020 } 00021 00022 void myTimer::start(bool _RESET) 00023 { 00024 if(_RESET) 00025 this->reset(); 00026 this->timer.start(); 00027 return; 00028 } 00029 00030 int myTimer::read_ms(bool _START, bool _RESET, bool _STOP) 00031 { 00032 int ans= 0; 00033 if(_STOP) 00034 this->stop(); 00035 00036 ans= this->timer.read_ms(); 00037 00038 if(_RESET) 00039 this->reset(); 00040 00041 if(_START) 00042 this->start(); 00043 00044 return ans; 00045 } 00046 int myTimer::read_us(bool _START, bool _RESET, bool _STOP) 00047 { 00048 int ans= 0; 00049 if(_STOP) 00050 this->stop(); 00051 00052 ans= this->timer.read_us(); 00053 00054 if(_RESET) 00055 this->reset(); 00056 00057 if(_START) 00058 this->start(); 00059 00060 return ans; 00061 } 00062 00063 void myTimer::wait_ms(int waitTime, bool _START, bool _RESET, bool _STOP) 00064 { 00065 int wt= waitTime- this->read_ms(_START, _RESET, _STOP); 00066 if(wt <= 0) 00067 return; 00068 ::wait_ms(wt); 00069 if(_RESET) 00070 this->reset(); 00071 return; 00072 } 00073 void myTimer::wait_us(int waitTime, bool _START, bool _RESET, bool _STOP) 00074 { 00075 int wt= waitTime- this->read_us(_START, _RESET, _STOP); 00076 if(wt <= 0) 00077 return; 00078 ::wait_us(wt); 00079 if(_RESET) 00080 this->reset(); 00081 return; 00082 }
Generated on Thu Jul 14 2022 02:37:42 by
