You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support single-color multi-chip brightness variations #20
I have some (admittedly uncommon) LPD8806 strip with 3-die warm white LEDs on it. The library works well with this strip, but I would like to increase my available brightness resolution by dithering one high-resolution brightness value across the 3 dies (the 8806 only supports 7 bits per channel). My present approach for this this involves more math per pixel than makes sense.
It would be helpful if the library included support directly for something like this.
Actually do the three lines of math separately - you don't want the overhead of running a loop in there (you're adding at least 20 cycles of overheard if you do that!)
Note - I'm unlikely to add something special purpose like this to the library (as its primary focus is in dealing with RGB chipsets). However, if you want a conversion function, you can have something like:
// val is a value from 0-767 -- note, use 0-255 values for RGB values, the library, internally,
// does the 7-bit cut, but if you really want 7 bit values, you can change appropriately here)
inline CRGB threeWayDither(uint16_t val) {
return CRGB(val/3, (val+1)/3, (val+2)/3);
}
make it inline and the compiler should keep it pretty tight/fast[1]. (Also, there really isn't much of a way that I could implement this at a lower level in the library that would be much different from this).
[1] with the caveat that AVR is -terrible- at doing division.
Activity
focalintent commentedon Feb 2, 2014
Actually do the three lines of math separately - you don't want the overhead of running a loop in there (you're adding at least 20 cycles of overheard if you do that!)
focalintent commentedon Feb 3, 2014
Note - I'm unlikely to add something special purpose like this to the library (as its primary focus is in dealing with RGB chipsets). However, if you want a conversion function, you can have something like:
// val is a value from 0-767 -- note, use 0-255 values for RGB values, the library, internally,
// does the 7-bit cut, but if you really want 7 bit values, you can change appropriately here)
inline CRGB threeWayDither(uint16_t val) {
return CRGB(val/3, (val+1)/3, (val+2)/3);
}
make it inline and the compiler should keep it pretty tight/fast[1]. (Also, there really isn't much of a way that I could implement this at a lower level in the library that would be much different from this).
[1] with the caveat that AVR is -terrible- at doing division.
PaulMcMillan commentedon Feb 7, 2014
Cool, thanks for the suggestions, I'll give 'em a shot. I guess you're right - this is probably a little too unique for an RGB oriented library.