OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
LEDStrip Class Reference

Low-level interface to LED strips. More...

#include <OutputHardware.hpp>

Public Member Functions

 LEDStrip (OutputGPIO dataPin, uint8_t pixelCount, bool useLevelShift, PixelDriver pixelType=PixelDriver::WS2812, PixelFormat pixelFormat=PixelFormat::AUTO)
 Create an LED strip object.
 
uint8_t getPixelCount ()
 Retrieve the pixel count in the strip.
 
void brightness (uint8_t value)
 Set global LED brightness.
 
void clear ()
 Turn off all LEDs.
 
void pixelRGB (uint8_t pixelIndex, uint8_t redChannel, uint8_t greenChannel, uint8_t blueChannel)
 Set pixel color in RGB format.
 
void pixelRangeRGB (uint8_t fromPixelIndex, uint8_t toPixelIndex, uint8_t redChannel, uint8_t greenChannel, uint8_t blueChannel)
 Set color (in RGB format) to a range of pixels.
 
void pixelRGB (uint8_t pixelIndex, uint32_t packedRGB)
 Set pixel color in RGB format.
 
void pixelRangeRGB (uint8_t fromPixelIndex, uint8_t toPixelIndex, uint32_t packedRGB)
 Set color (in RGB format) to a range of pixels.
 
void shiftToNext ()
 Shift all pixel colors to the next pixel index.
 
void shiftToPrevious ()
 Shift all pixel colors to the previous pixel index.
 
void show ()
 Show pixel colors.
 

Detailed Description

Low-level interface to LED strips.

Definition at line 29 of file OutputHardware.hpp.

Constructor & Destructor Documentation

◆ LEDStrip()

LEDStrip::LEDStrip ( OutputGPIO dataPin,
uint8_t pixelCount,
bool useLevelShift,
PixelDriver pixelType = PixelDriver::WS2812,
PixelFormat pixelFormat = PixelFormat::AUTO )

Create an LED strip object.

Parameters
dataPinGPIO number attached to Din (data input).
pixelCountTotal count of pixels in the strip.
useLevelShiftSet to false when using 3.3V logic. Set to true when using the level shifter in open-drain mode.
pixelTypePixel driver.
pixelFormatFormat of color data (byte order). Set to AUTO for auto-detection.

Member Function Documentation

◆ brightness()

void LEDStrip::brightness ( uint8_t value)
inline

Set global LED brightness.

Parameters
valueBrightness. 255 is the highest and 0 will turn all LEDs off.
Note
LEDs are very bright. Keep this value low for a comfortable experience. Defaults to 15 (decimal).

Definition at line 70 of file OutputHardware.hpp.

◆ clear()

void LEDStrip::clear ( )

Turn off all LEDs.

Note
Effective after show() is called.

◆ getPixelCount()

uint8_t LEDStrip::getPixelCount ( )
inline

Retrieve the pixel count in the strip.

Returns
uint8_t Pixel count.

Definition at line 57 of file OutputHardware.hpp.

◆ pixelRangeRGB() [1/2]

void LEDStrip::pixelRangeRGB ( uint8_t fromPixelIndex,
uint8_t toPixelIndex,
uint32_t packedRGB )
inline

Set color (in RGB format) to a range of pixels.

Parameters
fromPixelIndexIndex of the first pixel.
toPixelIndexIndex of the last pixel.
packedRGBPixel color in packet RGB format

Definition at line 135 of file OutputHardware.hpp.

◆ pixelRangeRGB() [2/2]

void LEDStrip::pixelRangeRGB ( uint8_t fromPixelIndex,
uint8_t toPixelIndex,
uint8_t redChannel,
uint8_t greenChannel,
uint8_t blueChannel )

Set color (in RGB format) to a range of pixels.

Parameters
fromPixelIndexIndex of the first pixel.
toPixelIndexIndex of the last pixel.
redChannelRed component of the color.
greenChannelGreen component of the color.
blueChannelBlue component of the color.
Note
Effective after show() is called.

◆ pixelRGB() [1/2]

void LEDStrip::pixelRGB ( uint8_t pixelIndex,
uint32_t packedRGB )
inline

Set pixel color in RGB format.

Parameters
pixelIndexIndex of the pixel.
packedRGBPixel color in packet RGB format

Definition at line 118 of file OutputHardware.hpp.

◆ pixelRGB() [2/2]

void LEDStrip::pixelRGB ( uint8_t pixelIndex,
uint8_t redChannel,
uint8_t greenChannel,
uint8_t blueChannel )

Set pixel color in RGB format.

Parameters
pixelIndexIndex of the pixel in the strip.
redChannelRed component of the color.
greenChannelGreen component of the color.
blueChannelBlue component of the color.
Note
Effective after show() is called.

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