# fledex v0.8.0 - Table of Contents

> A small library to easily control an LED strip with nerves (or nerves-livebook)

## Pages

- [Fledex](readme-1.md)
- [Architecture](architecture.md)
- [Hardware (examples)](hardware.md)
- [Project Plan](project_plan.md)
- [Cheatsheet](cheatsheet.md)
- [Color Names](colors.md)

- LiveBooks
  - [Intro](readme-2.md)
  - [1. First steps with an LED strip](1_first_steps_with_an_led_strip.md)
  - [2. Fledex: Some simple tests](2_fledex_first_steps.md)
  - [2b Fledex: How to define LEDs](2b_fledex_how_to_define_leds.md)
  - [3. Fledex: Animations](3_fledex_animations.md)
  - [3b Fledex: Everything about Colors](3b_fledex_everything_about_colors.md)
  - [4. Fledex: Clock Example](4_fledex_clock_example.md)
  - [5. Fledex: Weather example](5_fledex_weather_example.md)
  - [6. Fledex: DSL](6_fledex_dsl.md)
  - [7. Fledex: Effects](7_fledex_effects.md)
  - [8. Fledex: Component](8_fledex_component.md)
  - [9. Fledex: Job](9_fledex_jobs.md)
  - [10. Fledex: Coordinators (under construction)](10_fledex_coordinators.md)

- LiveBooks (German)
  - [Schule: Licht und Farben](licht_und_farben.md)
  - [Schule: Hardware Erklärung](hardware_erklaerung.md)

- Other Project Info
  - [Apache License](license.md)
  - [Security Policy](security.md)
  - [CLA](cla.md)
  - [Contributing](contributing.md)
  - [Contributors](contributors.md)
  - [Contributor Covenant Code of Conduct](code_of_conduct.md)

## Modules

- Core:
  - [Fledex](Fledex.md): This module should provide some simple macros that allow to define the
led strip and to update it. The code you would write (in livebook) would
look something like the following:
``` elixir
  use Fledex
  led_strip :strip_name, Kino do
    animation :john do
      config = [
        num_leds: 50,
        reversed: true
      ]
  - [Fledex.Color](Fledex.Color.md): Protocol that can be implemented to convert from some kind of color representation
  - [Fledex.Config](Fledex.Config.md): This module gives access to configure Fledex at runtime.
  - [Fledex.LedStrip](Fledex.LedStrip.md): 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`).
  - [Fledex.Leds](Fledex.Leds.md): This module allows to define a sequence of Leds. You first create the new sequence of leds
by calling one of the `leds` functions.

- Core: Color Names
  - [Fledex.Color.Names](Fledex.Color.Names.md): This module is a bridge between color name modules and the `Fledex.Color`
protocol. It uses the `Fledex.Config` to know about the configured colors

  - [Fledex.Color.Names.CSS](Fledex.Color.Names.CSS.md): This module defines all the named colors in the CSS standard, see:
https://drafts.csswg.org/css-color/#named-colors
  - [Fledex.Color.Names.Interface](Fledex.Color.Names.Interface.md): This module defines the standard interface (behaviour) for color names modules
which they should implement.
  - [Fledex.Color.Names.RAL](Fledex.Color.Names.RAL.md): This module defines all the named colors in the RAL Design System Plus, see:
https://en.wikipedia.org/wiki/List_of_RAL_colours#RAL_Design_System+
  - [Fledex.Color.Names.SVG](Fledex.Color.Names.SVG.md): This module defines all the named colors in the SVG standard, see:
https://www.w3.org/TR/SVG11/types.html#ColorKeywords
  - [Fledex.Color.Names.Wiki](Fledex.Color.Names.Wiki.md): This module defines all the named colors specified on [Wikipedia](https://www.wikipedia.org/), which is a collection
of various sources.
See:
* [List of colors: A–F](https://en.wikipedia.org/wiki/List_of_colors:_A%E2%80%93F)
* [List of colors: G–M](https://en.wikipedia.org/wiki/List_of_colors:_G%E2%80%93M)
* [List of colors: N–Z](https://en.wikipedia.org/wiki/List_of_colors:_N%E2%80%93Z)

- Core: Components
  - [Fledex.Component.Clock](Fledex.Component.Clock.md): This component creates a clock
  - [Fledex.Component.Dot](Fledex.Component.Dot.md): A component that will draw a single "dot".

  - [Fledex.Component.Interface](Fledex.Component.Interface.md): This interface needs to be implemente by a compoenent. It should be noted
that a component is always an animation.

  - [Fledex.Component.PubSubPainter](Fledex.Component.PubSubPainter.md): This components receives some color information through PubSub and
colors the leds accordingly.
  - [Fledex.Component.Thermometer](Fledex.Component.Thermometer.md): This is only an example component to demonstrate how a component could look like.
The component is not properly tested no major effort will be spend on getting this
to a better state.
  - [Fledex.Component.Utils](Fledex.Component.Utils.md): Utility functions that are useful when defining components

- Core: Drivers
  - [Fledex.Driver.Impl.Kino](Fledex.Driver.Impl.Kino.md): This is a concrete driver to display the leds in a `Kino` environment, like
a [livebook](https://livebook.dev/).
  - [Fledex.Driver.Impl.Logger](Fledex.Driver.Impl.Logger.md): This driver can log the data either to `IO` or to a `Logger`.
  - [Fledex.Driver.Impl.Null](Fledex.Driver.Impl.Null.md):   This is a dummy implementation of the Driver that doesn't do
  anything (similar to a `/dev/null` device). This can be useful if you
  want to run some tests without getting any output or sending it to hardware.

  - [Fledex.Driver.Impl.PubSub](Fledex.Driver.Impl.PubSub.md): This driver collects the led definitions and transfers them through PubSub
to somewhere else where they can be repainted through the `Fledex.Component.PubSub`
component
  - [Fledex.Driver.Impl.Spi](Fledex.Driver.Impl.Spi.md): This module is the base for SPI based drivers.
  - [Fledex.Driver.Impl.Spi.Utils](Fledex.Driver.Impl.Spi.Utils.md): Utility functions for the SPI drivers

  - [Fledex.Driver.Impl.Spi.Ws2801](Fledex.Driver.Impl.Spi.Ws2801.md): This module is a concrete driver that will push the led data through an SPI port.
  - [Fledex.Driver.Impl.Spi.Ws2812](Fledex.Driver.Impl.Spi.Ws2812.md): This module is a concrete driver that will push the led data through an SPI port.
It is mainly intended for WS2812 led strip,

- Core: Effects
  - [Fledex.Effect.BellCurve](Fledex.Effect.BellCurve.md): This is an effect that will set the intensity of the LEDs according to
a Bell curve distribution.
  - [Fledex.Effect.Dimming](Fledex.Effect.Dimming.md): This is an effect that will dim all the leds.
  - [Fledex.Effect.Interface](Fledex.Effect.Interface.md): This module defines the interface for an LED effect. Effects can be used in Animations.
Examples are
  - [Fledex.Effect.Offset](Fledex.Effect.Offset.md): An effect that will offset the colors.
  - [Fledex.Effect.Rotation](Fledex.Effect.Rotation.md): This effect will apply a rotation to the leds
  - [Fledex.Effect.Wanish](Fledex.Effect.Wanish.md): This is an effect that will slowly desolve the animation. Once it has desolved completely the effect will (by default) inverse itself and the leds will reappear.

- Details: Animation
  - [Fledex.Animation.Animator](Fledex.Animation.Animator.md): > #### Note {: .info}
>
> You probably do not want to use this module directly but use the DSL defined
> in `Fledex`
  - [Fledex.Animation.Coordinator](Fledex.Animation.Coordinator.md): > #### Note {: .info}
>
> You probably do not want to use this module directly but use the DSL defined
> in `Fledex`
  - [Fledex.Animation.JobScheduler](Fledex.Animation.JobScheduler.md): This module is a small wrapper around hte Fledex.Scheduler library and adds
Fledex specific aspsects into the scheduler.
  - [Fledex.Animation.Manager](Fledex.Animation.Manager.md): > #### Note {: .info}
>
> You probably do not want to use this module directly but use the DSL defined
> in `Fledex`

- Details: Color
  - [Fledex.Color.Conversion.Approximate](Fledex.Color.Conversion.Approximate.md): This module defines the conversion from RGB to HSV.
  - [Fledex.Color.Conversion.CalcUtils](Fledex.Color.Conversion.CalcUtils.md): Most functions are reimplementations from FastLED. Here is a detailed
explanation of those functions:
https://github.com/FastLED/FastLED/wiki/High-performance-math

  - [Fledex.Color.Conversion.Rainbow](Fledex.Color.Conversion.Rainbow.md): Module defininig an `hsv2rgb/2` conversion following the rainbow
color map.
  - [Fledex.Color.Conversion.Spectrum](Fledex.Color.Conversion.Spectrum.md): Spectrum color conversion from HSV to RGB
  - [Fledex.Color.Correction](Fledex.Color.Correction.md): Definitions and functions to perform color corrections

  - [Fledex.Color.Correction.Color](Fledex.Color.Correction.Color.md): Color correction depending on the hardware used

  - [Fledex.Color.Correction.Temperature](Fledex.Color.Correction.Temperature.md): Color temperature values
  - [Fledex.Color.Functions](Fledex.Color.Functions.md): A collection of color functions (namely rainbow and gradient)

  - [Fledex.Color.HSL](Fledex.Color.HSL.md): This module represents the color representation for colors encoded in the
[HSL (hue, saturation, lightness) color space](https://en.wikipedia.org/wiki/HSL_and_HSV)

  - [Fledex.Color.HSV](Fledex.Color.HSV.md): This module represents the color representation for colors encoded in the
[HSV (hue, saturation, value) color space](https://en.wikipedia.org/wiki/HSL_and_HSV)

  - [Fledex.Color.KinoRender](Fledex.Color.KinoRender.md): This module implements a `KinoRender` that converts a `Fledex` color to a markdown
representation that can be used in a Livebook and allows nicer rendering of return
values. Just return an instance of this module
```elixir
Fledex.Color.KinoRender.new([color1, color2])
```
  - [Fledex.Color.Names.LoadUtils](Fledex.Color.Names.LoadUtils.md): Some utility functions that can help when loading color names from a CSV file

  - [Fledex.Color.Names.ModuleGenerator](Fledex.Color.Names.ModuleGenerator.md): This module allows to easily create color name modules (implementing the
`Fledex.Color.Names.Interface` behaviour) by simply using this module. Use
it in the following way
  - [Fledex.Color.Names.Types](Fledex.Color.Names.Types.md): This module defines a couple of types related to color names

  - [Fledex.Color.RGB](Fledex.Color.RGB.md): This module represents an RGB color. `Fledex` does commonly use a `{r, g, b}`-tuple, but
this module makes the purpose more clear.
  - [Fledex.Color.RGBW](Fledex.Color.RGBW.md): This module represents an RGBW color. `Fledex` does commonly use a `{r, g, b}`-tuple, but
this module allows to also set the white (`:w1`) or even a secondary white color (`:w2`)
led commonly found in modern led strips
(e.g. [WS2813B-RGBW](https://www.ledyilighting.com/wp-content/uploads/2025/02/WS2813-RGBW-datasheet.pdf)).
  - [Fledex.Color.Types](Fledex.Color.Types.md): A couple of color related type definitions.

- Details: Driver
  - [Fledex.Driver.Interface](Fledex.Driver.Interface.md): This interface defines the `@behaviour` for drivers. They can be
dummy implementations like a driver that dumps the output to IO,
wich can be useful for testing without real hardware.
A proper implementation probably opens a channel (if not already open)
to the bus (like SPI) and sends the data to the bus.
  - [Fledex.Driver.Manager](Fledex.Driver.Manager.md): This modules manages a (set of) concrete driver(s).

- Details: Supervisor
  - [Fledex.Supervisor.AnimationSystem](Fledex.Supervisor.AnimationSystem.md): This module starts and supervises all the services required for running
animations. You rarely will use this module directly, but rather use it
through the `Fledex` DSL.
  - [Fledex.Supervisor.LedStripSupervisor](Fledex.Supervisor.LedStripSupervisor.md): This is the supervisor for an led strip and all it's workers, like `:animator`s, `:coordinator`s, and `:job`s
  - [Fledex.Supervisor.Utils](Fledex.Supervisor.Utils.md): Some utilities related to the animation system.

- Details: Utils
  - [Fledex.Utils.Cluster](Fledex.Utils.Cluster.md): This module collects functionality around clustering and to connect several Fledex instances together. This allows to do some processing on one node and to pass some pixel definitions to another node to display them there.
  - [Fledex.Utils.Dsl](Fledex.Utils.Dsl.md): The module is only intended to be used by the Fledex module.
  - [Fledex.Utils.Guards](Fledex.Utils.Guards.md): This module collects all useful guards. If you want to use one of them
you need to `import` this module.

  - [Fledex.Utils.PubSub](Fledex.Utils.PubSub.md): This module collects all functions that are about publish and subscribe (PubSub)
functionality.

## Mix Tasks

- Details: Color
  - [mix docs.fledex.colors](Mix.Tasks.Docs.Fledex.Colors.md): Generate documentation for all the available Fledex colors from various known color modules
See `Fledex.Config.known_color_modules/0` for more details.

