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.
Misc/SystemTimer.cpp
- Committer:
- becheo
- Date:
- 2016-02-07
- Revision:
- 0:c871d5355b99
File content as of revision 0:c871d5355b99:
#include <Misc/SystemTimer.h>
SystemTimer::SystemTimer(){
systemUptimeMillis = 0;
systemTicker.attach_us(this,&SystemTimer::systemTickerHandler,1000);
}
void SystemTimer::systemTickerHandler(){
systemUptimeMillis++;
}
uint64_t SystemTimer::getUptimeMillis(){
return systemUptimeMillis;
}
bool SystemTimer::isTimeoutPassed(uint64_t *timestampMillis, uint32_t timeoutMillis){
if((systemUptimeMillis - *timestampMillis) > timeoutMillis){
*timestampMillis = systemUptimeMillis;
return true;
}else{
return false;
}
}