Skip to content

daisy::DotStar

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

#include <dotstar.h>

Public Classes

Name
struct Config

Public Types

Name
enum class Result

Public Functions

Name
DotStar()
~DotStar()
Result Init(Config & config)
void SetAllGlobalBrightness(uint16_t b)
Set global brightness for all pixels.
Result SetPixelGlobalBrightness(uint16_t idx, uint16_t b)
Set global brightness for a single pixel.
uint16_t GetPixelColor(uint16_t idx)
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.
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.
void Clear()
Clears all current color data. Does not reset global brightnesses. Does not write pixel buffer data to LEDs.
Result Show()
Writes current pixel buffer data to LEDs.

Detailed Description

template <typename Transport >
class daisy::DotStar;

Device support for Adafruit DotStar LEDs (Opsco SK9822)

Author: Nick Donaldson

Date: March 2023

Public Types Documentation

enum Result

Enumerator Value Description
OK
ERR_INVALID_ARGUMENT
ERR_TRANSPORT

Public Functions Documentation

function DotStar

inline DotStar()

function ~DotStar

inline ~DotStar()

function Init

inline Result Init(
    Config & config
)

function SetAllGlobalBrightness

inline void SetAllGlobalBrightness(
    uint16_t b
)

Set global brightness for all pixels.

Parameters:

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

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

"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.


function SetPixelGlobalBrightness

inline Result SetPixelGlobalBrightness(
    uint16_t idx,
    uint16_t b
)

Set global brightness for a single pixel.

Parameters:

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

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

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


function GetPixelColor

inline uint16_t GetPixelColor(
    uint16_t idx
)

function SetPixelColor

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

Sets color of a single pixel.

Parameters:

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

function SetPixelColor

inline void SetPixelColor(
    uint16_t idx,
    uint32_t color
)

Sets color of a single pixel.

Parameters:

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

function SetPixelColor

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

Sets color of a single pixel.

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 Fill

inline void Fill(
    const Color & color
)

Fills all pixels with color.

Parameters:

  • color Color with which to fill all pixels

function Fill

inline void Fill(
    uint32_t color
)

Fills all pixels with color.

Parameters:

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

function Fill

inline void Fill(
    uint8_t r,
    uint8_t g,
    uint8_t b
)

Fill all pixels with color.

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 Clear

inline void Clear()

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


function Show

inline Result Show()

Writes current pixel buffer data to LEDs.

---

Updated on 2024-01-03 at 19:41:00 +0000