My Project
 All Classes Functions Variables Pages
Public Member Functions | Protected Attributes | List of all members
SmartLED Class Referenceabstract
Inheritance diagram for SmartLED:
Apa102

Public Member Functions

uint32_t getBrightness ()
 Get the brightness as a percentage. More...
 
uint16_t getPixelCount ()
 Return the number of pixels in the chain. More...
 
virtual void init ()=0
 
virtual void show ()=0
 
void setBrightness (uint32_t percent)
 Set the brightness as a percentage. More...
 
void setColorOrder (char *order)
 Set the color order of data sent to the LEDs. More...
 
void setPixel (uint16_t index, uint8_t red, uint8_t green, uint8_t blue)
 Set the given pixel to the specified color. More...
 
void setPixel (uint16_t index, pixel_t pixel)
 Set the given pixel to the specified color. More...
 
void setPixel (uint16_t index, uint32_t pixel)
 Set the given pixel to the specified color. More...
 
void setPixelCount (uint16_t pixelCount)
 
void setHSBPixel (uint16_t index, uint16_t hue, uint8_t saturation, uint8_t brightness)
 Set the given pixel to the specified HSB color. More...
 
void clear ()
 Clear all the pixel colors. More...
 

Protected Attributes

uint32_t m_brightness
 
char * m_colorOrder
 
uint16_t m_pixelCount
 
pixel_tm_pixels
 

Member Function Documentation

void SmartLED::clear ( )

Clear all the pixel colors.

This sets all the pixels to off which is no brightness for all of the color channels. The LEDs are not actually updated until a call to show() is subsequently made.

uint32_t SmartLED::getBrightness ( )

Get the brightness as a percentage.

Returns
The brightness as a percentage.
uint16_t SmartLED::getPixelCount ( )

Return the number of pixels in the chain.

Returns
The number of pixels in the chain as previously set by setPixelCount().
void SmartLED::setBrightness ( uint32_t  percent)

Set the brightness as a percentage.

Parameters
[in]percentThe brightness.
void SmartLED::setColorOrder ( char *  colorOrder)

Set the color order of data sent to the LEDs.

Data is sent to the WS2812s in a serial fashion. There are 8 bits of data for each of the three channel colors (red, green and blue). The WS2812 LEDs typically expect the data to arrive in the order of "green" then "red" then "blue". However, this has been found to vary between some models and manufacturers. What this means is that some want "red", "green", "blue" and still others have their own orders. This function can be called to override the default ordering of "GRB". We can specify an alternate order by supply an alternate three character string made up of 'R', 'G' and 'B' for example "RGB".

void SmartLED::setHSBPixel ( uint16_t  index,
uint16_t  hue,
uint8_t  saturation,
uint8_t  brightness 
)

Set the given pixel to the specified HSB color.

The LEDs are not actually updated until a call to show().

Parameters
[in]indexThe pixel that is to have its color set.
[in]hueThe amount of hue in the pixel (0-360).
[in]saturationThe amount of saturation in the pixel (0-255).
[in]brightnessThe amount of brightness in the pixel (0-255).
void SmartLED::setPixel ( uint16_t  index,
uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Set the given pixel to the specified color.

The LEDs are not actually updated until a call to show() is subsequently made.

Parameters
[in]indexThe pixel that is to have its color set.
[in]redThe amount of red in the pixel.
[in]greenThe amount of green in the pixel.
[in]blueThe amount of blue in the pixel.
void SmartLED::setPixel ( uint16_t  index,
pixel_t  pixel 
)

Set the given pixel to the specified color.

The LEDs are not actually updated until a call to show().

Parameters
[in]indexThe pixel that is to have its color set.
[in]pixelThe color value of the pixel.
void SmartLED::setPixel ( uint16_t  index,
uint32_t  pixel 
)

Set the given pixel to the specified color.

The LEDs are not actually updated until a call to show().

Parameters
[in]indexThe pixel that is to have its color set.
[in]pixelThe color value of the pixel.

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