Adafruit WS2801 Library
Public Member Functions | List of all members
Adafruit_WS2801 Class Reference

Class that stores state and functions for interacting with WS2801 LEDs. More...

#include <Adafruit_WS2801.h>

Public Member Functions

 Adafruit_WS2801 (uint16_t n, uint8_t dpin, uint8_t cpin, uint8_t order=WS2801_RGB)
 Constructor for use with arbitrary clock/data pins. More...
 
 Adafruit_WS2801 (uint16_t x, uint16_t y, uint8_t dpin, uint8_t cpin, uint8_t order=WS2801_RGB)
 Constructor for use with a matrix configuration, specify w, h for size of matrix. More...
 
 Adafruit_WS2801 (uint16_t n, uint8_t order=WS2801_RGB)
 Constructor for use with hardware SPI (specific clock/data pins) More...
 
 Adafruit_WS2801 ()
 Empty constructor; init pins/strand length/data order later:
 
 ~Adafruit_WS2801 ()
 Release memory (as needed):
 
void begin (void)
 Activate SPI.
 
void show (void)
 Shows the pixels.
 
void setPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b)
 Set pixel color from separate 8-bit R, G, B components. More...
 
void setPixelColor (uint16_t n, uint32_t c)
 Set pixel color from 'packed' 32-bit RGB value. More...
 
void setPixelColor (uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b)
 Set pixel color from separate 8-bit R, G, B components using x,y coordinate system. More...
 
void setPixelColor (uint16_t x, uint16_t y, uint32_t c)
 Set pixel color from 'packed' 32-bit RGB value using x,y coordinate system: More...
 
void clear ()
 Clear the entire string.
 
void updatePins (uint8_t dpin, uint8_t cpin)
 Change pin assignment post-constructor, using arbitrary pins. More...
 
void updatePins (void)
 Change pin assignment post-constructor, switching to hardware SPI.
 
void updateLength (uint16_t n)
 Change strand length. More...
 
void updateOrder (uint8_t order)
 Change RGB data order. More...
 
uint16_t numPixels (void)
 Returns the number of pixels currently connected. More...
 
uint32_t getPixelColor (uint16_t n)
 Query color from previously-set pixel. More...
 

Detailed Description

Class that stores state and functions for interacting with WS2801 LEDs.

Constructor & Destructor Documentation

◆ Adafruit_WS2801() [1/3]

Adafruit_WS2801::Adafruit_WS2801 ( uint16_t  n,
uint8_t  dpin,
uint8_t  cpin,
uint8_t  order = WS2801_RGB 
)

Constructor for use with arbitrary clock/data pins.

Parameters
nHow many LEDs there are
dpinData pin
cpinClock pin
orderRGB or GRB

◆ Adafruit_WS2801() [2/3]

Adafruit_WS2801::Adafruit_WS2801 ( uint16_t  x,
uint16_t  y,
uint8_t  dpin,
uint8_t  cpin,
uint8_t  order = WS2801_RGB 
)

Constructor for use with a matrix configuration, specify w, h for size of matrix.

Parameters
xWidth of the matrix
yHeight of the matrix
dpinData pin
cpinClock pin
orderRGB or GRB

◆ Adafruit_WS2801() [3/3]

Adafruit_WS2801::Adafruit_WS2801 ( uint16_t  n,
uint8_t  order = WS2801_RGB 
)

Constructor for use with hardware SPI (specific clock/data pins)

Parameters
n
order

Member Function Documentation

◆ setPixelColor() [1/4]

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

Set pixel color from separate 8-bit R, G, B components.

Parameters
nPixel to set
rRed value
gGreen value
bBlue value

◆ setPixelColor() [2/4]

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

Set pixel color from 'packed' 32-bit RGB value.

Parameters
nPixel to set
cpacked 32-bit RGB value to set the pixel

◆ setPixelColor() [3/4]

void Adafruit_WS2801::setPixelColor ( uint16_t  x,
uint16_t  y,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Set pixel color from separate 8-bit R, G, B components using x,y coordinate system.

Parameters
xPixel x
yPixel y
rRed value
gGreen value
bBlue value

◆ setPixelColor() [4/4]

void Adafruit_WS2801::setPixelColor ( uint16_t  x,
uint16_t  y,
uint32_t  c 
)

Set pixel color from 'packed' 32-bit RGB value using x,y coordinate system:

Parameters
xPixel x
yPixel y
cpacked 32-bit RGB value to set the pixel

◆ updatePins()

void Adafruit_WS2801::updatePins ( uint8_t  dpin,
uint8_t  cpin 
)

Change pin assignment post-constructor, using arbitrary pins.

Parameters
dpinData pin
cpinClock pin

◆ updateLength()

void Adafruit_WS2801::updateLength ( uint16_t  n)

Change strand length.

Parameters
nLength to change to

◆ updateOrder()

void Adafruit_WS2801::updateOrder ( uint8_t  order)

Change RGB data order.

Parameters
orderOrder to switch to

◆ numPixels()

uint16_t Adafruit_WS2801::numPixels ( void  )

Returns the number of pixels currently connected.

Returns
Returns the number of connected pixels

◆ getPixelColor()

uint32_t Adafruit_WS2801::getPixelColor ( uint16_t  n)

Query color from previously-set pixel.

Parameters
nPixel to query
Returns
Returns packed 32-bit RGB value

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