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
- Committer:
- AkinoriHashimoto
- Date:
- 2017-09-29
- Revision:
- 6:4cb4eea64805
- Parent:
- 5:c9304777ce1a
File content as of revision 6:4cb4eea64805:
#include "myTimer.h" myTimer::myTimer() { this->stop(); this->reset(); } void myTimer::stop() { this->timer.stop(); return; } void myTimer::reset() { this->timer.reset(); return; } void myTimer::start(bool _RESET) { if(_RESET) this->reset(); this->timer.start(); return; } int myTimer::read_ms(bool _START, bool _RESET, bool _STOP) { int ans= 0; if(_STOP) this->stop(); ans= this->timer.read_ms(); if(_RESET) this->reset(); if(_START) this->start(); return ans; } int myTimer::read_us(bool _START, bool _RESET, bool _STOP) { int ans= 0; if(_STOP) this->stop(); ans= this->timer.read_us(); if(_RESET) this->reset(); if(_START) this->start(); return ans; } void myTimer::wait_ms(int waitTime, bool _START, bool _RESET, bool _STOP) { int wt= waitTime- this->read_ms(_START, _RESET, _STOP); if(wt <= 0) return; ::wait_ms(wt); if(_RESET) this->reset(); return; } void myTimer::wait_us(int waitTime, bool _START, bool _RESET, bool _STOP) { int wt= waitTime- this->read_us(_START, _RESET, _STOP); if(wt <= 0) return; ::wait_us(wt); if(_RESET) this->reset(); return; }