View Source Delux.Program (delux v0.4.0)
Create LED patterns
Link to this section Summary
Functions
Adjust the brightness of a pattern
Return a description with nice ANSI colors
Reduce the number of transitions in a pattern
Return an unformatted description of the pattern
Link to this section Types
@type mode() :: :one_shot | :simple_loop
Program playback mode
The playback mode determines what happens when the program gets interrupted or ends.
:simple_loop
- keep repeating the program. If it's interrupted, just restart at the the beginning.:one_shot
- run the program once
@type t() :: %Delux.Program{ blue: Delux.Pattern.t(), description: IO.ANSI.ansidata(), green: Delux.Pattern.t(), mode: mode(), red: Delux.Pattern.t() }
Program information for one indicator
Link to this section Functions
Adjust the brightness of a pattern
This modifies the pattern to optionally dim it by blinking the LED at 50 Hz. It is not an efficient way of dimming LEDs since the blinking is done on the processor by the kernel.
@spec ansi_description(t()) :: IO.ANSI.ansidata()
Return a description with nice ANSI colors
The description is returned as IO.ANSI.ansidata()
. Use IO.ANSI.format/1
to
expect escape codes for display with IO.puts/1
.
Reduce the number of transitions in a pattern
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.
Return an unformatted description of the pattern
See ansi_description/1
for colorized description