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 - mDebounceTimestamp) < 150) {
26 mChanged = false;
27 return;
28 }
29
30 int val = Read_Internal();
31 mChanged = mOn != val;
32
33 if (mChanged) { // Has the toggle switch changed?
34 mOn = 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 - mDebounceTimestamp) > 150) {
38 //++curr_val_; // ... and increment the value.
39 mDebounceTimestamp = time_now;
40 }
41 }
42 }
bool mChanged
Definition buttons.h:60
uint32_t mDebounceTimestamp
Definition buttons.h:59
bool Read_Internal()
Definition buttons.h:45

References mChanged, mDebounceTimestamp, mOn, and Read_Internal().

Referenced by Read().

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