Files
lighthub/lighthub/microtimer.cpp

25 lines
541 B
C++

#include <microtimer.h>
boolean MicroTimer::isOver() {
if ((unsigned long)(micros() - timestampLastHitMs) > sleepTimeMs) {
return true;
}
return false;
}
void MicroTimer::sleep(unsigned long sleepTimeMs) {
this->sleepTimeMs = sleepTimeMs;
timestampLastHitMs = micros();
}
boolean Timer::isOver() {
if ((unsigned long)(millis() - timestampLastHitMs) > sleepTimeMs) {
return true;
}
return false;
}
void Timer::sleep(unsigned long sleepTimeMs) {
this->sleepTimeMs = sleepTimeMs;
timestampLastHitMs = millis();
}