libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::DotStar< Transport > Class Template Reference

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

Detailed Description

template<typename Transport>
class daisy::DotStar< Transport >

Device support for Adafruit DotStar LEDs (Opsco SK9822)

Author
Nick Donaldson
Date
March 2023

#include <dotstar.h>

Classes

struct  Config
 

Public Types

enum class  Result { OK , ERR_INVALID_ARGUMENT , ERR_TRANSPORT }
 

Public Member Functions

 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.
 

Member Enumeration Documentation

◆ Result

Enumerator
OK 
ERR_INVALID_ARGUMENT 
ERR_TRANSPORT 

Constructor & Destructor Documentation

◆ DotStar()

template<typename Transport >
daisy::DotStar< Transport >::DotStar ( )
inline

◆ ~DotStar()

template<typename Transport >
daisy::DotStar< Transport >::~DotStar ( )
inline

Member Function Documentation

◆ Clear()

template<typename Transport >
void daisy::DotStar< Transport >::Clear ( )
inline

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

◆ Fill() [1/3]

template<typename Transport >
void daisy::DotStar< Transport >::Fill ( const Color color)
inline

Fills all pixels with color.

Parameters
colorColor with which to fill all pixels

◆ Fill() [2/3]

template<typename Transport >
void daisy::DotStar< Transport >::Fill ( uint32_t  color)
inline

Fills all pixels with color.

Parameters
color32-bit integer representing 24-bit RGB color. MSB ignored.

◆ Fill() [3/3]

template<typename Transport >
void daisy::DotStar< Transport >::Fill ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inline

Fill all pixels with color.

Parameters
r8-bit red value to apply to pixels
g8-bit green value to apply to pixels
b8-bit blue value to apply to pixels

◆ GetPixelColor()

template<typename Transport >
uint16_t daisy::DotStar< Transport >::GetPixelColor ( uint16_t  idx)
inline

◆ Init()

template<typename Transport >
Result daisy::DotStar< Transport >::Init ( Config config)
inline

◆ SetAllGlobalBrightness()

template<typename Transport >
void daisy::DotStar< Transport >::SetAllGlobalBrightness ( uint16_t  b)
inline

Set global brightness for all pixels.

"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
b5-bit global brightness setting (0 - 31)

◆ SetPixelColor() [1/3]

template<typename Transport >
void daisy::DotStar< Transport >::SetPixelColor ( uint16_t  idx,
const Color color 
)
inline

Sets color of a single pixel.

Parameters
idxIndex of the pixel
colorColor object to apply to the pixel

◆ SetPixelColor() [2/3]

template<typename Transport >
void daisy::DotStar< Transport >::SetPixelColor ( uint16_t  idx,
uint32_t  color 
)
inline

Sets color of a single pixel.

Parameters
color32-bit integer representing 24-bit RGB color. MSB ignored.

◆ SetPixelColor() [3/3]

template<typename Transport >
Result daisy::DotStar< Transport >::SetPixelColor ( uint16_t  idx,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inline

Sets color of a single pixel.

Parameters
idxIndex of the pixel
r8-bit red value to apply to pixel
g8-bit green value to apply to pixel
b8-bit blue value to apply to pixel

◆ SetPixelGlobalBrightness()

template<typename Transport >
Result daisy::DotStar< Transport >::SetPixelGlobalBrightness ( uint16_t  idx,
uint16_t  b 
)
inline

Set global brightness for a single pixel.

"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
idxIndex of the pixel for which to set global brightness
b5-bit global brightness setting (0 - 31)

◆ Show()

template<typename Transport >
Result daisy::DotStar< Transport >::Show ( )
inline

Writes current pixel buffer data to LEDs.


The documentation for this class was generated from the following file: