Package edu.wpi.first.wpilibj.simulation
Class AddressableLEDSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.AddressableLEDSim
Class to control a simulated addressable LED.
-
Constructor Summary
ConstructorsConstructorDescriptionAddressableLEDSim
(int channel) Constructs an addressable LED for a specific channel.AddressableLEDSim
(AddressableLED addressableLED) Constructs from an AddressableLED object. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getData()
Get the LED data.static byte[]
getGlobalData
(int start, int length) Get the global LED data.boolean
Check if initialized.int
Get the length of the LED strip.int
getStart()
Get the start.static CallbackStore
registerDataCallback
(ConstBufferCallback callback) Register a callback on the LED data.registerInitializedCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the Initialized property.registerLengthCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the length.registerStartCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the start.void
Reset all simulation data for this LED object.void
setData
(byte[] data) Change the LED data.static void
setGlobalData
(int start, byte[] data) Change the global LED data.void
setInitialized
(boolean initialized) Change the Initialized value of the LED strip.void
setLength
(int length) Change the length of the LED strip.void
setStart
(int start) Change the start.
-
Constructor Details
-
AddressableLEDSim
Constructs an addressable LED for a specific channel.- Parameters:
channel
- output channel
-
AddressableLEDSim
Constructs from an AddressableLED object.- Parameters:
addressableLED
- AddressableLED to simulate
-
-
Method Details
-
registerInitializedCallback
Register a callback on the Initialized property.- Parameters:
callback
- the callback that will be called whenever the Initialized property is changedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getInitialized
Check if initialized.- Returns:
- true if initialized
-
setInitialized
Change the Initialized value of the LED strip.- Parameters:
initialized
- the new value
-
registerStartCallback
Register a callback on the start.- Parameters:
callback
- the callback that will be called whenever the start is changedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getStart
Get the start.- Returns:
- the start
-
setStart
Change the start.- Parameters:
start
- the new start
-
registerLengthCallback
Register a callback on the length.- Parameters:
callback
- the callback that will be called whenever the length is changedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getLength
Get the length of the LED strip.- Returns:
- the length
-
setLength
Change the length of the LED strip.- Parameters:
length
- the new value
-
registerDataCallback
Register a callback on the LED data.- Parameters:
callback
- the callback that will be called whenever the LED data is changed- Returns:
- the
CallbackStore
object associated with this callback.
-
getData
Get the LED data.- Returns:
- the LED data
-
setData
Change the LED data.- Parameters:
data
- the new data
-
getGlobalData
Get the global LED data.- Parameters:
start
- start, in LEDslength
- length, in LEDs- Returns:
- the LED data
-
setGlobalData
Change the global LED data.- Parameters:
start
- start, in LEDsdata
- the new data
-
resetData
Reset all simulation data for this LED object.
-