Package edu.wpi.first.hal
Class AddressableLEDJNI
java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.AddressableLEDJNI
public class AddressableLEDJNI extends JNIWrapper
Addressable LED HAL JNI Methods.
- See Also:
- "hal/AdressableLED.h"
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description AddressableLEDJNI()
-
Method Summary
Modifier and Type Method Description static void
free(int handle)
Free the Addressable LED Handle.static int
initialize(int pwmHandle)
Initialize Addressable LED using a PWM Digital handle.static void
setBitTiming(int handle, int highTime0NanoSeconds, int lowTime0NanoSeconds, int highTime1NanoSeconds, int lowTime1NanoSeconds)
Sets the bit timing.static void
setData(int handle, byte[] data)
Sets the led output data.static void
setLength(int handle, int length)
Sets the length of the LED strip.static void
setSyncTime(int handle, int syncTimeMicroSeconds)
Sets the sync time.static void
start(int handle)
Starts the output.static void
stop(int handle)
Stops the output.
-
Constructor Details
-
AddressableLEDJNI
public AddressableLEDJNI()
-
-
Method Details
-
initialize
Initialize Addressable LED using a PWM Digital handle.- Parameters:
pwmHandle
- handle of the digital port for PWM- Returns:
- Addressable LED handle
- See Also:
- "HAL_InitializeAddressableLED"
-
free
Free the Addressable LED Handle.- Parameters:
handle
- the Addressable LED handle to free- See Also:
- "HAL_FreeAddressableLED"
-
setLength
Sets the length of the LED strip.The max length is 5460 LEDs.
- Parameters:
handle
- the Addressable LED handlelength
- the strip length- See Also:
- "HAL_SetAddressableLEDLength"
-
setData
Sets the led output data.If the output is enabled, this will start writing the next data cycle. It is safe to call, even while output is enabled.
- Parameters:
handle
- the Addressable LED handledata
- the buffer to write- See Also:
- "HAL_WriteAddressableLEDData"
-
setBitTiming
public static void setBitTiming(int handle, int highTime0NanoSeconds, int lowTime0NanoSeconds, int highTime1NanoSeconds, int lowTime1NanoSeconds)Sets the bit timing.By default, the driver is set up to drive WS2812Bs, so nothing needs to be set for those.
- Parameters:
handle
- the Addressable LED handlehighTime0NanoSeconds
- high time for 0 bit (default 400ns)lowTime0NanoSeconds
- low time for 0 bit (default 900ns)highTime1NanoSeconds
- high time for 1 bit (default 900ns)lowTime1NanoSeconds
- low time for 1 bit (default 600ns)- See Also:
- "HAL_SetAddressableLEDBitTiming"
-
setSyncTime
Sets the sync time.The sync time is the time to hold output so LEDs enable. Default set for WS2812B.
- Parameters:
handle
- the Addressable LED handlesyncTimeMicroSeconds
- the sync time (default 280us)- See Also:
- "HAL_SetAddressableLEDSyncTime"
-
start
Starts the output.The output writes continuously.
- Parameters:
handle
- the Addressable LED handle- See Also:
- "HAL_StartAddressableLEDOutput"
-
stop
Stops the output.- Parameters:
handle
- the Addressable LED handle- See Also:
- "HAL_StopAddressableLEDOutput"
-