Package ca.team4308.absolutelib.leds
Class AddressableLEDBufferView
java.lang.Object
ca.team4308.absolutelib.leds.AddressableLEDBufferView
Represents a view into a portion of an AddressableLEDBuffer.
Allows treating a section of LEDs as its own buffer.
-
Constructor Summary
ConstructorsConstructorDescriptionAddressableLEDBufferView(AddressableLEDBuffer buffer, int startIndex, int length) Creates a new view into an LED buffer. -
Method Summary
Modifier and TypeMethodDescriptiongetLED(int index) Gets the color of an LED in this view.intGets the length of this buffer view.intGets the starting index of this view in the parent buffer.voidSets the RGB values for an LED in this view.voidsetHSV(int index, int h, int s, int v) Sets the HSV values for an LED in this view.voidsetRGB(int index, int r, int g, int b) Sets the RGB values for an LED in this view.
-
Constructor Details
-
AddressableLEDBufferView
Creates a new view into an LED buffer.- Parameters:
buffer- The parent LED bufferstartIndex- The starting index in the parent bufferlength- The number of LEDs in this view
-
-
Method Details
-
setColor
Sets the RGB values for an LED in this view.- Parameters:
index- The index within this viewcolor- Red value (0-255)
-
setRGB
public void setRGB(int index, int r, int g, int b) Sets the RGB values for an LED in this view.- Parameters:
index- The index within this viewr- Red value (0-255)g- Green value (0-255)b- Blue value (0-255)
-
setHSV
public void setHSV(int index, int h, int s, int v) Sets the HSV values for an LED in this view.- Parameters:
index- The index within this viewh- Hue (0-180)s- Saturation (0-255)v- Value/Brightness (0-255)
-
getLED
Gets the color of an LED in this view.- Parameters:
index- The index within this view- Returns:
- The Color object representing the LED's color
-
getLength
public int getLength()Gets the length of this buffer view.- Returns:
- The number of LEDs in this view
-
getStartIndex
public int getStartIndex()Gets the starting index of this view in the parent buffer.- Returns:
- The start index
-