Class that stores state and functions for interacting with LPD8806 LED strips.
More...
#include <LPD8806.h>
|
| LPD8806 (uint16_t n, uint8_t dpin, uint8_t cpin) |
| Instantiates a new LPD8806 class using Software SPI. More...
|
|
| LPD8806 (uint16_t n) |
| Instantiates a new LPD8806 class using Hardware SPI. Can also be used to create an object where we define the number of LEDs and pins later. More...
|
|
void | begin (void) |
| Activate hard/soft SPI as appropriate.
|
|
void | setPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b) |
| Set pixel color from separate 7-bit R, G, B components. More...
|
|
void | setPixelColor (uint16_t n, uint32_t c) |
| Set pixel color from 'packed' 32-bit GRB (not RGB) value. More...
|
|
void | setPixelColorRGB (uint16_t n, uint32_t c) |
| Set pixel color from 'packed' 32-bit RGB value. More...
|
|
void | show (void) |
| Writes all the LED data to the strip at once!
|
|
void | updatePins (uint8_t dpin, uint8_t cpin) |
| Change pin assignments post-constructor, switching to software SPI. More...
|
|
void | updatePins (void) |
| Change pin assignments post-constructor, switching to hardware SPI.
|
|
void | updateLength (uint16_t n) |
| Change strip length, calls malloc and free! More...
|
|
uint16_t | numPixels (void) |
| Retrieve number of LEDs in strip. More...
|
|
uint32_t | Color (byte, byte, byte) |
| Convert separate R,G,B into combined 32-bit GRB color. More...
|
|
uint32_t | getPixelColor (uint16_t n) |
| Query color from previously-set pixel (returns packed 32-bit GRB value) More...
|
|
Class that stores state and functions for interacting with LPD8806 LED strips.
◆ LPD8806() [1/2]
LPD8806::LPD8806 |
( |
uint16_t |
n, |
|
|
uint8_t |
dpin, |
|
|
uint8_t |
cpin |
|
) |
| |
Instantiates a new LPD8806 class using Software SPI.
- Parameters
-
n | Number of pixels we will be addressing |
dpin | Our bit-bang data pin |
cpin | Our bit-bag clock pin |
◆ LPD8806() [2/2]
LPD8806::LPD8806 |
( |
uint16_t |
n | ) |
|
Instantiates a new LPD8806 class using Hardware SPI. Can also be used to create an object where we define the number of LEDs and pins later.
- Parameters
-
n | Number of pixels we will be addressing. If not passed in make sure to call updateLength() later! |
◆ setPixelColor() [1/2]
void LPD8806::setPixelColor |
( |
uint16_t |
n, |
|
|
uint8_t |
r, |
|
|
uint8_t |
g, |
|
|
uint8_t |
b |
|
) |
| |
Set pixel color from separate 7-bit R, G, B components.
- Parameters
-
n | Pixel # to change (0 is first pixel) |
r | Red value, 0-127 |
g | Green value, 0-127 |
b | Blue value, 0-127 |
◆ setPixelColor() [2/2]
void LPD8806::setPixelColor |
( |
uint16_t |
n, |
|
|
uint32_t |
c |
|
) |
| |
Set pixel color from 'packed' 32-bit GRB (not RGB) value.
- Parameters
-
n | Pixel # to change (0 is first pixel) |
c | Packed color word |
◆ setPixelColorRGB()
void LPD8806::setPixelColorRGB |
( |
uint16_t |
n, |
|
|
uint32_t |
c |
|
) |
| |
Set pixel color from 'packed' 32-bit RGB value.
- Parameters
-
n | Pixel # to change (0 is first pixel) |
c | Packed color word |
◆ updatePins()
void LPD8806::updatePins |
( |
uint8_t |
dpin, |
|
|
uint8_t |
cpin |
|
) |
| |
Change pin assignments post-constructor, switching to software SPI.
- Parameters
-
dpin | Our bit-bang data pin |
cpin | Our bit-bag clock pin |
◆ updateLength()
void LPD8806::updateLength |
( |
uint16_t |
n | ) |
|
Change strip length, calls malloc and free!
- Parameters
-
n | New number of LEDs in strip |
◆ numPixels()
uint16_t LPD8806::numPixels |
( |
void |
| ) |
|
Retrieve number of LEDs in strip.
- Returns
- Number of LEDs in strip
◆ Color()
uint32_t LPD8806::Color |
( |
byte |
r, |
|
|
byte |
g, |
|
|
byte |
b |
|
) |
| |
Convert separate R,G,B into combined 32-bit GRB color.
- Parameters
-
r | Red value, 0-127 |
g | Green value, 0-127 |
b | Blue value, 0-127 |
- Returns
- 21-bit color value in uint32_t with red, green and blue packed
◆ getPixelColor()
uint32_t LPD8806::getPixelColor |
( |
uint16_t |
n | ) |
|
Query color from previously-set pixel (returns packed 32-bit GRB value)
- Parameters
-
n | Pixel # to change (0 is first pixel) |
- Returns
- Packed color word
The documentation for this class was generated from the following files: