Fledex.Animation.Manager (fledex v0.6.0)
View SourceThe 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:
register_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_config/2
: this registers (or reregisters) a set of animations. Any animation that is not part of a reregistration will be dropped.
Summary
Functions
provides a child_spec of this module so that it can easily be added to a supervision tree.
Register a set of configurations (animations, jobs, ...) for a specific led strip. This function can be called as many times as desired to reconfigure the strip. It should be noted that any animation, job, ... that was 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 module (for predefined
configurations, or a touple with module and keyword list to adjust the
configuration.(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).
In general you want to start the function without options, since they are only for
debugging purposes.
Unregisters a previously registered led strip. All resources related to the led strip will be freed.
Types
@type config_t() :: %{ required(atom()) => Fledex.Animation.Animator.config_t() | Fledex.Animation.JobScheduler.config_t() | Fledex.Animation.Coordinator.config_t() }
Functions
@spec child_spec(keyword()) :: Supervisor.child_spec()
provides a child_spec of this module so that it can easily be added to a supervision tree.
Register a set of configurations (animations, jobs, ...) for a specific led strip. This function can be called as many times as desired to reconfigure the strip. It should be noted that any animation, job, ... that was defined before calling this function again, will be stopped if they are not part of the configuration anymore. Newly defined animations will be started.
Note: the animation functions might get called quite frequently and therefore any work within them should be kept to a minimum.
@spec register_strip(atom(), Fledex.LedStrip.drivers_config_t(), keyword()) :: :ok
Register a new LED strip with the specific strip_name
. The LED strip
needs to be configured, either through a simple module (for predefined
configurations, or a touple with module and keyword list to adjust the
configuration.(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).
In general you want to start the function without options, since they are only for
debugging purposes.
@spec unregister_strip(atom()) :: :ok
Unregisters a previously registered led strip. All resources related to the led strip will be freed.