Package com.diozero.ws281xj.apa102
Class Apa102LedDriver
- java.lang.Object
-
- com.diozero.ws281xj.apa102.Apa102LedDriver
-
- All Implemented Interfaces:
LedDriverInterface
,AutoCloseable
public class Apa102LedDriver extends Object implements LedDriverInterface
Reference: https://cpldcpu.com/2014/11/30/understanding-the-apa102-superled/ Also: https://github.com/androidthings/contrib-drivers/blob/master/apa102/src/main/java/com/google/android/things/contrib/driver/apa102/Apa102.java
-
-
Constructor Summary
Constructors Constructor Description Apa102LedDriver(int controller, int chipSelect, int frequency, int numLeds, int brightness)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allOff()
Turn off all pixels and render.void
close()
int
getNumPixels()
int
getPixelColour(int pixel)
Get the current colour for the specified pixel.void
render()
Push any updated colours to the LED strip.void
setPixelColour(int pixel, int colour)
Set the colour for the specified pixel.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.diozero.ws281xj.LedDriverInterface
getBlueComponent, getGreenComponent, getRedComponent, setBlueComponent, setGreenComponent, setPixelColourHSB, setPixelColourHSL, setPixelColourRGB, setRedComponent
-
-
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceLedDriverInterface
-
getNumPixels
public int getNumPixels()
- Specified by:
getNumPixels
in interfaceLedDriverInterface
-
render
public void render()
Description copied from interface:LedDriverInterface
Push any updated colours to the LED strip.- Specified by:
render
in interfaceLedDriverInterface
-
allOff
public void allOff()
Description copied from interface:LedDriverInterface
Turn off all pixels and render.- Specified by:
allOff
in interfaceLedDriverInterface
-
getPixelColour
public int getPixelColour(int pixel)
Description copied from interface:LedDriverInterface
Get the current colour for the specified pixel.- Specified by:
getPixelColour
in interfaceLedDriverInterface
- Parameters:
pixel
- Pixel number.- Returns:
- 24-bit RGB colour value.
-
setPixelColour
public void setPixelColour(int pixel, int colour)
Description copied from interface:LedDriverInterface
Set the colour for the specified pixel.- Specified by:
setPixelColour
in interfaceLedDriverInterface
- Parameters:
pixel
- Pixel number.colour
- Colour represented as a 24bit RGB integer (0x0RGB).
-
-