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

friend class More...

#include <ws_pixels.h>

Public Member Functions

 ~ws_pixels ()
 Destructor.
 
bool addStrand (wippersnapper_pixels_v1_PixelsCreateRequest *pixelsCreateReqMsg)
 Initializes a strand of addressable RGB Pixels. More...
 
void deleteStrand (wippersnapper_pixels_v1_PixelsDeleteRequest *pixelsDeleteMsg)
 Deletes a strand_t from strands, deinitializes a strand, and frees its resources. More...
 
void fillStrand (wippersnapper_pixels_v1_PixelsWriteRequest *pixelsWriteMsg)
 Writes a color from Adafruit IO to a strand of addressable pixels. More...
 
int16_t allocateStrand ()
 Allocates an index of a free strand_t within the strand array. More...
 
void deallocateStrand (int16_t strandIdx)
 Deallocates a strand_t within strands, provided an index. More...
 
int getStrandIdx (int16_t pin, wippersnapper_pixels_v1_PixelsType type)
 Obtains the index of a strand_t within array of strands. More...
 
neoPixelType getNeoPixelStrandOrder (wippersnapper_pixels_v1_PixelsOrder pixelOrder)
 Returns the neoPixelType provided the strand's pixelOrder. More...
 
uint8_t getDotStarStrandOrder (wippersnapper_pixels_v1_PixelsOrder pixelOrder)
 Returns the color order of the DotStar strand. More...
 
void publishAddStrandResponse (bool is_success, char *pixels_pin_data)
 Creates a PixelsResponse message and publishes it to IO. More...
 
uint32_t getGammaCorrectedColor (uint32_t pixel_color, strand_s strand)
 Gets the gamma-corrected color, provided a pixel_color. More...
 

Detailed Description

friend class

Class for managing and interfacing with strands of addressable RGB LED pixels.

Member Function Documentation

◆ addStrand()

bool ws_pixels::addStrand ( wippersnapper_pixels_v1_PixelsCreateRequest *  pixelsCreateReqMsg)

Initializes a strand of addressable RGB Pixels.

Parameters
pixelsCreateReqMsgPointer to strand init. request message
Returns
True if successfully initialized, False otherwise.

◆ deleteStrand()

void ws_pixels::deleteStrand ( wippersnapper_pixels_v1_PixelsDeleteRequest *  pixelsDeleteMsg)

Deletes a strand_t from strands, deinitializes a strand, and frees its resources.

Parameters
pixelsDeleteMsgProtobuf message from Adafruit IO containing a wippersnapper_pixels_v1_PixelsDeleteRequest.

◆ fillStrand()

void ws_pixels::fillStrand ( wippersnapper_pixels_v1_PixelsWriteRequest *  pixelsWriteMsg)

Writes a color from Adafruit IO to a strand of addressable pixels.

Parameters
pixelsWriteMsgProtobuf message from Adafruit IO containing a wippersnapper_pixels_v1_PixelsWriteRequest.

◆ allocateStrand()

int16_t ws_pixels::allocateStrand ( )

Allocates an index of a free strand_t within the strand array.

Returns
Index of a free strand_t, ERR_INVALID_STRAND if strand array is full.

◆ deallocateStrand()

void ws_pixels::deallocateStrand ( int16_t  strandIdx)

Deallocates a strand_t within strands, provided an index.

Parameters
strandIdxThe desired index of a strand_t within strands.

◆ getStrandIdx()

int ws_pixels::getStrandIdx ( int16_t  dataPin,
wippersnapper_pixels_v1_PixelsType  type 
)

Obtains the index of a strand_t within array of strands.

Parameters
dataPinstrand_t's data dataPin
typeType of strand_t, NeoPixel or DotStar.
Returns
The index of a strand_t if within strands[], ERR_INVALID_STRAND otherwise.

◆ getNeoPixelStrandOrder()

neoPixelType ws_pixels::getNeoPixelStrandOrder ( wippersnapper_pixels_v1_PixelsOrder  pixelOrder)

Returns the neoPixelType provided the strand's pixelOrder.

Parameters
pixelOrderDesired pixel order, from init. message.
Returns
Type of NeoPixel strand, usable by Adafruit_NeoPixel constructor

◆ getDotStarStrandOrder()

uint8_t ws_pixels::getDotStarStrandOrder ( wippersnapper_pixels_v1_PixelsOrder  pixelOrder)

Returns the color order of the DotStar strand.

Parameters
pixelOrderDesired pixel order, from init. message.
Returns
Type of DotStar strand.

◆ publishAddStrandResponse()

void ws_pixels::publishAddStrandResponse ( bool  is_success,
char *  pixels_pin_data 
)

Creates a PixelsResponse message and publishes it to IO.

Parameters
is_successTrue if addStrand() succeeded, False otherwise.
pixels_pin_dataThe strand's data pin..

◆ getGammaCorrectedColor()

uint32_t ws_pixels::getGammaCorrectedColor ( uint32_t  pixel_color,
strand_s  strand 
)

Gets the gamma-corrected color, provided a pixel_color.

Parameters
pixel_colorStrand's color from Adafruit IO.
strandDesired strand struct. to access.
Returns
A gamma-corrected strand color

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