View Source Fledex.LedsDriver (fledex v0.2.0)

This module defines a GenServer that manages the LED strip (be it a real one with the SpiDriver or a virtual one with e.g. the KinoDriver). Usually you only want to start one server, even though it is possible to start several. The LedsDriver will take several Leds definitions and merge them together to be displayed on a single LED strip The role the LedsDriver plays is similar to the one a window server plays on a normal computer

Summary

Types

@type t() :: %{
  strip_name: atom(),
  timer: %{
    disabled: boolean(),
    counter: pos_integer(),
    update_timeout: pos_integer(),
    update_func: (t() -> t()),
    only_dirty_update: boolean(),
    is_dirty: boolean(),
    ref: reference()
  },
  led_strip: %{merge_strategy: atom(), driver_modules: module(), config: map()},
  namespaces: map()
}

Functions

Link to this function

apply_merge_strategy(rgb, merge_strategy)

View Source
@spec apply_merge_strategy([Fledex.Color.Types.colorint()], atom()) ::
  Fledex.Color.Types.rgb()
Link to this function

change_config(strip_name \\ __MODULE__, config_path, value)

View Source
@spec change_config(atom(), [atom()], any()) :: {:ok, any()}
Link to this function

define_namespace(strip_name \\ __MODULE__, namespace)

View Source
@spec define_namespace(atom(), atom()) :: :ok | {:error, String.t()}
Link to this function

drop_namespace(strip_name \\ __MODULE__, namespace)

View Source
@spec drop_namespace(atom(), atom()) :: :ok
Link to this function

exist_namespace(strip_name \\ __MODULE__, namespace)

View Source
@spec exist_namespace(atom(), atom()) :: boolean()
@spec get_leds(map()) :: [[Fledex.Color.Types.colorint()]]
Link to this function

init_state(init_args, strip_name)

View Source
@spec init_state(map(), atom()) :: t()
@spec match_length([[Fledex.Color.Types.colorint()]]) :: [
  [Fledex.Color.Types.colorint()]
]
Link to this function

merge_leds(leds, merge_strategy)

View Source
@spec merge_leds([[Fledex.Color.Types.colorint()]], atom()) :: [
  Fledex.Color.Types.colorint()
]
Link to this function

merge_namespaces(namespaces, merge_strategy)

View Source
@spec merge_namespaces(map(), atom()) :: [Fledex.Color.Types.colorint()]
Link to this function

merge_pixels(elems, merge_strategy)

View Source
Link to this function

reinit_drivers(strip_name \\ __MODULE__)

View Source
@spec reinit_drivers(atom()) :: :ok
Link to this function

set_leds(strip_name \\ __MODULE__, namespace, leds)

View Source
@spec set_leds(atom(), atom(), [pos_integer()]) :: :ok | {:error, String.t()}
Link to this function

start_link(strip_name \\ __MODULE__, config \\ :none)

View Source
@spec start_link(atom() | {:global, any()} | {:via, atom(), any()}, atom() | map()) ::
  :ignore | {:error, any()} | {:ok, pid()}
@spec transfer_data(t()) :: t()