Interface LedDriverInterface

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void allOff()
      Turn off all pixels and render.
      void close()  
      default int getBlueComponent​(int pixel)
      Get the 8-bit blue component value for the specified pixel.
      default int getGreenComponent​(int pixel)
      Get the 8-bit green component value for the specified pixel.
      int getNumPixels()  
      int getPixelColour​(int pixel)
      Get the current colour for the specified pixel.
      default int getRedComponent​(int pixel)
      Get the 8-bit red component value for the specified pixel.
      void render()
      Push any updated colours to the LED strip.
      default void setBlueComponent​(int pixel, int blue)
      Set the 8-bit blue component value for the specified pixel.
      default void setGreenComponent​(int pixel, int green)
      Set the 8-bit green component value for the specified pixel.
      void setPixelColour​(int pixel, int colour)
      Set the colour for the specified pixel.
      default void setPixelColourHSB​(int pixel, float hue, float saturation, float brightness)
      Set the colour for the specified pixel using Hue Saturation Brightness (HSB) values.
      default void setPixelColourHSL​(int pixel, float hue, float saturation, float luminance)
      Set the colour for the specified pixel using Hue Saturation Luminance (HSL) values.
      default void setPixelColourRGB​(int pixel, int red, int green, int blue)
      Set the colour for the specified pixel using individual red / green / blue 8-bit values.
      default void setRedComponent​(int pixel, int red)
      Set the 8-bit red component value for the specified pixel.
    • Method Detail

      • getNumPixels

        int getNumPixels()
      • render

        void render()
        Push any updated colours to the LED strip.
      • allOff

        void allOff()
        Turn off all pixels and render.
      • getPixelColour

        int getPixelColour​(int pixel)
        Get the current colour for the specified pixel.
        Parameters:
        pixel - Pixel number.
        Returns:
        24-bit RGB colour value.
      • setPixelColour

        void setPixelColour​(int pixel,
                            int colour)
        Set the colour for the specified pixel.
        Parameters:
        pixel - Pixel number.
        colour - Colour represented as a 24bit RGB integer (0x0RGB).
      • setPixelColourRGB

        default void setPixelColourRGB​(int pixel,
                                       int red,
                                       int green,
                                       int blue)
        Set the colour for the specified pixel using individual red / green / blue 8-bit values.
        Parameters:
        pixel - Pixel number.
        red - 8-bit value for the red component.
        green - 8-bit value for the green component.
        blue - 8-bit value for the blue component.
      • setPixelColourHSB

        default void setPixelColourHSB​(int pixel,
                                       float hue,
                                       float saturation,
                                       float brightness)
        Set the colour for the specified pixel using Hue Saturation Brightness (HSB) values.
        Parameters:
        pixel - Pixel number.
        hue - Float value in the range 0..1 representing the hue.
        saturation - Float value in the range 0..1 representing the colour saturation.
        brightness - Float value in the range 0..1 representing the colour brightness.
      • setPixelColourHSL

        default void setPixelColourHSL​(int pixel,
                                       float hue,
                                       float saturation,
                                       float luminance)

        Set the colour for the specified pixel using Hue Saturation Luminance (HSL) values.

        HSL colour mapping code taken from this HSL Color class by Rob Camick.

        Parameters:
        pixel - Pixel number.
        hue - Represents the colour (think colours of the rainbow), specified in degrees from 0 - 360. Red is 0, green is 120 and blue is 240.
        saturation - Represents the purity of the colour. Range is 0..1 with 1 fully saturated and 0 gray.
        luminance - Represents the brightness of the colour. Range is 0..1 with 1 white 0 black.
      • getRedComponent

        default int getRedComponent​(int pixel)
        Get the 8-bit red component value for the specified pixel.
        Parameters:
        pixel - Pixel number.
        Returns:
        8-bit red component value.
      • setRedComponent

        default void setRedComponent​(int pixel,
                                     int red)
        Set the 8-bit red component value for the specified pixel.
        Parameters:
        pixel - Pixel number.
        red - 8-bit red component value.
      • getGreenComponent

        default int getGreenComponent​(int pixel)
        Get the 8-bit green component value for the specified pixel.
        Parameters:
        pixel - Pixel number.
        Returns:
        8-bit green component value.
      • setGreenComponent

        default void setGreenComponent​(int pixel,
                                       int green)
        Set the 8-bit green component value for the specified pixel.
        Parameters:
        pixel - Pixel number.
        green - 8-bit green component value.
      • getBlueComponent

        default int getBlueComponent​(int pixel)
        Get the 8-bit blue component value for the specified pixel.
        Parameters:
        pixel - Pixel number.
        Returns:
        8-bit blue component value.
      • setBlueComponent

        default void setBlueComponent​(int pixel,
                                      int blue)
        Set the 8-bit blue component value for the specified pixel.
        Parameters:
        pixel - Pixel number.
        blue - 8-bit blue component value.