44template <
typename InputIterator,
typename OutputIterator>
45void encodeAPA102(InputIterator first, InputIterator last, OutputIterator out,
48 global_brightness = global_brightness & 0x1F;
58 while (first != last) {
60 *out++ = 0xE0 | global_brightness;
69 size_t end_dwords = (num_leds / 32) + 1;
70 for (
size_t i = 0; i < end_dwords * 4; i++) {
85template <
typename InputIterator,
typename BrightnessIterator,
typename OutputIterator>
87 BrightnessIterator brightness_first, OutputIterator out)
FL_NOEXCEPT {
96 while (first != last) {
98 u8 brightness_8bit = *brightness_first;
101 *out++ = 0xE0 | brightness_5bit;
112 size_t end_dwords = (num_leds / 32) + 1;
113 for (
size_t i = 0; i < end_dwords * 4; i++) {
128template <
typename InputIterator,
typename OutputIterator>
135 *out++ = 0x00; *out++ = 0x00; *out++ = 0x00; *out++ = 0x00;
147 const u16 maxBrightness = 0x1F;
149 u8 max_rg = (first_pixel[2] > first_pixel[1]) ? first_pixel[2] : first_pixel[1];
150 u8 max_component = (max_rg > first_pixel[0]) ? max_rg : first_pixel[0];
151 u16
brightness = ((((u16)max_component + 1) * maxBrightness - 1) >> 8) + 1;
159 *out++ = 0xE0 | (global_brightness & 0x1F);
167 while (first != last) {
169 *out++ = 0xE0 | (global_brightness & 0x1F);
178 size_t end_dwords = (num_leds / 32) + 1;
179 for (
size_t i = 0; i < end_dwords * 4; i++) {
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
A fixed-size array implementation similar to std::array.
Constants for SPI chipset encoders.
Shared utilities for SPI chipset encoders.
void encodeAPA102(InputIterator first, InputIterator last, OutputIterator out, u8 global_brightness=31) FL_NOEXCEPT
Encode pixel data in APA102 format with global brightness.
FL_NO_INLINE_IF_AVR FL_OPTIMIZE_O2 void encodeAPA102_AutoBrightness(InputIterator first, InputIterator last, OutputIterator out) FL_NOEXCEPT
Encode pixel data in APA102 format (auto-detected brightness from first pixel)
u8 mapBrightness8to5(u8 brightness_8bit) FL_NOEXCEPT
Map 8-bit brightness to 5-bit (0-31)
void encodeAPA102_HD(InputIterator first, InputIterator last, BrightnessIterator brightness_first, OutputIterator out) FL_NOEXCEPT
Encode pixel data in APA102 format with per-LED brightness.
Base definition for an LED controller.
#define FL_NO_INLINE_IF_AVR