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.
Fork of parallel_parking by
Diff: Misc/SystemTimer.cpp
- Revision:
- 0:c871d5355b99
diff -r 000000000000 -r c871d5355b99 Misc/SystemTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Misc/SystemTimer.cpp Sun Feb 07 06:14:32 2016 +0000 @@ -0,0 +1,33 @@ +#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; + } + +} \ No newline at end of file