FastLED NeoPixel v1.0.3
Loading...
Searching...
No Matches
FastLED_NeoPixel_Variant Class Reference

FastLED implementation of the Adafruit_NeoPixel class. Base class for all strips. More...

#include <FastLED_NeoPixel.h>

Inheritance diagram for FastLED_NeoPixel_Variant:
FastLED_NeoPixel< NumLeds, DataPin, RgbOrder >

Public Member Functions

 FastLED_NeoPixel_Variant (CRGB *ledPtr, uint16_t nLeds)
 
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
 
CRGBgetLeds () const
 
CLEDControllergetController () const
 
void setBlendWhite (bool blend)
 
void setPin (uint16_t p)
 
void updateType (neoPixelType T)
 

Static Public Member Functions

static uint8_t sine8 (uint8_t x)
 
static uint8_t gamma8 (uint8_t x)
 
static uint32_t Color (uint8_t r, uint8_t g, uint8_t b)
 
static uint32_t Color (uint8_t r, uint8_t g, uint8_t b, uint8_t w)
 
static uint32_t ColorHSV (uint16_t hue, uint8_t sat=255, uint8_t val=255)
 
static uint32_t gamma32 (uint32_t x)
 
static uint32_t Color (const CRGB &c)
 

Detailed Description

FastLED implementation of the Adafruit_NeoPixel class. Base class for all strips.

This provides a wrapper for the FastLED LED data that mimic the structure of the Adafruit_NeoPixel class. This lets you use an Adafruit_NeoPixel animation with FastLED without having to rewrite it.

This class can be used with any FastLED strip type. The LED data array must be defined externally and linked in the constructor along with the strip size (number of LEDs).

You must also call begin() before data will be sent to the strip. The begin() function takes a reference to the CLEDController returned by the FastLED.addLeds() function.

See also
Adafruit_NeoPixel
New Functions
Unimplemented Functions
Examples
StripVariant.ino.

Constructor & Destructor Documentation

◆ FastLED_NeoPixel_Variant()

FastLED_NeoPixel_Variant::FastLED_NeoPixel_Variant ( CRGB ledPtr,
uint16_t  nLeds 
)

Class constructor for all strip types.

Parameters
ledPtrCRGB pointer to the LED data
nLedsnumber of LEDs in the CRGB array

Member Function Documentation

◆ begin()

void FastLED_NeoPixel_Variant::begin ( CLEDController ctrl)

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
ctrlreference to assign to the internal controller pointer
See also
Adafruit_NeoPixel::begin()

◆ canShow()

bool FastLED_NeoPixel_Variant::canShow ( )

◆ clear()

void FastLED_NeoPixel_Variant::clear ( )

◆ Color() [1/2]

static uint32_t FastLED_NeoPixel_Variant::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inlinestatic

◆ Color() [2/2]

static uint32_t FastLED_NeoPixel_Variant::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  w 
)
inlinestatic

◆ ColorHSV()

static uint32_t FastLED_NeoPixel_Variant::ColorHSV ( uint16_t  hue,
uint8_t  sat = 255,
uint8_t  val = 255 
)
inlinestatic

◆ fill()

void FastLED_NeoPixel_Variant::fill ( uint32_t  c = 0,
uint16_t  first = 0,
uint16_t  count = 0 
)

◆ gamma32()

static uint32_t FastLED_NeoPixel_Variant::gamma32 ( uint32_t  x)
inlinestatic

◆ gamma8()

static uint8_t FastLED_NeoPixel_Variant::gamma8 ( uint8_t  x)
inlinestatic

◆ getBrightness()

uint8_t FastLED_NeoPixel_Variant::getBrightness ( ) const
inline

◆ getPixelColor()

uint32_t FastLED_NeoPixel_Variant::getPixelColor ( uint16_t  n) const

◆ getPixels()

uint8_t * FastLED_NeoPixel_Variant::getPixels ( ) const
inline

◆ numPixels()

uint16_t FastLED_NeoPixel_Variant::numPixels ( ) const
inline

◆ setBrightness()

void FastLED_NeoPixel_Variant::setBrightness ( uint8_t  bright)
inline

◆ setPixelColor() [1/3]

void FastLED_NeoPixel_Variant::setPixelColor ( uint16_t  n,
uint32_t  c 
)

◆ setPixelColor() [2/3]

void FastLED_NeoPixel_Variant::setPixelColor ( uint16_t  n,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

◆ setPixelColor() [3/3]

void FastLED_NeoPixel_Variant::setPixelColor ( uint16_t  n,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  w 
)

◆ show()

void FastLED_NeoPixel_Variant::show ( )

◆ sine8()

static uint8_t FastLED_NeoPixel_Variant::sine8 ( uint8_t  x)
inlinestatic

◆ updateLength()

void FastLED_NeoPixel_Variant::updateLength ( uint16_t  n)

Change the length of the strip object. The strip data is blanked. The pin number and pixel format are unchanged.

Parameters
nNew length of the strip, in pixels.
Warning
This function does not re-allocate the LED array on the heap like Adafruit_NeoPixel. It will not set a length longer than the length of the LED array, as passed in the constructor.
See also
Adafruit_NeoPixel::updateLength(uint16_t)

The documentation for this class was generated from the following files: