FastLED 3.9.15
Loading...
Searching...
No Matches

◆ Update()

void ToggleButton::Update ( uint32_t time_now)
inline

Definition at line 24 of file buttons.h.

24 {
25 if ((time_now - debounce_timestamp_) < 150) {
26 changed_ = false;
27 return;
28 }
29
30 int val = Read_Internal();
31 changed_ = on_ != val;
32
33 if (changed_) { // Has the toggle switch changed?
34 on_ = val; // Set the new toggle switch value.
35 // Protect against debouncing artifacts by putting a 200ms delay from the
36 // last time the value changed.
37 if ((time_now - debounce_timestamp_) > 150) {
38 //++curr_val_; // ... and increment the value.
39 debounce_timestamp_ = time_now;
40 }
41 }
42 }
bool changed_
Definition buttons.h:60
bool Read_Internal()
Definition buttons.h:45
uint32_t debounce_timestamp_
Definition buttons.h:59

References changed_, debounce_timestamp_, on_, and Read_Internal().

Referenced by Read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: