|
FastLED 3.9.15
|
ezWS2812 SPI driver for WS2812 LEDs
This driver uses the SPI peripheral to generate WS2812 timing signals. Each WS2812 bit is encoded as 8 SPI bits to achieve the required timing.
Hardware Requirements:
Usage:
Definition at line 56 of file ezWS2812.h.
#include <ezWS2812.h>
Public Member Functions | |
| ezWS2812 (uint16_t num_leds, SPIClass &spi=SPI) | |
| Constructor. | |
| void | begin () |
| Initialize SPI communication. | |
| void | end () |
| End SPI communication. | |
| void | end_transfer () |
| Complete LED data transfer Sends reset signal to latch data into LEDs. | |
| void | set_all (uint8_t red, uint8_t green, uint8_t blue) |
| Set all LEDs to the same color. | |
| void | set_brightness (uint8_t brightness) |
| Set brightness (0-100%) | |
| void | set_pixel (uint8_t red, uint8_t green, uint8_t blue, uint16_t count=1) |
| Set color for specific number of LEDs. | |
Private Member Functions | |
| void | color_to_spi (uint8_t color, uint8_t *buffer) const |
| Convert color byte to SPI bit pattern. | |
| uint8_t | one () const |
| Convert color bit to SPI signal for '1' bit. | |
| uint8_t | zero () const |
| Convert color bit to SPI signal for '0' bit. | |
Private Attributes | |
| uint8_t | brightness_ |
| uint16_t | num_leds_ |
| SPIClass * | spi_ |
Static Private Attributes | |
| static constexpr uint8_t | kResetByte = 0x00 |
| static constexpr uint8_t | kResetBytes = 32 |
| static constexpr uint16_t | kResetTimeUs = 80 |
| static constexpr uint32_t | kSpiClockHz = 6400000 |