FastLED 3.9.15
Loading...
Searching...
No Matches

◆ transpose_2strips()

FASTLED_FORCE_INLINE void fl::transpose_2strips ( const u8 *const input[2],
u8 * output,
u16 num_leds,
u8 bytes_per_led )

Transpose 2 LED strips into parallel bit format.

This function transposes 2 LED strips from standard byte-sequential format to bit-parallel format suitable for 2-way PIO output.

Input: 2 strips, each with num_leds * bytes_per_led bytes Output: num_leds * bytes_per_led * 8 bytes

Parameters
inputArray of 2 pointers to LED strip data
outputPointer to output buffer
num_ledsNumber of LEDs per strip (all strips padded to this length)
bytes_per_ledNumber of bytes per LED (3 for RGB, 4 for RGBW, etc.)
Note
All strips must be pre-padded to the same length
Output buffer must be pre-allocated by caller
Upper 6 bits of each output byte are zero
Examples
/home/runner/work/FastLED/FastLED/src/fl/math/transposition.h.

Definition at line 767 of file transposition.h.

772 {
773 // Process each LED
774 for (u16 led = 0; led < num_leds; led++) {
775 // Process each byte in the LED
776 for (u8 byte_idx = 0; byte_idx < bytes_per_led; byte_idx++) {
777 // Collect one byte from each strip for this byte position
778 u8 strip_bytes[2];
779 strip_bytes[0] = input[0][led * bytes_per_led + byte_idx];
780 strip_bytes[1] = input[1][led * bytes_per_led + byte_idx];
781
782 // Transpose: extract each bit position from both strips
783 for (int bit = 7; bit >= 0; bit--) {
784 u8 output_byte =
785 ((strip_bytes[0] >> bit) & 1) |
786 (((strip_bytes[1] >> bit) & 1) << 1);
787 *output++ = output_byte;
788 }
789 }
790 }
791}
unsigned char u8
Definition stdint.h:131

References FASTLED_FORCE_INLINE, and FL_NOEXCEPT.

Referenced by transpose_strips().

+ Here is the caller graph for this function: