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 Types

using pixel_vector_type = typename ::std::vector<Pixel>
 Pixel vector type.
 

Public Member Functions

 LEDStrip (OutputGPIO dataPin, uint8_t pixelCount, bool useLevelShift, PixelDriver driver=PixelDriver::WS2812, bool reverse_display=false)
 Create an LED strip.
 
virtual ~LEDStrip ()
 Destructor.
 
 LEDStrip (LEDStrip &&other)
 Move constructor.
 
LEDStripoperator= (LEDStrip &&other)
 Move-assignment.
 
 LEDStrip (const LEDStrip &other)=delete
 Copy constructor (deleted)
 
LEDStripoperator= (const LEDStrip &other)=delete
 Copy-assignment (deleted)
 
uint8_t getPixelCount ()
 Retrieve the pixel count in the strip.
 
void brightness (uint8_t value)
 Set the global brightness.
 
pixel_vector_type pixelVector (const Pixel &color=0)
 Create a vector of pixels suitable for this LED strip.
 
void clear ()
 Turn off all LEDs immediately.
 
void show (const pixel_vector_type &pixels)
 Show pixels all at once.
 

Detailed Description

Low-level interface to LED strips.

Definition at line 110 of file OutputHardware.hpp.

Member Typedef Documentation

◆ pixel_vector_type

using LEDStrip::pixel_vector_type = typename ::std::vector<Pixel>

Pixel vector type.

Definition at line 114 of file OutputHardware.hpp.

Constructor & Destructor Documentation

◆ LEDStrip() [1/2]

LEDStrip::LEDStrip ( OutputGPIO dataPin,
uint8_t pixelCount,
bool useLevelShift,
PixelDriver driver = PixelDriver::WS2812,
bool reverse_display = false )

Create an LED strip.

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.
driverPixel driver
reverse_displayTrue if the logical arrangement of the pixels is the inverse of their physical arrangement

◆ LEDStrip() [2/2]

LEDStrip::LEDStrip ( LEDStrip && other)

Move constructor.

Parameters
otherInstance to be moved

Member Function Documentation

◆ brightness()

void LEDStrip::brightness ( uint8_t value)
inline

Set the global 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 127 (decimal).

Definition at line 176 of file OutputHardware.hpp.

◆ clear()

void LEDStrip::clear ( )
inline

Turn off all LEDs immediately.

Definition at line 194 of file OutputHardware.hpp.

◆ getPixelCount()

uint8_t LEDStrip::getPixelCount ( )
inline

Retrieve the pixel count in the strip.

Returns
uint8_t Pixel count

Definition at line 163 of file OutputHardware.hpp.

◆ operator=()

LEDStrip & LEDStrip::operator= ( LEDStrip && other)

Move-assignment.

Parameters
otherInstance to be moved

◆ pixelVector()

pixel_vector_type LEDStrip::pixelVector ( const Pixel & color = 0)
inline

Create a vector of pixels suitable for this LED strip.

Parameters
colorInitial color for all pixels (defaults to black)
Returns
PixelVector Pixel vector (ownership transferred to the caller)

Definition at line 184 of file OutputHardware.hpp.

◆ show()

void LEDStrip::show ( const pixel_vector_type & pixels)

Show pixels all at once.

Parameters
pixelsPixel vector

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