Utility functions for handling element sequences for one LED
Summary
Functions
Return a number of ms that should be considered a long time
PWM a sequence of elements
Reduce the number of transitions in a sequence
Types
@type element() :: {Delux.RGB.component(), milliseconds()}
Value, duration for one component
Values are 0 to 1 and durations are in milliseconds.
@type milliseconds() :: non_neg_integer()
Integer durations in milliseconds
@type t() :: [element()]
A sequence of elements
These get processed into the pattern string that's sent to Linux.
Functions
@spec forever_ms() :: 3_600_000
Return a number of ms that should be considered a long time
Linux doesn't support an infinite timeout, so use this value instead.
PWM a sequence of elements
The resulting sequence will only be fully on or fully off. See
caveats in Program.adjust_brightness_pwm/2.
IMPORTANT: This function is VERY incomplete right now. It requires much more thought to work around flickering issues at low PWM rates.
Reduce the number of transitions in a sequence
This reduces the length of the pattern and in some cases makes it use less of the CPU to run. It's useful for programmatically generated patterns that can take inputs that generate lots of repeating sequences.