FastLED 3.9.3
|
Fast, efficient 8-bit math functions specifically designed for high-performance LED programming.
Because of the AVR (Arduino) and ARM assembly language implementations provided, using these functions often results in smaller and faster code than the equivalent program using plain "C" arithmetic and logic.
Included are:
Scaling (down) of unsigned 8- and 16- bit values. Scaledown value is specified in 1/256ths.
Example: scaling a 0-255 value down into a range from 0-99:
A special version of scale8 is provided for scaling LED brightness values, to make sure that they don't accidentally scale down to total black at low dimming levels, since that would look wrong:
Example: reducing an LED brightness by a dimming factor:
Fast 16-bit approximations of sin and cos. Input angle is a uint16_t from 0-65535. Output is a signed int16_t from -32767 to 32767.
Accurate to more than 99% in all cases.
Fast 8-bit approximations of sin and cos. Input angle is a uint8_t from 0-255. Output is an UNsigned uint8_t from 0 to 255.
Accurate to within about 2%.
Dimming and brightening functions for 8-bit light values.
The dimming functions in particular are suitable for making LED light output appear more 'linear'.
Beat generators which return sine or sawtooth waves in a specified number of Beats Per Minute. Sine wave beat generators can specify a low and high range for the output. Sawtooth wave beat generators always range 0-255 or 0-65535.
BPM is beats per minute in either simple form e.g. 120, or Q8.8 fixed-point form. BPM88 is beats per minute in ONLY Q8.8 fixed-point form.
Lib8tion is pronounced like 'libation': lie-BAY-shun
Topics | |
Basic Math Operations | |
Fast, efficient 8-bit math functions specifically designed for high-performance LED programming. | |
Dimming and Brightening Functions | |
Functions to dim or brighten data. | |
Easing Functions | |
Specify the rate of change of a parameter over time. | |
Fast Memory Functions for AVR | |
Alternatives to memmove, memcpy, and memset that are faster on AVR than standard avr-libc 1.8. | |
Fast Random Number Generators | |
Fast 8-bit and 16-bit unsigned random number generators. | |
Fast Trigonometry Functions | |
Fast 8-bit and 16-bit approximations of sin(x) and cos(x). | |
Float-to-Fixed and Fixed-to-Float Conversions | |
Functions to convert between floating point and fixed point types. | |
Linear Interpolation | |
Fast linear interpolation functions, such as could be used for Perlin noise, etc. | |
Scaling Functions | |
Fast, efficient 8-bit scaling functions specifically designed for high-performance LED programming. | |
Waveform Beat Generators | |
Waveform generators that reset at a given number of "beats per minute" (BPM). | |
Waveform Generators | |
General purpose wave generator functions. | |