View Source Fledex.LedStrip (fledex v0.3.0)
This module defines a GenServer that manages the LED strip (be it a real one with the
Fledex.Driver.Impl.Spi
or a virtual one with e.g. the Fledex.Driver.Impl.Kino
).
You would start an LedStrip
for every led strip you have.
The Fledex.LedStrip
will take several Fledex.Leds
definitions and merge them
together to be displayed on a single LED strip.
The role the LedStrip plays is similar to the one a window server plays on a normal computer, except that a window server would manage several screens, whereas here each LED strip would get its own.
Summary
Functions
Change some aspect of a configuration for a specific strip. The configuration will be updated and the old value will be returned.
Returns a specification to start this module under a supervisor.
Define a new namespace
Drop a previously defined namespace.
Checks whether the specified namespace already exists
In some circumstances it might be necessary to reinitialize a driver. Most of the time you don't need to call this. If you do, you will surely know about it :)
Sets the leds in a specific strip and namespace.
Functions
Change some aspect of a configuration for a specific strip. The configuration will be updated and the old value will be returned.
Caution: No error checking is performed, so you might end up with a useless configuration
Returns a specification to start this module under a supervisor.
See Supervisor
.
Define a new namespace
Drop a previously defined namespace.
Checks whether the specified namespace already exists
@spec reinit_drivers(atom()) :: :ok
In some circumstances it might be necessary to reinitialize a driver. Most of the time you don't need to call this. If you do, you will surely know about it :)
@spec set_leds(atom(), atom(), [pos_integer()]) :: :ok | {:error, String.t()}
Sets the leds in a specific strip and namespace.
Note: repeated calls of this function will result in previously set leds will be overwritten. We are passing a list of leds which means every led will be rewritten, except if we define a 'shorter" led sequence. In that case some leds might retain their previously set value.