FastLED 3.9.15
Loading...
Searching...
No Matches
wave3.h
Go to the documentation of this file.
2
3#pragma once
4
5// allow-include-after-namespace
6
7#include "fl/stl/align.h"
9#include "fl/stl/stdint.h"
10
11namespace fl {
12
13struct ChipsetTiming;
14
20struct Wave3Byte {
21 u8 data[3]; // 24 bits total (8 LED bits × 3 ticks each)
22};
23
31struct FL_ALIGNAS(4) Wave3BitExpansionLut {
32 u16 lut[16]; // nibble → 12-bit pattern in lower bits of u16
33};
34
42bool canUseWave3(const ChipsetTiming& timing);
43
50u32 wave3ClockFrequencyHz(const ChipsetTiming& timing);
51
59Wave3BitExpansionLut buildWave3ExpansionLUT(const ChipsetTiming& timing);
60
61// Forward declaration for inline function (implementation in detail/wave3.hpp)
62void wave3(u8 lane,
63 const Wave3BitExpansionLut& lut,
64 u8 (&FL_RESTRICT_PARAM output)[sizeof(Wave3Byte)]);
65
66// Public transposition functions (implementations in wave3.cpp.hpp)
68 const u8 (&FL_RESTRICT_PARAM lanes)[2],
69 const Wave3BitExpansionLut& lut,
70 u8 (&FL_RESTRICT_PARAM output)[2 * sizeof(Wave3Byte)]);
71
73 const u8 (&FL_RESTRICT_PARAM lanes)[4],
74 const Wave3BitExpansionLut& lut,
75 u8 (&FL_RESTRICT_PARAM output)[4 * sizeof(Wave3Byte)]);
76
78 const u8 (&FL_RESTRICT_PARAM lanes)[8],
79 const Wave3BitExpansionLut& lut,
80 u8 (&FL_RESTRICT_PARAM output)[8 * sizeof(Wave3Byte)]);
81
83 const u8 (&FL_RESTRICT_PARAM lanes)[16],
84 const Wave3BitExpansionLut& lut,
85 u8 (&FL_RESTRICT_PARAM output)[16 * sizeof(Wave3Byte)]);
86
87// Untranspose functions (for testing - reverse the transpose operation)
89 const u8 (&FL_RESTRICT_PARAM transposed)[2 * sizeof(Wave3Byte)],
90 u8 (&FL_RESTRICT_PARAM output)[2 * sizeof(Wave3Byte)]);
91
93 const u8 (&FL_RESTRICT_PARAM transposed)[4 * sizeof(Wave3Byte)],
94 u8 (&FL_RESTRICT_PARAM output)[4 * sizeof(Wave3Byte)]);
95
97 const u8 (&FL_RESTRICT_PARAM transposed)[8 * sizeof(Wave3Byte)],
98 u8 (&FL_RESTRICT_PARAM output)[8 * sizeof(Wave3Byte)]);
99
101 const u8 (&FL_RESTRICT_PARAM transposed)[16 * sizeof(Wave3Byte)],
102 u8 (&FL_RESTRICT_PARAM output)[16 * sizeof(Wave3Byte)]);
103
104} // namespace fl
105
106// Include inline implementations for optimal performance
107// This must be after the namespace to avoid the include-after-namespace linter error
Alignment macros and utilities for FastLED.
unsigned char u8
Definition stdint.h:131
unsigned char u8
Definition stdint.h:131
FL_OPTIMIZE_FUNCTION void wave3Untranspose_4(const u8(&FL_RESTRICT_PARAM transposed)[4 *sizeof(Wave3Byte)], u8(&FL_RESTRICT_PARAM output)[4 *sizeof(Wave3Byte)])
FL_OPTIMIZE_FUNCTION Wave3BitExpansionLut buildWave3ExpansionLUT(const ChipsetTiming &timing)
Build a Wave3BitExpansionLut from chipset timing data.
Definition wave3.cpp.hpp:69
FL_OPTIMIZE_FUNCTION FL_IRAM void wave3Transpose_4(const u8(&FL_RESTRICT_PARAM lanes)[4], const Wave3BitExpansionLut &lut, u8(&FL_RESTRICT_PARAM output)[4 *sizeof(Wave3Byte)])
FL_OPTIMIZE_FUNCTION void wave3Untranspose_8(const u8(&FL_RESTRICT_PARAM transposed)[8 *sizeof(Wave3Byte)], u8(&FL_RESTRICT_PARAM output)[8 *sizeof(Wave3Byte)])
FL_OPTIMIZE_FUNCTION void wave3Untranspose_2(const u8(&FL_RESTRICT_PARAM transposed)[2 *sizeof(Wave3Byte)], u8(&FL_RESTRICT_PARAM output)[2 *sizeof(Wave3Byte)])
struct FL_ALIGNAS(4) Wave3BitExpansionLut
Lookup table for nibble-to-waveform expansion in wave3 format (32 bytes)
Definition wave3.h:31
FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION void wave3(u8 lane, const Wave3BitExpansionLut &lut, u8(&FL_RESTRICT_PARAM output)[sizeof(Wave3Byte)])
Convert byte to 3 wave3 bytes using nibble LUT.
Definition wave3.hpp:190
FL_OPTIMIZE_FUNCTION u32 wave3ClockFrequencyHz(const ChipsetTiming &timing)
Calculate the clock frequency for wave3 encoding.
Definition wave3.cpp.hpp:54
FL_OPTIMIZE_FUNCTION FL_IRAM void wave3Transpose_2(const u8(&FL_RESTRICT_PARAM lanes)[2], const Wave3BitExpansionLut &lut, u8(&FL_RESTRICT_PARAM output)[2 *sizeof(Wave3Byte)])
FL_OPTIMIZE_FUNCTION FL_IRAM void wave3Transpose_8(const u8(&FL_RESTRICT_PARAM lanes)[8], const Wave3BitExpansionLut &lut, u8(&FL_RESTRICT_PARAM output)[8 *sizeof(Wave3Byte)])
FL_OPTIMIZE_FUNCTION bool canUseWave3(const ChipsetTiming &timing)
Check if a chipset timing is eligible for wave3 encoding.
Definition wave3.cpp.hpp:25
FL_OPTIMIZE_FUNCTION FL_IRAM void wave3Transpose_16(const u8(&FL_RESTRICT_PARAM lanes)[16], const Wave3BitExpansionLut &lut, u8(&FL_RESTRICT_PARAM output)[16 *sizeof(Wave3Byte)])
FL_OPTIMIZE_FUNCTION void wave3Untranspose_16(const u8(&FL_RESTRICT_PARAM transposed)[16 *sizeof(Wave3Byte)], u8(&FL_RESTRICT_PARAM output)[16 *sizeof(Wave3Byte)])
Base definition for an LED controller.
Definition crgb.hpp:179
u8 data[3]
Definition wave3.h:21
Type-safe container for 3-byte wave pulse pattern (wave3 encoding)
Definition wave3.h:20
Generic chipset timing entry Provides T1, T2, T3 timing parameters in nanoseconds for any LED protoco...
Definition led_timing.h:86
#define FL_RESTRICT_PARAM