Summary

Types

Program playback mode

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

Types

mode()

@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

t()

@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

Functions

adjust_brightness_pwm(pattern, percent)

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

ansi_description(pattern)

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

simplify(pattern)

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

text_description(pattern)

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

Return an unformatted description of the pattern

See ansi_description/1 for colorized description