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
pixelbufimplementation.Note that some difference exist: for example, this relies on the base Java classes to represent colors vs the Python
ColorUnionconstruct that allows for 3 different types of "colors". Also, unless otherwise configured, the usualGamma 8color-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 ByteDOTSTAR_LED_START_FULL_BRIGHTpublic final static IntegerDOTSTAR_LED_STARTprivate BooleanautoWriteprivate final <Error class: unknown class>gamma8Correctionprivate Floatbrightnessprivate final Integersizeprivate final StringbyteOrderprivate final BooleanapplyGamma
-
Method Summary
Modifier and Type Method Description BooleangetAutoWrite()UnitsetAutoWrite(Boolean autoWrite)<Error class: unknown class>getGamma8Correction()FloatgetBrightness()UnitsetBrightness(Float brightness)final IntegergetSize()final StringgetByteOrder()final BooleangetApplyGamma()Unitfill(WS2811.PixelColor color)Fill the entire device with this color. Unitset(Integer index, WS2811.PixelColor color)Set an individual pixel (this is available as an indexed value). Unitset(Integer start, Integer end, WS2811.PixelColor color)Set a range of pixels to a color (end is inclusive). Unitset(Integer start, Integer end, List<WS2811.PixelColor> colors)Set a range of pixels to a range of colors (end is inclusive). final WS2811.PixelColorget(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 Unitshow()Sends the current pixel buffer to the device. -
-
Method Detail
-
getAutoWrite
Boolean getAutoWrite()
-
setAutoWrite
Unit setAutoWrite(Boolean autoWrite)
-
getGamma8Correction
<Error class: unknown class> 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.
-
-
-
-