Class PixelBuf
-
- All Implemented Interfaces:
-
crackers.kobots.devices.lighting.WS2811
public abstract class PixelBuf implements WS2811
A set of one or more WS2811 addressable-LEDs.
A re-implementation of the "pure Python" Adafruit PixelBuf class, which is a re-implementation of the base Adafruit
pixelbuf
implementation.Note that some difference exist: for example, this relies on the base Java classes to represent colors vs the Python
ColorUnion
construct that allows for 3 different types of "colors". Also, unless otherwise configured, the usualGamma 8
color-correction is applied.TODO dotStar implementation is probably incorrect - needs device to test with
-
-
Field Summary
Fields Modifier and Type Field Description public final static Byte
DOTSTAR_LED_START_FULL_BRIGHT
public final static Integer
DOTSTAR_LED_START
private Boolean
autoWrite
private final List<Integer>
gamma8Correction
private Float
brightness
private final Integer
size
private final String
byteOrder
private final Boolean
applyGamma
-
Method Summary
Modifier and Type Method Description Boolean
getAutoWrite()
Unit
setAutoWrite(Boolean autoWrite)
List<Integer>
getGamma8Correction()
Float
getBrightness()
Unit
setBrightness(Float brightness)
final Integer
getSize()
final String
getByteOrder()
final Boolean
getApplyGamma()
Unit
fill(WS2811.PixelColor color)
Fill the entire device with this color. Unit
set(Integer index, WS2811.PixelColor color)
Set an individual pixel (this is available as an indexed value). Unit
set(Integer start, Integer end, WS2811.PixelColor color)
Set a range of pixels to a color (end is inclusive). Unit
set(Integer start, Integer end, List<WS2811.PixelColor> colors)
Set a range of pixels to a range of colors (end is inclusive). final WS2811.PixelColor
get(Integer index)
Current color for the given pixel. final Array<WS2811.PixelColor>
get()
All the current colors. final Iterator<WS2811.PixelColor>
iterator()
Immutable operator - changing these colors has no effect. final Unit
show()
Sends the current pixel buffer to the device. -
-
Method Detail
-
getAutoWrite
Boolean getAutoWrite()
-
setAutoWrite
Unit setAutoWrite(Boolean autoWrite)
-
getGamma8Correction
List<Integer> getGamma8Correction()
-
getBrightness
Float getBrightness()
-
setBrightness
Unit setBrightness(Float brightness)
-
getByteOrder
final String getByteOrder()
-
getApplyGamma
final Boolean getApplyGamma()
-
fill
Unit fill(WS2811.PixelColor color)
Fill the entire device with this color. If autoWrite is enabled, the results are immediately uploaded.
-
set
Unit set(Integer index, WS2811.PixelColor color)
Set an individual pixel (this is available as an indexed value). If autoWrite is enabled, the results are immediately uploaded.
-
set
Unit set(Integer start, Integer end, WS2811.PixelColor color)
Set a range of pixels to a color (end is inclusive). If autoWrite is enabled, the results are immediately uploaded.
-
set
Unit set(Integer start, Integer end, List<WS2811.PixelColor> colors)
Set a range of pixels to a range of colors (end is inclusive). The color list must be equal to or larger than the range specified. If autoWrite is enabled, the results are immediately uploaded.
-
get
final WS2811.PixelColor get(Integer index)
Current color for the given pixel.
-
get
final Array<WS2811.PixelColor> get()
All the current colors. This is a clone, so any changes will not have effect.
-
iterator
final Iterator<WS2811.PixelColor> iterator()
Immutable operator - changing these colors has no effect.
-
-
-
-