|
void | begin () |
|
uint8_t | getPin () const |
|
void | begin (CLEDController &ctrl) |
|
void | show () |
|
void | setPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b) |
|
void | setPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w) |
|
void | setPixelColor (uint16_t n, uint32_t c) |
|
void | fill (uint32_t c=0, uint16_t first=0, uint16_t count=0) |
|
void | setBrightness (uint8_t bright) |
|
void | clear () |
|
void | updateLength (uint16_t n) |
|
bool | canShow () |
|
uint8_t * | getPixels () const |
|
uint8_t | getBrightness () const |
|
uint16_t | numPixels () const |
|
uint32_t | getPixelColor (uint16_t n) const |
|
CRGB * | getLeds () const |
|
CLEDController * | getController () const |
|
void | setBlendWhite (bool blend) |
|
void | setPin (uint16_t p) |
|
void | updateType (neoPixelType T) |
|
template<uint16_t NumLeds, uint8_t DataPin, uint32_t RgbOrder = GRB>
class FastLED_NeoPixel< NumLeds, DataPin, RgbOrder >
FastLED implementation of the Adafruit_NeoPixel class for WS2812B strips, with data.
This is templated for a few reasons:
- It allows the user to create a FastLED_NeoPixel class with (almost) the same syntax as Adafruit_NeoPixel (using template args instead of function arguments):
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
FastLED_NeoPixel<LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800> strip;
For ease of use this is preferable to splitting the arguments (LED_COUNT
) between template and function.
- It allows allocating a static CRGB array for the LED data, so we don't have to use heap allocation with
new()
- It allows us to create a begin() function that calls FastLED.addLeds "automatically" without any other input or arguments. Just like Adafruit_NeoPixel!
The one downside is that this splits the FastLED_NeoPixel and FastLED_NeoPixel_Variant classes, so static calls to FastLED_NeoPixel will fail for lack of template arguments. But that's how the cookie crumbles.
- Template Parameters
-
NumLeds | the number of LEDs in the strip |
DataPin | the number for the data pin connected to the strip |
RgbOrder | the RGB channel order for the strips, either as a NeoPixel define (e.g. NEO_GRB) or a FastLED EOrder enum value (e.g. GRB). By default this is GRB, which is the typical color order for most NeoPixel (WS2812B) strips. |
- See also
- Adafruit_NeoPixel
-
New Functions
-
Unimplemented Functions
- Examples
- Blink.ino, and Strandtest.ino.
This function assigns a CLEDController instance, used for sending the LED data to the strip, to the internal controller pointer. This must be done before any LED data can be written.
To obtain a CLEDController object, call the FastLED.addLeds() function using the relevant template parameters (strip type, data pin(s), and RGB color order) and function parameters (CRGB array pointer and number of LEDs in the strip). E.g.:
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
The addLeds function returns a reference to a static instance of a CLEDController object. The addLeds call can be used directly as an argument for the begin() function.
This is purposefully not done through the constructor to avoid a static initialization order fiasco, as the "FastLED" instance (CFastLED class) that contains the linked list of controllers exists in a separate compilation unit from the main Arduino .ino file.
- Parameters
-
ctrl | reference to assign to the internal controller pointer |
- See also
- Adafruit_NeoPixel::begin()