View Source Delux.Program (delux v0.1.3)

Create LED patterns

See https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt

Link to this section Summary

Types

t()

Program information for one indicator

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 t() :: %Delux.Program{
  blue: Delux.Pattern.t(),
  description: IO.ANSI.ansidata(),
  duration: Delux.Pattern.milliseconds() | :infinity,
  green: Delux.Pattern.t(),
  red: Delux.Pattern.t()
}

Program information for one indicator

Link to this section Functions

Link to this function

adjust_brightness_pwm(pattern, percent)

View Source
@spec adjust_brightness_pwm(t(), 0..100) :: t()

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.

Link to this function

ansi_description(pattern)

View Source
@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.

@spec simplify(t()) :: t()

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.

Link to this function

text_description(pattern)

View Source
@spec text_description(t()) :: String.t()

Return an unformatted description of the pattern

See ansi_description/1 for colorized description