|
Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Display output components. More...
Classes | |
| struct | Rgb |
| Simple 8-bit RGB color triple. Aggregate — constexpr constructible. More... | |
| 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) |
| Apply gamma correction to an RGB color. | |
| Rgb | rgb_lerp (const Rgb &a, const Rgb &b, uint8_t t) |
| Linear interpolation between two colors. t=0 → a, t=255 → b. | |
| Rgb | rgb_scale (const Rgb &c, uint8_t brightness) |
| Scale a color by brightness (0-255). 255 = full, 128 ≈ half, 0 = off. | |
| 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] |
Display output components.
|
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.
| Enumerator | |
|---|---|
| Off | |
| Blue | |
| Green | |
| Cyan | |
| Red | |
| Magenta | |
| Yellow | |
| White | |
Definition at line 34 of file rgb_led.hpp.
Apply gamma correction to an RGB color.
Definition at line 60 of file color.hpp.
References sbl::components::display::Rgb::b, sbl::components::display::Rgb::g, GAMMA8, and sbl::components::display::Rgb::r.
|
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: constexpr Rgb stops[] = {{0,0,255}, {0,255,0}, {255,0,0}}; Rgb c = gradient(stops, 3, 32768); // midpoint → green
Definition at line 95 of file color.hpp.
References rgb_lerp().
Linear interpolation between two colors. t=0 → a, t=255 → b.
Definition at line 65 of file color.hpp.
References sbl::components::display::Rgb::b, sbl::components::display::Rgb::g, and sbl::components::display::Rgb::r.
Referenced by gradient().
Scale a color by brightness (0-255). 255 = full, 128 ≈ half, 0 = off.
Definition at line 73 of file color.hpp.
References sbl::components::display::Rgb::b, sbl::components::display::Rgb::g, and sbl::components::display::Rgb::r.
|
inlineconstexpr |
Gamma correction LUT (gamma 2.8). Maps perceived-linear 0-255 to PWM duty. Without correction, PWM 128 appears ~78% as bright as 255 (not 50%).
Definition at line 40 of file color.hpp.
Referenced by gamma_correct().