Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
lampda::component::LedStrip Class Reference

protected inheritence to avoid uncontroled hardware calls More...

#include <strip.h>

Inheritance diagram for lampda::component::LedStrip:
lampda::hal::strip::LampdaStrip< LedCount, ChannelCount >

Public Member Functions

 LedStrip (int16_t pin, neoPixelType type=NEO_RGB+NEO_KHZ800)
 
 LedStrip (const LedStrip &)=delete
 
LedStrip & operator= (LedStrip const &)=delete
 
void show ()
 
void setBrightness (uint8_t b)
 Brightness is an internal counter.
 
uint8_t getBrightness () const
 Brightness is an internal flag.
 
void setBlackout (const bool shouldBlackout)
 While set, the next shows write black to all leds, whatever the brightness or masks. The colors are kept.
 
void begin ()
 
uint32_t getRawPixelColor (uint16_t n) const
 Return the raw color value stored in the send buffer.
 
void show_now ()
 Show the current data, independant of changes.
 
void setPixelColor (uint16_t n, uint32_t c)
 
uint32_t getPixelColor (uint16_t n) const
 
void signal_display ()
 
void mask_led_at_index (const size_t n, const bool shouldMask)
 Set a pixel to be masked at the next show.
 

Static Public Member Functions

static uint8_t restore_color_with_brightness (uint8_t colorIn, const uint8_t brightness)
 Convert a color to the standard range, assuming it starts as brightness level.
 
static std::pair< uint8_t, uint8_t > get_brightness_color_and_error (const uint8_t colorIn, uint16_t errorIn, const uint8_t brightness, const uint16_t index)
 Convert a color to the desired brightness level, with an error adjustment.
 
static uint32_t convert_color_with_brightness (const uint32_t color, const uint8_t brightness, const uint16_t index, uint32_t &error)
 Convert a color to the correct brightness, with temporal dithering.
 

Public Attributes

std::array< BufferTy, stripNbBuffers > _buffers
 buffers for computations
 

Friends

struct modes::hardware::LampTy
 

Detailed Description

protected inheritence to avoid uncontroled hardware calls

Member Function Documentation

◆ begin()

void lampda::component::LedStrip::begin ( void  )
inline

EXPLICIT CALLS TO THE LIBRARY

◆ convert_color_with_brightness()

static uint32_t lampda::component::LedStrip::convert_color_with_brightness ( const uint32_t  color,
const uint8_t  brightness,
const uint16_t  index,
uint32_t &  error 
)
inlinestatic

Convert a color to the correct brightness, with temporal dithering.

Warning
The given brightness should be 0-255
Parameters
[in]cColor to convert, in the full scale 0-255, unadjusted to brightness
[in]brightnessThe brightness to apply (0 - 255).
[in]indexIndex of the noise to use
[in,out]errorError components of the current colors

◆ get_brightness_color_and_error()

static std::pair< uint8_t, uint8_t > lampda::component::LedStrip::get_brightness_color_and_error ( const uint8_t  colorIn,
uint16_t  errorIn,
const uint8_t  brightness,
const uint16_t  index 
)
inlinestatic

Convert a color to the desired brightness level, with an error adjustment.

Parameters
[in]colorInRaw color data to convert
[in]errorInAdditive color error from last run
[in]brightnessDesired brightness level (0 - 255)
[in]indexIndex of the noise to use
Returns
Pair of converted color and new error component

◆ getRawPixelColor()

uint32_t lampda::component::LedStrip::getRawPixelColor ( uint16_t  n) const
inline

Return the raw color value stored in the send buffer.

Warning
Should not be used except for debug

◆ restore_color_with_brightness()

static uint8_t lampda::component::LedStrip::restore_color_with_brightness ( uint8_t  colorIn,
const uint8_t  brightness 
)
inlinestatic

Convert a color to the standard range, assuming it starts as brightness level.

END OF EXPLICIT CALLS

Warning
This breaks the color resolution, on purpose !
Parameters
[in]colorInRaw color data to convert
[in]brightnessDesired brightness level (0 - 255)
Returns
converted color

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