FastLED 3.9.15
Loading...
Searching...
No Matches
transposition.h File Reference

Detailed Description

Unified bit transposition functions for FastLED.

This file consolidates all bit transposition and bit-interleaving functions used throughout FastLED for various parallel LED output methods:

Core 8x1 Bit Transpose (from bitswap.h)

  • Basic 8-byte by 8-bit rotation functions
  • Based on Hacker's Delight algorithms
  • Used by parallel output drivers on ARM, ESP8266, ESP32

SPI Multi-Lane Transposer

  • Bit-interleaving for 2/4/8/16-way SPI parallel transmission
  • Unified stateless functional design
  • Used by APA102, SK9822, LPD8806, WS2801, P9813 controllers

Parallel Strip Transposer (RP2040/RP2350)

  • Transpose N LED strips into bit-parallel format for PIO
  • Optimized for 2/4/8 strip configurations
  • Used by RP2040/RP2350 PIO-based parallel output

Definition in file transposition.h.

#include "fl/stl/compiler_control.h"
#include "fl/stl/int.h"
#include "fl/stl/span.h"
#include "fl/stl/optional.h"
#include "fl/stl/cstring.h"
#include "fl/stl/noexcept.h"
+ Include dependency graph for transposition.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  fl::bitswap_type
 Union containing a full 8 bytes to swap the bit orientation on. More...
 
struct  fl::bitswap_type.__unnamed0__
 
union  fl::just8bits
 Structure representing 8 bits of access. More...
 
struct  fl::just8bits.__unnamed0__
 
class  fl::SPITransposer
 Unified stateless bit-interleaving transposer for multi-lane SPI parallel LED transmission. More...
 
struct  fl::SPITransposer::LaneData
 Lane data structure: payload + padding frame. More...
 
struct  fl::sub4
 Structure representing 32 bits of access. More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 

Functions

FASTLED_FORCE_INLINE u32 fl::calculate_transpose_buffer_size (u16 num_leds, u8 bytes_per_led) FL_NOEXCEPT
 Calculate output buffer size needed for transposed data.
 
template<int m, int n>
FASTLED_FORCE_INLINE void fl::transpose8 (unsigned char *A, unsigned char *B) FL_NOEXCEPT
 Templated 8x8 bit transpose with custom stride.
 
FASTLED_FORCE_INLINE void fl::transpose8x1 (unsigned char *A, unsigned char *B) FL_NOEXCEPT
 Simplified 8x1 bit transpose (inline version)
 
FASTLED_FORCE_INLINE void fl::transpose8x1_MSB (unsigned char *A, unsigned char *B) FL_NOEXCEPT
 Simplified 8x1 bit transpose with MSB-first output.
 
void fl::transpose8x1_noinline (unsigned char *A, unsigned char *B) FL_NOEXCEPT
 Simplified 8x1 bit transpose (non-inline version)
 
void fl::transpose_16lane_inline (const u8 *const lanes[16], u8 *output, size_t num_bytes) FL_NOEXCEPT
 Low-level bit-interleaving primitive for 16 lanes (ISR-safe)
 
void fl::transpose_2lane_inline (const u8 *lane0_byte, const u8 *lane1_byte, u8 *output, size_t num_bytes) FL_NOEXCEPT
 Low-level bit-interleaving primitive for 2 lanes (ISR-safe)
 
FASTLED_FORCE_INLINE void fl::transpose_2strips (const u8 *const input[2], u8 *output, u16 num_leds, u8 bytes_per_led) FL_NOEXCEPT
 Transpose 2 LED strips into parallel bit format.
 
void fl::transpose_4lane_inline (const u8 *const lanes[4], u8 *output, size_t num_bytes) FL_NOEXCEPT
 Low-level bit-interleaving primitive for 4 lanes (ISR-safe)
 
FASTLED_FORCE_INLINE void fl::transpose_4strips (const u8 *const input[4], u8 *output, u16 num_leds, u8 bytes_per_led) FL_NOEXCEPT
 Transpose 4 LED strips into parallel bit format.
 
void fl::transpose_8lane_inline (const u8 *const lanes[8], u8 *output, size_t num_bytes) FL_NOEXCEPT
 Low-level bit-interleaving primitive for 8 lanes (ISR-safe)
 
FASTLED_FORCE_INLINE void fl::transpose_8strips (const u8 *const input[8], u8 *output, u16 num_leds, u8 bytes_per_led) FL_NOEXCEPT
 Transpose 8 LED strips into parallel bit format.
 
template<typename TSource>
void fl::transpose_generic_inline (const TSource *const lanes[], size_t num_lanes, u8 *output, size_t num_items) FL_NOEXCEPT
 Generic bit-interleaving primitive for N lanes with M-bit source data (ISR-safe)
 
bool fl::transpose_strips (u8 num_strips, const u8 *const *input, u8 *output, u16 num_leds, u8 bytes_per_led) FL_NOEXCEPT
 Helper to transpose N strips with automatic dispatch.
 
FASTLED_FORCE_INLINE FL_IRAM size_t fl::transpose_wave8byte_parlio (const u8 *FL_RESTRICT_PARAM laneWaveforms, size_t data_width, u8 *FL_RESTRICT_PARAM outputBuffer) FL_NOEXCEPT
 
template<size_t DATA_WIDTH>
FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION size_t fl::transpose_wave8byte_parlio_template (const u8 *FL_RESTRICT_PARAM laneWaveforms, u8 *FL_RESTRICT_PARAM outputBuffer) FL_NOEXCEPT
 Template specialization of transpose for compile-time data_width (optimization)
 

Class Documentation

◆ fl::bitswap_type

union fl::bitswap_type
Class Members
struct bitswap_type.__unnamed0__ __unnamed__
u8 bytes[8] eight 8-bit values to load for swapping
u32 word[2] two 32-bit values to load for swapping

◆ fl::bitswap_type.__unnamed0__

struct fl::bitswap_type.__unnamed0__
Class Members
sub4 a 32-bit access struct for bit swapping, upper four bytes
sub4 b 32-bit access struct for bit swapping, lower four bytes

◆ fl::just8bits

union fl::just8bits
Class Members
struct just8bits.__unnamed0__ __unnamed__
u8 raw the entire byte

◆ fl::just8bits.__unnamed0__

struct fl::just8bits.__unnamed0__
Class Members
u32 a0:1 bit 0 (0x01)
u32 a1:1 bit 1 (0x02)
u32 a2:1 bit 2 (0x04)
u32 a3:1 bit 3 (0x08)
u32 a4:1 bit 4 (0x10)
u32 a5:1 bit 5 (0x20)
u32 a6:1 bit 6 (0x40)
u32 a7:1 bit 7 (0x80)

◆ fl::SPITransposer::LaneData

struct fl::SPITransposer::LaneData
+ Collaboration diagram for fl::SPITransposer::LaneData:
Class Members
span< const u8 > padding_frame Black LED frame for padding (repeating pattern)
span< const u8 > payload Actual LED data for this lane.

◆ fl::sub4

struct fl::sub4
Class Members
u32 a0:1 byte 'a', bit 0
u32 a1:1 byte 'a', bit 1
u32 a2:1 byte 'a', bit 2
u32 a3:1 byte 'a', bit 3
u32 a4:1 byte 'a', bit 4
u32 a5:1 byte 'a', bit 5
u32 a6:1 byte 'a', bit 6
u32 a7:1 byte 'a', bit 7
u32 b0:1 byte 'b', bit 0
u32 b1:1 byte 'b', bit 1
u32 b2:1 byte 'b', bit 2
u32 b3:1 byte 'b', bit 3
u32 b4:1 byte 'b', bit 4
u32 b5:1 byte 'b', bit 5
u32 b6:1 byte 'b', bit 6
u32 b7:1 byte 'b', bit 7
u32 c0:1 byte 'c', bit 0
u32 c1:1 byte 'c', bit 1
u32 c2:1 byte 'c', bit 2
u32 c3:1 byte 'c', bit 3
u32 c4:1 byte 'c', bit 4
u32 c5:1 byte 'c', bit 5
u32 c6:1 byte 'c', bit 6
u32 c7:1 byte 'c', bit 7
u32 d0:1 byte 'd', bit 0
u32 d1:1 byte 'd', bit 1
u32 d2:1 byte 'd', bit 2
u32 d3:1 byte 'd', bit 3
u32 d4:1 byte 'd', bit 4
u32 d5:1 byte 'd', bit 5
u32 d6:1 byte 'd', bit 6
u32 d7:1 byte 'd', bit 7