View Source Delux.Pattern (delux v0.1.2)
Utility functions for handling element sequences for one LED
Link to this section Summary
Functions
PWM a sequence of elements
Reduce the number of transitions in a sequence
Convert a pattern to iodata
Link to this section 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.
Link to this section Functions
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.
@spec to_iodata(t(), non_neg_integer()) :: iolist()
Convert a pattern to iodata