mirror of
https://github.com/anklimov/lighthub
synced 2026-01-27 00:29:06 +03:00
25 lines
541 B
C++
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();
|
|
} |