View Source Fledex.Animation.Manager (fledex v0.3.0)
The animation manager manages several animations (and potentially
serveral led strips at the same time.
Usually you don't start the service yoursel, but it gets automatically
started when calling use Fledex
and gets used by the Fledex
macros.
Thus, you rarely have to interact with it directly.
The 3 main functions are:
regiseter_strip/2
: to add a new led strip. This will also create the necessaryFledex.LedStrip
and configures it.unregister_strip/1
: this will remove an led strip againregister_animations/2
: this registers (or reregisters) a set of animations. Any animation that is not part of a reregistration will be dropped.
Summary
Functions
Returns a specification to start this module under a supervisor.
In some circumstances it can be useful to get information on what has
been configured and this function allows to retrieve this information.
The function can either be called with a strip name, or with :all
(the default) to retrieve all configurations at the same time.
Register a set of animations for a specific led strip. This function can be called as many times as desired to reconfigure the animations. It should be noted that animations were defined before calling this function again, will be stopped if they are not part of the configuration anymore. Newly defined animations will be started.
Register a new LED strip with the specific strip_name
. The LED strip
needs to be configured, either through a simple atom (for predefined
configurations, or through a map with all the configurations (see
LedStrip
for details).
This starts a new Fledex.Animation.Manager
. Only a single animation manager will be started
even if called serveral times (thus it's save to call it repeatedly).
The type_config
specifies the list of supported animations and their module mapping
(see Fledex.fledex_config/0
for the configurations used by default.)
Unregisters a previously registered led strip. All resources related to the led strip will be freed.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
In some circumstances it can be useful to get information on what has
been configured and this function allows to retrieve this information.
The function can either be called with a strip name, or with :all
(the default) to retrieve all configurations at the same time.
Register a set of animations for a specific led strip. This function can be called as many times as desired to reconfigure the animations. It should be noted that animations were defined before calling this function again, will be stopped if they are not part of the configuration anymore. Newly defined animations will be started.
Different types of animations exist, see Fledex.fledex_config/0
for
the default configurations that will be used when using use Fledex
.
Note: the animation functions might get called quite frequently and therefore any work within them should be kept to a minimum.
Register a new LED strip with the specific strip_name
. The LED strip
needs to be configured, either through a simple atom (for predefined
configurations, or through a map with all the configurations (see
LedStrip
for details).
This starts a new Fledex.Animation.Manager
. Only a single animation manager will be started
even if called serveral times (thus it's save to call it repeatedly).
The type_config
specifies the list of supported animations and their module mapping
(see Fledex.fledex_config/0
for the configurations used by default.)
@spec unregister_strip(atom()) :: :ok
Unregisters a previously registered led strip. All resources related to the led strip will be freed.