Class WS281xSpi

  • All Implemented Interfaces:
    LedDriverInterface, AutoCloseable

    public class WS281xSpi
    extends Object
    implements LedDriverInterface
    References: https://os.mbed.com/users/JacobBramley/code/PixelArray/file/47802e75974e/neopixel.cpp https://github.com/jgarff/rpi_ws281x/blob/master/ws2811.c
    • Constructor Detail

      • WS281xSpi

        public WS281xSpi​(int controller,
                         int chipSelect,
                         StripType stripType,
                         int numLeds,
                         int brightness)
      • WS281xSpi

        public WS281xSpi​(int controller,
                         int chipSelect,
                         WS281xSpi.Protocol protocol,
                         StripType stripType,
                         int numLeds,
                         int brightness)
    • Method Detail

      • getPixelColour

        public int getPixelColour​(int pixel)
        Description copied from interface: LedDriverInterface
        Get the current colour for the specified pixel.
        Specified by:
        getPixelColour in interface LedDriverInterface
        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 interface LedDriverInterface
        Parameters:
        pixel - Pixel number.
        colour - Colour represented as a 24bit RGB integer (0x0RGB).
      • render

        public void render()
        Pixels are sent as follows: - The first transmitted pixel is the pixel closest to the transmitter. - The most significant bit is always sent first. g7,g6,g5,g4,g3,g2,g1,g0,r7,r6,r5,r4,r3,r2,r1,r0,b7,b6,b5,b4,b3,b2,b1,b0 \_____________________________________________________________________/ | _________________... | / __________________... | / / ___________________... | / / / GRB,GRB,GRB,GRB,... For BYTE_ORDER_RGB, the order of the first two bytes are reversed.
        Specified by:
        render in interface LedDriverInterface