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
Modifier and Type Method Description voidallOff()Turn off all pixels and render.voidclose()intgetNumPixels()intgetPixelColour(int pixel)Get the current colour for the specified pixel.voidrender()Push any updated colours to the LED strip.voidsetPixelColour(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, waitMethods inherited from interface com.diozero.ws281xj.LedDriverInterface
getBlueComponent, getGreenComponent, getRedComponent, setBlueComponent, setGreenComponent, setPixelColourHSB, setPixelColourHSL, setPixelColourRGB, setRedComponent
-
Constructor Details
-
Apa102LedDriver
public Apa102LedDriver(int controller, int chipSelect, int frequency, int numLeds, int brightness)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceLedDriverInterface
-
getNumPixels
public int getNumPixels()- Specified by:
getNumPixelsin interfaceLedDriverInterface
-
render
public void render()Description copied from interface:LedDriverInterfacePush any updated colours to the LED strip.- Specified by:
renderin interfaceLedDriverInterface
-
allOff
public void allOff()Description copied from interface:LedDriverInterfaceTurn off all pixels and render.- Specified by:
allOffin interfaceLedDriverInterface
-
getPixelColour
public int getPixelColour(int pixel)Description copied from interface:LedDriverInterfaceGet the current colour for the specified pixel.- Specified by:
getPixelColourin interfaceLedDriverInterface- Parameters:
pixel- Pixel number.- Returns:
- 24-bit RGB colour value.
-
setPixelColour
public void setPixelColour(int pixel, int colour)Description copied from interface:LedDriverInterfaceSet the colour for the specified pixel.- Specified by:
setPixelColourin interfaceLedDriverInterface- Parameters:
pixel- Pixel number.colour- Colour represented as a 24bit RGB integer (0x0RGB).
-