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

◆ wave3_transpose_2()

FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION void fl::detail::wave3_transpose_2 ( const Wave3Byte lane_waves[2],
u8 output[2 *sizeof(Wave3Byte)] )

Transpose 2 lanes of Wave3Byte data into interleaved format.

Parameters
lane_wavesArray of 2 Wave3Byte structures
outputOutput buffer (6 bytes = 2 * 3)

Definition at line 51 of file wave3.hpp.

52 {
53 // Wave3 produces 3 symbols per LED byte (one byte per symbol for each lane).
54 // For 2 lanes: interleave bits from both lanes into 2 bytes per symbol.
55 // Each symbol byte has 8 bits. With 2 lanes we produce 2 bytes per symbol
56 // using the same bit-spreading as wave8_transpose_2.
57
58 for (int symbol_idx = 0; symbol_idx < 3; symbol_idx++) {
59 u8 l0 = lane_waves[0].data[symbol_idx];
60 u8 l1 = lane_waves[1].data[symbol_idx];
61
62 // Interleave bits: for each bit position, lane0 goes to odd bits, lane1 to even bits
63 u16 interleaved = 0;
64 for (int bit = 0; bit < 8; bit++) {
65 u16 b0 = (l0 >> bit) & 1;
66 u16 b1 = (l1 >> bit) & 1;
67 interleaved |= (b1 << (bit * 2)); // even positions
68 interleaved |= (b0 << (bit * 2 + 1)); // odd positions
69 }
70
71 output[symbol_idx * 2] = (u8)(interleaved >> 8);
72 output[symbol_idx * 2 + 1] = (u8)(interleaved & 0xFF);
73 }
74}
unsigned char u8
Definition stdint.h:131
u8 data[3]
Definition wave3.h:21

References fl::Wave3Byte::data.

Referenced by fl::wave3Transpose_2().

+ Here is the caller graph for this function: