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
5
class
Timer
{
6
public
:
7
Timer
() :
start_time
(0),
duration
(0),
running
(false) {}
8
void
start
(uint32_t now, uint32_t
duration
) {
9
start_time
= now;
10
this->duration =
duration
;
11
running
=
true
;
12
}
13
bool
update
(uint32_t now) {
14
if
(!
running
) {
15
return
false
;
16
}
17
uint32_t elapsed = now -
start_time
;
18
if
(elapsed >
duration
) {
19
running
=
false
;
20
return
false
;
21
}
22
return
true
;
23
}
24
25
private
:
26
uint32_t
start_time
;
27
uint32_t
duration
;
28
bool
running
;
29
};
Timer::running
bool running
Definition
timer.h:28
Timer::start_time
uint32_t start_time
Definition
timer.h:26
Timer::Timer
Timer()
Definition
timer.h:7
Timer::duration
uint32_t duration
Definition
timer.h:27
Timer::start
void start(uint32_t now, uint32_t duration)
Definition
timer.h:8
Timer::update
bool update(uint32_t now)
Definition
timer.h:13
examples
FxNoiseRing
timer.h
Generated on Fri Apr 18 2025 03:39:31 for FastLED by
1.13.2