WPILibC++ 2024.3.2
|
Class to control a simulated addressable LED. More...
#include <frc/simulation/AddressableLEDSim.h>
Public Member Functions | |
AddressableLEDSim () | |
Constructs for the first addressable LED. More... | |
AddressableLEDSim (const AddressableLED &addressableLED) | |
Constructs from an AddressableLED object. More... | |
std::unique_ptr< CallbackStore > | RegisterInitializedCallback (NotifyCallback callback, bool initialNotify) |
Register a callback on the Initialized property. More... | |
bool | GetInitialized () const |
Check if initialized. More... | |
void | SetInitialized (bool initialized) |
Change the Initialized value of the LED strip. More... | |
std::unique_ptr< CallbackStore > | RegisterOutputPortCallback (NotifyCallback callback, bool initialNotify) |
Register a callback on the output port. More... | |
int | GetOutputPort () const |
Get the output port. More... | |
void | SetOutputPort (int outputPort) |
Change the output port. More... | |
std::unique_ptr< CallbackStore > | RegisterLengthCallback (NotifyCallback callback, bool initialNotify) |
Register a callback on the length. More... | |
int | GetLength () const |
Get the length of the LED strip. More... | |
void | SetLength (int length) |
Change the length of the LED strip. More... | |
std::unique_ptr< CallbackStore > | RegisterRunningCallback (NotifyCallback callback, bool initialNotify) |
Register a callback on whether the LEDs are running. More... | |
int | GetRunning () const |
Check if the LEDs are running. More... | |
void | SetRunning (bool running) |
Change whether the LEDs are active. More... | |
std::unique_ptr< CallbackStore > | RegisterDataCallback (ConstBufferCallback callback, bool initialNotify) |
Register a callback on the LED data. More... | |
int | GetData (struct HAL_AddressableLEDData *data) const |
Get the LED data. More... | |
void | SetData (struct HAL_AddressableLEDData *data, int length) |
Change the LED data. More... | |
Static Public Member Functions | |
static AddressableLEDSim | CreateForChannel (int pwmChannel) |
Creates an AddressableLEDSim for a PWM channel. More... | |
static AddressableLEDSim | CreateForIndex (int index) |
Creates an AddressableLEDSim for a simulated index. More... | |
Class to control a simulated addressable LED.
frc::sim::AddressableLEDSim::AddressableLEDSim | ( | ) |
Constructs for the first addressable LED.
|
explicit |
Constructs from an AddressableLED object.
addressableLED | AddressableLED to simulate |
|
static |
Creates an AddressableLEDSim for a PWM channel.
pwmChannel | PWM channel |
std::out_of_range | if no AddressableLED is configured for that channel |
|
static |
Creates an AddressableLEDSim for a simulated index.
The index is incremented for each simulated AddressableLED.
index | simulator index |
int frc::sim::AddressableLEDSim::GetData | ( | struct HAL_AddressableLEDData * | data | ) | const |
Get the LED data.
data | output parameter to fill with LED data |
bool frc::sim::AddressableLEDSim::GetInitialized | ( | ) | const |
Check if initialized.
int frc::sim::AddressableLEDSim::GetLength | ( | ) | const |
Get the length of the LED strip.
int frc::sim::AddressableLEDSim::GetOutputPort | ( | ) | const |
Get the output port.
int frc::sim::AddressableLEDSim::GetRunning | ( | ) | const |
Check if the LEDs are running.
std::unique_ptr< CallbackStore > frc::sim::AddressableLEDSim::RegisterDataCallback | ( | ConstBufferCallback | callback, |
bool | initialNotify | ||
) |
Register a callback on the LED data.
callback | the callback that will be called whenever the LED data is changed |
initialNotify | if true, the callback will be run on the initial value |
std::unique_ptr< CallbackStore > frc::sim::AddressableLEDSim::RegisterInitializedCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
Register a callback on the Initialized property.
callback | the callback that will be called whenever the Initialized property is changed |
initialNotify | if true, the callback will be run on the initial value |
std::unique_ptr< CallbackStore > frc::sim::AddressableLEDSim::RegisterLengthCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
Register a callback on the length.
callback | the callback that will be called whenever the length is changed |
initialNotify | if true, the callback will be run on the initial value |
std::unique_ptr< CallbackStore > frc::sim::AddressableLEDSim::RegisterOutputPortCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
Register a callback on the output port.
callback | the callback that will be called whenever the output port is changed |
initialNotify | if true, the callback will be run on the initial value |
std::unique_ptr< CallbackStore > frc::sim::AddressableLEDSim::RegisterRunningCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
Register a callback on whether the LEDs are running.
callback | the callback that will be called whenever the LED state is changed |
initialNotify | if true, the callback will be run on the initial value |
void frc::sim::AddressableLEDSim::SetData | ( | struct HAL_AddressableLEDData * | data, |
int | length | ||
) |
Change the LED data.
data | the new data |
length | the length of the LED data |
void frc::sim::AddressableLEDSim::SetInitialized | ( | bool | initialized | ) |
Change the Initialized value of the LED strip.
initialized | the new value |
void frc::sim::AddressableLEDSim::SetLength | ( | int | length | ) |
Change the length of the LED strip.
length | the new value |
void frc::sim::AddressableLEDSim::SetOutputPort | ( | int | outputPort | ) |
Change the output port.
outputPort | the new output port |
void frc::sim::AddressableLEDSim::SetRunning | ( | bool | running | ) |
Change whether the LEDs are active.
running | the new value |