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

◆ transpose_2lane_inline()

void fl::transpose_2lane_inline ( const u8 * lane0_byte,
const u8 * lane1_byte,
u8 * output,
size_t num_bytes )
inline

Low-level bit-interleaving primitive for 2 lanes (ISR-safe)

Transposes 2 input bytes into 2-way interleaved format with direct bit extraction. This function is ISR-safe: no allocations, no exceptions, minimal overhead. Inline functions are automatically placed where needed - no IRAM_ATTR required.

Parameters
lane0_bytePointer to lane 0 byte
lane1_bytePointer to lane 1 byte
outputOutput buffer (must have space for 2 bytes)
num_bytesNumber of bytes to transpose per lane
Note
Inline function - inlined at call site (including ISR contexts)
Output size is num_bytes * 2
Examples
/home/runner/work/FastLED/FastLED/src/fl/math/transposition.h.

Definition at line 329 of file transposition.h.

334 {
335 for (size_t byte_idx = 0; byte_idx < num_bytes; byte_idx++) {
336 u8 a = lane0_byte[byte_idx];
337 u8 b = lane1_byte[byte_idx];
338
339 // dest[0] contains bit pairs for positions 7,6,5,4 (MSB first)
340 output[byte_idx * 2 + 0] =
341 ((a >> 7) & 0x01) << 0 | ((b >> 7) & 0x01) << 1 |
342 ((a >> 6) & 0x01) << 2 | ((b >> 6) & 0x01) << 3 |
343 ((a >> 5) & 0x01) << 4 | ((b >> 5) & 0x01) << 5 |
344 ((a >> 4) & 0x01) << 6 | ((b >> 4) & 0x01) << 7;
345
346 // dest[1] contains bit pairs for positions 3,2,1,0 (LSB)
347 output[byte_idx * 2 + 1] =
348 ((a >> 3) & 0x01) << 0 | ((b >> 3) & 0x01) << 1 |
349 ((a >> 2) & 0x01) << 2 | ((b >> 2) & 0x01) << 3 |
350 ((a >> 1) & 0x01) << 4 | ((b >> 1) & 0x01) << 5 |
351 ((a >> 0) & 0x01) << 6 | ((b >> 0) & 0x01) << 7;
352 }
353}
unsigned char u8
Definition stdint.h:131

References FL_NOEXCEPT.

Referenced by fl::SPITransposer::transpose2().

+ Here is the caller graph for this function: