Crate ws2818_rgb_led_spi_driver

Crate ws2818_rgb_led_spi_driver 

Source
Expand description

Simple, stripped down, educational, no_std-compatible driver for WS28XX (WS2811/12) RGB LEDs. Uses SPI device for timing/clock, and works definitely on Linux/Raspberry Pi.

The main goal of this crate was to work on Raspberry Pi. As the title says, this is bound to spi-device for sending data. But you can use it also on other systems, i.e. embedded systems (no_std-environments) but in these cases you must provide an own encoding.rs file if the refresh rate doesn’t match the value in timings::PI_SPI_HZ.

Modules§

adapter_gen
Generic Hardware Abstraction Layer, no_std-compatible.
adapter_spi
Adapter for SPI-dev on Linux-systems. This requires std.
encoding
Utility functions for the encoding of data. This functions respect the restrictions from timings-module. This whole module works with and only with a frequency of crate::timings::PI_SPI_HZ. If you can’t use the optional “adapter_spidev”-feature then take this as a template and build your own encoding functions. So far this file and it’s functions are static and not dynamic.
timings
Module with all code + comments related to timing. The WS2818 has specific restrictions how long high and low signal must be send on DIN-wire in nanoseconds. All logic and constants needed to cope with this are placed here.