Skip to content

Class daisy::DotStar

template <typename Transport>

ClassList > daisy > DotStar

Device support for Adafruit DotStar LEDs (Opsco SK9822)More...

  • #include <dotstar.h>

Classes

Type Name
struct Config

Public Types

Type Name
enum Result

Public Functions

Type Name
void Clear ()
Clears all current color data. Does not reset global brightnesses. Does not write pixel buffer data to LEDs.
DotStar ()
void Fill (const Color & color)
Fills all pixels with color.
void Fill (uint32_t color)
Fills all pixels with color.
void Fill (uint8_t r, uint8_t g, uint8_t b)
Fill all pixels with color.
uint16_t GetPixelColor (uint16_t idx)
Result Init (Config & config)
void SetAllGlobalBrightness (uint16_t b)
Set global brightness for all pixels.
void SetPixelColor (uint16_t idx, const Color & color)
Sets color of a single pixel.
void SetPixelColor (uint16_t idx, uint32_t color)
Sets color of a single pixel.
Result SetPixelColor (uint16_t idx, uint8_t r, uint8_t g, uint8_t b)
Sets color of a single pixel.
Result SetPixelGlobalBrightness (uint16_t idx, uint16_t b)
Set global brightness for a single pixel.
Result Show ()
Writes current pixel buffer data to LEDs.
~DotStar ()

Detailed Description

Author:

Nick Donaldson

Date:

March 2023

Public Types Documentation

enum Result

enum daisy::DotStar::Result {
    OK,
    ERR_INVALID_ARGUMENT,
    ERR_TRANSPORT
};

Public Functions Documentation

function Clear

Clears all current color data. Does not reset global brightnesses. Does not write pixel buffer data to LEDs.

inline void daisy::DotStar::Clear () 


function DotStar

inline daisy::DotStar::DotStar () 

function Fill [⅓]

Fills all pixels with color.

inline void daisy::DotStar::Fill (
    const  Color & color
) 

Parameters:

  • color Color with which to fill all pixels

function Fill [⅔]

Fills all pixels with color.

inline void daisy::DotStar::Fill (
    uint32_t color
) 

Parameters:

  • color 32-bit integer representing 24-bit RGB color. MSB ignored.

function Fill [3/3]

Fill all pixels with color.

inline void daisy::DotStar::Fill (
    uint8_t r,
    uint8_t g,
    uint8_t b
) 

Parameters:

  • r 8-bit red value to apply to pixels
  • g 8-bit green value to apply to pixels
  • b 8-bit blue value to apply to pixels

function GetPixelColor

inline uint16_t daisy::DotStar::GetPixelColor (
    uint16_t idx
) 

function Init

inline Result daisy::DotStar::Init (
    Config & config
) 

function SetAllGlobalBrightness

Set global brightness for all pixels.

inline void daisy::DotStar::SetAllGlobalBrightness (
    uint16_t b
) 

"Global brightness" for the SK9822 device sets the equivalent constant current for the LEDs, not a pre-multiplied PWM brightness scaling for the pixel's RGB value. See SK9822 datasheet for details.

Warning:

Recommend not going above 10, especially for SK9822-EC20 which may overheat if you do.

Parameters:

  • b 5-bit global brightness setting (0 - 31)

function SetPixelColor [⅓]

Sets color of a single pixel.

inline void daisy::DotStar::SetPixelColor (
    uint16_t idx,
    const  Color & color
) 

Parameters:

  • idx Index of the pixel
  • color Color object to apply to the pixel

function SetPixelColor [⅔]

Sets color of a single pixel.

inline void daisy::DotStar::SetPixelColor (
    uint16_t idx,
    uint32_t color
) 

Parameters:

  • color 32-bit integer representing 24-bit RGB color. MSB ignored.

function SetPixelColor [3/3]

Sets color of a single pixel.

inline Result daisy::DotStar::SetPixelColor (
    uint16_t idx,
    uint8_t r,
    uint8_t g,
    uint8_t b
) 

Parameters:

  • idx Index of the pixel
  • r 8-bit red value to apply to pixel
  • g 8-bit green value to apply to pixel
  • b 8-bit blue value to apply to pixel

function SetPixelGlobalBrightness

Set global brightness for a single pixel.

inline Result daisy::DotStar::SetPixelGlobalBrightness (
    uint16_t idx,
    uint16_t b
) 

"Global brightness" for the SK9822 device sets the equivalent constant current for the LEDs. See datasheet for details.

Warning:

Recommend not going above 10, especially for SK9822-EC20 which may overheat if you do.

Parameters:

  • idx Index of the pixel for which to set global brightness
  • b 5-bit global brightness setting (0 - 31)

function Show

Writes current pixel buffer data to LEDs.

inline Result daisy::DotStar::Show () 


function ~DotStar

inline daisy::DotStar::~DotStar () 


The documentation for this class was generated from the following file external-docs/libDaisy/src/dev/dotstar.h