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::physical::LedStrip Class Reference

protected inheritence to avoid uncontroled hardware calls More...

#include <strip.h>

Inheritance diagram for lampda::physical::LedStrip:
Adafruit_NeoPixel

Public Member Functions

 LedStrip (int16_t pin, neoPixelType type=NEO_RGB+NEO_KHZ800)
 
void show ()
 
float estimateCurrentDraw ()
 
void setBrightness (uint8_t b)
 Brightness is an internal counter.
 
uint8_t getBrightness () const
 Brightness is an internal flag.
 
void setPixelColor (uint16_t n, COLOR c)
 
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, uint8_t r, uint8_t g, uint8_t b)
 
void setPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w)
 
void setPixelColor (uint16_t n, uint32_t c)
 
void setPixelColorXY (uint16_t x, uint16_t y, COLOR c)
 
void setPixelColorXY (uint16_t x, uint16_t y, uint32_t c)
 
uint32_t color_wheel (uint8_t pos)
 
void blur (uint8_t blur_amount)
 
uint32_t getPixelColor (uint16_t n) const
 
uint32_t getPixelColorXY (int16_t x, int16_t y) const
 
void addPixelColor (uint16_t n, uint32_t color, bool fast=false)
 
void addPixelColorXY (uint16_t x, uint16_t y, uint32_t color, bool fast=false)
 
void signal_display ()
 
uint32_t * get_buffer_ptr (const uint8_t index)
 
void buffer_current_colors (const uint8_t index)
 
void fill_buffer (const uint8_t index, const uint32_t value)
 

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 COLOR convert_color_with_brigthness (const COLOR &c, const uint8_t brightness, const uint16_t index, COLOR &error)
 Convert a color to the correct brightness, with temporal dithering.
 
static uint16_t to_strip (uint16_t screenX, uint16_t screenY)
 

Public Attributes

COLOR _colors [LED_COUNT]
 store the display colors, with no brightness scaling
 
std::array< COLOR, useTemporalDithering ? LED_COUNT :1 > _colorErrors
 used for temporal dithering
 
BufferTy _buffers [stripNbBuffers]
 buffers for computations
 

Friends

struct modes::hardware::LampTy
 

Detailed Description

protected inheritence to avoid uncontroled hardware calls

Member Function Documentation

◆ begin()

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

EXPLICIT CALLS TO THE LIBRARY

◆ convert_color_with_brigthness()

static COLOR lampda::physical::LedStrip::convert_color_with_brigthness ( const COLOR c,
const uint8_t  brightness,
const uint16_t  index,
COLOR 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::physical::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::physical::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::physical::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: