A class for driving addressable LEDs, such as WS2812B, WS2815, and NeoPixels.
More...
#include <frc/AddressableLED.h>
|
static void | SetGlobalData (int start, ColorOrder colorOrder, std::span< const LEDData > ledData) |
| Sets the LED output data at an arbitrary location in the global buffer.
|
|
A class for driving addressable LEDs, such as WS2812B, WS2815, and NeoPixels.
Some LEDs use a different color order than the default GRB. The color order is configurable using SetColorOrder().
Up to 1024 LEDs may be controlled in total across all AddressableLED instances. A single global buffer is used for all instances. The start position used for LED data for the output is set via SetStart() and the length of the strip is set via SetLength(). Both of these default to zero, so multiple instances will access the same pixel data unless SetStart() is called to adjust the starting point.
◆ ColorOrder
Order that color data is sent over the wire.
Enumerator |
---|
kRGB | RGB order.
|
kRBG | RBG order.
|
kBGR | BGR order.
|
kBRG | BRG order.
|
kGBR | GBR order.
|
kGRB | GRB order. This is the default order.
|
◆ AddressableLED() [1/2]
frc::AddressableLED::AddressableLED |
( |
int | channel | ) |
|
|
explicit |
Constructs a new driver for a specific channel.
- Parameters
-
channel | the output channel to use |
◆ AddressableLED() [2/2]
◆ GetChannel()
int frc::AddressableLED::GetChannel |
( |
| ) |
const |
|
inline |
Gets the channel for this addressable LED.
- Returns
- channel
◆ GetStart()
int frc::AddressableLED::GetStart |
( |
| ) |
const |
|
inline |
Gets the display start of the LED strip in the global buffer.
- Returns
- the strip start, in LEDs
◆ operator=()
◆ SetColorOrder()
void frc::AddressableLED::SetColorOrder |
( |
ColorOrder | order | ) |
|
Sets the color order for this AddressableLED.
The default order is GRB.
This will take effect on the next call to SetData().
- Parameters
-
◆ SetData() [1/2]
void frc::AddressableLED::SetData |
( |
std::initializer_list< LEDData > | ledData | ) |
|
Sets the LED output data.
This will write to the global buffer starting at the location set by SetStart() and up to the length set by SetLength().
- Parameters
-
ledData | the buffer to write |
◆ SetData() [2/2]
void frc::AddressableLED::SetData |
( |
std::span< const LEDData > | ledData | ) |
|
Sets the LED output data.
This will write to the global buffer starting at the location set by SetStart() and up to the length set by SetLength().
- Parameters
-
ledData | the buffer to write |
◆ SetGlobalData()
static void frc::AddressableLED::SetGlobalData |
( |
int | start, |
|
|
ColorOrder | colorOrder, |
|
|
std::span< const LEDData > | ledData ) |
|
static |
Sets the LED output data at an arbitrary location in the global buffer.
- Parameters
-
start | the start location, in LEDs |
colorOrder | the color order |
ledData | the buffer to write |
◆ SetLength()
void frc::AddressableLED::SetLength |
( |
int | length | ) |
|
Sets the length of the LED strip.
- Parameters
-
length | the strip length, in LEDs |
◆ SetStart()
void frc::AddressableLED::SetStart |
( |
int | start | ) |
|
Sets the display start of the LED strip in the global buffer.
- Parameters
-
start | the strip start, in LEDs |
The documentation for this class was generated from the following file: