|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Indicators: RGB LED state and colors. More...
Indicators: RGB LED state and colors.
Classes | |
| struct | Rgb |
| class | RgbLed |
| RGB LED state holder with 8-bit per-channel duty cycle. More... | |
| struct | RgbLedState |
Enumerations | |
| enum class | Color : uint8_t { Off = 0 , Blue = 1 , Green = 2 , Cyan = 3 , Red = 4 , Magenta = 5 , Yellow = 6 , White = 7 } |
| 3-bit color enum - all 8 RGB combinations More... | |
Functions | |
| Rgb | gamma_correct (const Rgb &c) |
| Rgb | rgb_lerp (const Rgb &a, const Rgb &b, uint8_t t) |
| Rgb | rgb_scale (const Rgb &c, uint8_t brightness) |
| Rgb | gradient (const Rgb *stops, uint8_t n_stops, uint16_t position) |
| Evaluate a multi-stop color gradient at a position. | |
Variables | |
| constexpr uint8_t | GAMMA8 [256] |
|
strong |
3-bit color enum - all 8 RGB combinations
Bit layout: [R:G:B] where bit 2=R, bit 1=G, bit 0=B. Maps to full brightness (255) per active channel.
Definition at line 33 of file rgb_led.hpp.
Linear interpolation between two colors. t=0 -> a, t=255 -> b.
Definition at line 72 of file color.hpp.
Referenced by gradient().
|
inline |
Evaluate a multi-stop color gradient at a position.
Divides the 0-65535 range into (n_stops - 1) equal segments and interpolates between adjacent stops. Endpoints are exact.
| stops | Array of color stops (at least 2). |
| n_stops | Number of stops (2-16). |
| position | Position in gradient (0 = first stop, 65535 = last stop). |
Example:
Definition at line 104 of file color.hpp.
References rgb_lerp().
|
inlineconstexpr |
Gamma correction LUT (gamma 2.8). Maps perceived-linear 0-255 to PWM duty. Under that model, uncorrected PWM 128 appears (128/255)^(1/2.8), about 78%, as bright as 255.
Definition at line 48 of file color.hpp.
Referenced by gamma_correct().