FastLED
3.9.15
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
stdint.h
>
4
12
class
Timer
{
13
public
:
19
Timer
() :
start_time
(0),
duration
(0),
running
(false) {}
20
27
void
start
(uint32_t now, uint32_t
duration
) {
28
start_time
= now;
29
this->duration =
duration
;
30
running
=
true
;
31
}
32
42
bool
update
(uint32_t now) {
43
if
(!
running
) {
44
return
false
;
45
}
46
uint32_t elapsed = now -
start_time
;
47
if
(elapsed >
duration
) {
48
running
=
false
;
49
return
false
;
50
}
51
return
true
;
52
}
53
54
private
:
55
uint32_t
start_time
;
// When the timer was started (in milliseconds)
56
uint32_t
duration
;
// How long the timer should run (in milliseconds)
57
bool
running
;
// Whether the timer is currently active
58
};
Timer::running
bool running
Definition
timer.h:57
Timer::start_time
uint32_t start_time
Definition
timer.h:55
Timer::Timer
Timer()
Construct a new Timer object.
Definition
timer.h:19
Timer::duration
uint32_t duration
Definition
timer.h:56
Timer::start
void start(uint32_t now, uint32_t duration)
Start the timer with a specific duration.
Definition
timer.h:27
Timer::update
bool update(uint32_t now)
Update the timer state based on current time.
Definition
timer.h:42
stdint.h
examples
FxNoiseRing
timer.h
Generated on Mon Jun 16 2025 06:27:48 for FastLED by
1.13.2