WS2812_RMT Driver 0.1.0
API reference
Loading...
Searching...
No Matches
ws2812_rmt_types.hpp
Go to the documentation of this file.
1
16#ifndef WS2812_RMT_TYPES_HPP
17#define WS2812_RMT_TYPES_HPP
18
19#include <array>
20#include <cstddef>
21#include <cstdint>
22
23#include "ws2812_rmt_detail.hpp"
24#include "ws2812_rmt_version.h"
25
27namespace ws2812_rmt {
28
42enum class [[nodiscard]] Error : uint8_t {
43 Ok = 0,
44 NotInitialized = 1,
45 InvalidArgument = 2,
46 Bus = 3,
48 Timeout = 4,
50 Crc = 6,
51 Busy = 7,
52 DeviceFault = 8,
53 Unsupported = 9,
55 16,
57 17
58};
59
65constexpr const char* ToString(Error error) noexcept {
66 switch (error) {
67 case Error::Ok:
68 return "Ok";
70 return "NotInitialized";
72 return "InvalidArgument";
73 case Error::Bus:
74 return "Bus";
75 case Error::Timeout:
76 return "Timeout";
78 return "DeviceIdMismatch";
79 case Error::Crc:
80 return "Crc";
81 case Error::Busy:
82 return "Busy";
84 return "DeviceFault";
86 return "Unsupported";
88 return "TimingUnreachable";
90 return "NotPowered";
91 default:
92 break;
93 }
94 return "Unknown";
95}
96
101template <typename T>
102struct [[nodiscard]] Result {
103 T value{};
104 Error error{Error::Ok};
105
107 [[nodiscard]] constexpr bool ok() const noexcept {
108 return error == Error::Ok;
109 }
111 constexpr explicit operator bool() const noexcept {
112 return ok();
113 }
119 static constexpr Result Success(T v) noexcept {
120 return {v, Error::Ok};
121 }
127 static constexpr Result Failure(Error e) noexcept {
128 return {T{}, e};
129 }
130};
131
133template <>
134struct [[nodiscard]] Result<void> {
135 Error error{Error::Ok};
136
138 [[nodiscard]] constexpr bool ok() const noexcept {
139 return error == Error::Ok;
140 }
142 constexpr explicit operator bool() const noexcept {
143 return ok();
144 }
146 static constexpr Result Success() noexcept {
147 return {Error::Ok};
148 }
154 static constexpr Result Failure(Error e) noexcept {
155 return {e};
156 }
157};
158
160enum class LogLevel : uint8_t {
161 Error = 0,
162 Warning,
163 Info,
164 Debug,
165};
166
176enum class Variant : uint8_t {
177 Ws2812,
179 Ws2812bV5,
180 Ws2812c,
181 Ws2812d,
182 Sk6812,
183 Sk6812Rgbw,
184 Sk6812Mini,
187 Custom,
188};
189
190namespace detail {
192template <>
193struct EnumLast<Variant> {
194 static constexpr Variant kValue = Variant::Custom;
195};
196} // namespace detail
197
199enum class Channel : uint8_t {
200 R,
201 G,
202 B,
203 W,
204};
205
206namespace detail {
208template <>
209struct EnumLast<Channel> {
210 static constexpr Channel kValue = Channel::W;
211};
212} // namespace detail
213
215enum class Gamma : uint8_t {
216 None,
217 Gamma22,
218};
219
220namespace detail {
222template <>
223struct EnumLast<Gamma> {
224 static constexpr Gamma kValue = Gamma::Gamma22;
225};
226} // namespace detail
227
229struct Colour {
230 uint8_t r{0};
231 uint8_t g{0};
232 uint8_t b{0};
233 uint8_t w{0};
234
236 friend constexpr bool operator==(const Colour& lhs, const Colour& rhs) noexcept = default;
237
243 [[nodiscard]] static constexpr Colour FromPacked(uint32_t rgb) noexcept {
244 return Colour{.r = static_cast<uint8_t>((rgb >> 16U) & 0xFFU),
245 .g = static_cast<uint8_t>((rgb >> 8U) & 0xFFU),
246 .b = static_cast<uint8_t>(rgb & 0xFFU),
247 .w = 0};
248 }
254 [[nodiscard]] static constexpr Colour FromPackedW(uint32_t wrgb) noexcept {
255 return Colour{.r = static_cast<uint8_t>((wrgb >> 16U) & 0xFFU),
256 .g = static_cast<uint8_t>((wrgb >> 8U) & 0xFFU),
257 .b = static_cast<uint8_t>(wrgb & 0xFFU),
258 .w = static_cast<uint8_t>((wrgb >> 24U) & 0xFFU)};
259 }
261 [[nodiscard]] constexpr uint32_t Packed() const noexcept {
262 return (static_cast<uint32_t>(r) << 16U) | (static_cast<uint32_t>(g) << 8U) |
263 static_cast<uint32_t>(b);
264 }
265};
266
269 std::array<Channel, 4> ch{Channel::G, Channel::R, Channel::B,
270 Channel::W};
271 uint8_t count{3};
272
274 friend constexpr bool operator==(const ColourOrder& lhs,
275 const ColourOrder& rhs) noexcept = default;
276};
277
280 .count = 3};
283 .count = 3};
286 .count = 4};
289 .count = 4};
290
292struct Range {
293 uint32_t min_ns{0};
294 uint32_t max_ns{0};
295 uint32_t nominal_ns{0};
296
298 friend constexpr bool operator==(const Range& lhs, const Range& rhs) noexcept = default;
299};
300
308struct Timing {
313 uint32_t period_min_ns{0};
314 uint32_t period_max_ns{0};
315 uint32_t reset_min_ns{0};
316 uint32_t max_low_ns{0};
317
319 friend constexpr bool operator==(const Timing& lhs, const Timing& rhs) noexcept = default;
320};
321
324inline constexpr uint32_t kMaxDurationNs = 100'000;
326inline constexpr uint32_t kMaxPeriodNs = 200'000;
328inline constexpr uint32_t kMaxResetUs = 10'000;
331inline constexpr uint32_t kResetMarginUs = 20;
333inline constexpr size_t kMaxPixels = 65'536;
335inline constexpr uint32_t kMaxSettleUs = 1'000'000;
337inline constexpr uint32_t kMaxSlackMs = 60'000;
339inline constexpr uint32_t kMaxResolutionHz = 1'000'000'000;
340
343inline constexpr uint32_t kMaxSupplyMv = 6000;
346inline constexpr uint32_t kV5MinHighMv = 2700;
351inline constexpr uint32_t kSk6812MinHighMv = 3400;
352
354struct Waveform {
355 uint32_t resolution_hz{0};
356 uint32_t t0h_ticks{0};
357 uint32_t t0l_ticks{0};
358 uint32_t t1h_ticks{0};
359 uint32_t t1l_ticks{0};
360 uint32_t reset_ticks{0};
361 uint32_t max_gap_ticks{0};
362
364 friend constexpr bool operator==(const Waveform& lhs, const Waveform& rhs) noexcept = default;
365};
366
374[[nodiscard]] constexpr Range MakeRange(uint32_t min_ns, uint32_t max_ns,
375 uint32_t nominal_ns) noexcept {
376 return Range{.min_ns = min_ns, .max_ns = max_ns, .nominal_ns = nominal_ns};
377}
378
380struct Limits {
381 uint32_t period_min_ns;
382 uint32_t period_max_ns;
383 uint32_t reset_min_ns;
384 uint32_t max_low_ns;
385};
386
395[[nodiscard]] constexpr Limits MakeLimits(uint32_t period_min_ns, uint32_t period_max_ns,
396 uint32_t reset_min_ns, uint32_t max_low_ns) noexcept {
397 return Limits{.period_min_ns = period_min_ns,
398 .period_max_ns = period_max_ns,
399 .reset_min_ns = reset_min_ns,
400 .max_low_ns = max_low_ns};
401}
402
412[[nodiscard]] constexpr Timing MakeTiming(const Range& t0h, const Range& t0l, const Range& t1h,
413 const Range& t1l, const Limits& limits) noexcept {
414 return Timing{.t0h = t0h,
415 .t0l = t0l,
416 .t1h = t1h,
417 .t1l = t1l,
418 .period_min_ns = limits.period_min_ns,
419 .period_max_ns = limits.period_max_ns,
420 .reset_min_ns = limits.reset_min_ns,
421 .max_low_ns = limits.max_low_ns};
422}
423
430[[nodiscard]] constexpr Timing ProfileTiming(Variant variant) noexcept {
431 switch (variant) {
432 case Variant::Ws2812: // DS ws2812 p.4
434 ws2812_rmt::MakeRange(200U, 500U, 350U), ws2812_rmt::MakeRange(650U, 950U, 800U),
435 ws2812_rmt::MakeRange(550U, 850U, 700U), ws2812_rmt::MakeRange(450U, 750U, 600U),
436 ws2812_rmt::MakeLimits(650U, 1850U, 50'000U, 0U));
437 case Variant::Ws2812bPreV5: // DS b-af p.3, b-cn p.3, ws2812s p.4, b-mar17 p.4
439 ws2812_rmt::MakeRange(250U, 380U, 300U), ws2812_rmt::MakeRange(750U, 1000U, 850U),
440 ws2812_rmt::MakeRange(750U, 950U, 800U), ws2812_rmt::MakeRange(300U, 420U, 350U),
441 ws2812_rmt::MakeLimits(950U, 1550U, 300'000U, 50'000U));
442 case Variant::Ws2812bV5: // DS b-v5 p.3, b-v5-w p.3, b-v6-h, b-v6 p.4, b-2020 p.4, c-2020 p.4,
443 // b-1313 p.3
444 // t0h aims at 350, not the middle of its window (300): with t0l 950 the period would sit
445 // exactly on the 1250 ns minimum of the V6 sheets
447 ws2812_rmt::MakeRange(220U, 380U, 350U), ws2812_rmt::MakeRange(580U, 1000U, 950U),
448 ws2812_rmt::MakeRange(580U, 1000U, 650U), ws2812_rmt::MakeRange(580U, 1000U, 650U),
449 ws2812_rmt::MakeLimits(1250U, 0U, 280'000U, 0U));
450 case Variant::Ws2812c: // DS c-a p.3, c-b p.3, ws-2020 p.3
452 ws2812_rmt::MakeRange(220U, 380U, 300U), ws2812_rmt::MakeRange(580U, 1000U, 900U),
453 ws2812_rmt::MakeRange(580U, 1000U, 700U), ws2812_rmt::MakeRange(220U, 420U, 350U),
454 ws2812_rmt::MakeLimits(0U, 0U, 280'000U, 0U));
455 case Variant::Ws2812d: // DS d-f8 p.4
457 ws2812_rmt::MakeRange(220U, 380U, 300U), ws2812_rmt::MakeRange(750U, 1000U, 900U),
458 ws2812_rmt::MakeRange(750U, 1000U, 850U), ws2812_rmt::MakeRange(220U, 380U, 300U),
459 ws2812_rmt::MakeLimits(0U, 0U, 280'000U, 0U));
460 case Variant::Sk6812: // DS sk-01 p.5
462 ws2812_rmt::MakeRange(150U, 450U, 300U), ws2812_rmt::MakeRange(750U, 1050U, 900U),
463 ws2812_rmt::MakeRange(450U, 750U, 600U), ws2812_rmt::MakeRange(450U, 750U, 600U),
464 ws2812_rmt::MakeLimits(650U, 1850U, 80'000U, 50'000U));
465 case Variant::Sk6812Rgbw: // DS skw-01 p.5, skw-03 p.5, skw-07 p.7
467 ws2812_rmt::MakeRange(200U, 400U, 300U), ws2812_rmt::MakeRange(800U, 1050U, 950U),
468 ws2812_rmt::MakeRange(580U, 750U, 650U), ws2812_rmt::MakeRange(450U, 750U, 600U),
469 ws2812_rmt::MakeLimits(1200U, 1850U, 80'000U, 20'000U));
470 case Variant::Sk6812Mini: // DS skm-e p.7, skm p.3
472 ws2812_rmt::MakeRange(200U, 400U, 320U), ws2812_rmt::MakeRange(800U, 0U, 950U),
473 ws2812_rmt::MakeRange(580U, 1000U, 650U), ws2812_rmt::MakeRange(200U, 0U, 600U),
474 ws2812_rmt::MakeLimits(1200U, 0U, 80'000U, 20'000U));
475 case Variant::Custom:
476 break;
477 default:
478 break;
479 }
480 return Timing{};
481}
482
488[[nodiscard]] constexpr ColourOrder DefaultOrder(Variant variant) noexcept {
489 switch (variant) {
490 case Variant::Ws2812:
493 case Variant::Ws2812c:
494 case Variant::Ws2812d:
495 case Variant::Sk6812:
497 return kOrderGrb;
499 return kOrderGrbw;
500 case Variant::Custom:
501 break;
502 default:
503 break;
504 }
505 return ColourOrder{.ch = {Channel::R, Channel::G, Channel::B, Channel::W}, .count = 0};
506}
507
509struct Config {
511 bool use_default_order{true};
513 uint8_t brightness{255};
515 uint32_t pixel_count{0};
516 uint32_t reset_us{0};
517 uint32_t power_on_settle_us{1000};
518 uint32_t transmit_slack_ms{20};
520
522 [[nodiscard]] static constexpr Config Default() noexcept {
523 return Config{};
524 }
525};
526
528constexpr const char* GetDriverVersion() noexcept {
529 return WS2812_RMT_VERSION_STRING;
530}
532constexpr uint32_t GetDriverVersionMajor() noexcept {
533 return WS2812_RMT_VERSION_MAJOR;
534}
536constexpr uint32_t GetDriverVersionMinor() noexcept {
537 return WS2812_RMT_VERSION_MINOR;
538}
540constexpr uint32_t GetDriverVersionPatch() noexcept {
541 return WS2812_RMT_VERSION_PATCH;
542}
543
546} // namespace ws2812_rmt
547
548#endif // WS2812_RMT_TYPES_HPP
LogLevel
Severity passed to the optional Log() hook.
Definition ws2812_rmt_types.hpp:160
constexpr uint32_t kResetMarginUs
Added to the datasheet reset minimum when Config::reset_us is 0, in microseconds (A-3).
Definition ws2812_rmt_types.hpp:331
constexpr Range MakeRange(uint32_t min_ns, uint32_t max_ns, uint32_t nominal_ns) noexcept
A timing window from its three numbers.
Definition ws2812_rmt_types.hpp:374
constexpr ColourOrder DefaultOrder(Variant variant) noexcept
The colour order a named variant uses unless Config overrides it.
Definition ws2812_rmt_types.hpp:488
constexpr const char * GetDriverVersion() noexcept
Definition ws2812_rmt_types.hpp:528
constexpr uint32_t GetDriverVersionMinor() noexcept
Definition ws2812_rmt_types.hpp:536
constexpr uint32_t kMaxResolutionHz
The highest tick rate the driver accepts from a port, in Hz.
Definition ws2812_rmt_types.hpp:339
constexpr uint32_t kMaxSettleUs
Longest power-on settle Config may ask for, in microseconds.
Definition ws2812_rmt_types.hpp:335
constexpr ColourOrder kOrderRgb
Red, green, blue.
Definition ws2812_rmt_types.hpp:282
constexpr uint32_t kMaxDurationNs
Longest single high or low duration a Custom timing may name, in ns (covers 400 kbit/s).
Definition ws2812_rmt_types.hpp:324
constexpr uint32_t kV5MinHighMv
The fixed floor of VIH of the V5 family, in millivolts (V5.0, datasheet p.2); later revisions print a...
Definition ws2812_rmt_types.hpp:346
constexpr uint32_t kMaxResetUs
Longest reset a timing or Config::reset_us may name, in microseconds.
Definition ws2812_rmt_types.hpp:328
constexpr uint32_t kMaxSlackMs
Longest transmit slack Config may ask for, in milliseconds.
Definition ws2812_rmt_types.hpp:337
constexpr uint32_t kMaxSupplyMv
Supplies above this count as 6 V in MinLogicHighMv() (the absolute maximum is 5.3 V).
Definition ws2812_rmt_types.hpp:343
Channel
A colour channel of a pixel.
Definition ws2812_rmt_types.hpp:199
constexpr ColourOrder kOrderRgbw
Red, green, blue, white: SK6812RGBW Rev 01 and Rev 03.
Definition ws2812_rmt_types.hpp:288
constexpr Limits MakeLimits(uint32_t period_min_ns, uint32_t period_max_ns, uint32_t reset_min_ns, uint32_t max_low_ns) noexcept
The limits of a timing from their four numbers.
Definition ws2812_rmt_types.hpp:395
Gamma
The transfer curve applied before brightness (convenience, not a chip feature).
Definition ws2812_rmt_types.hpp:215
constexpr uint32_t kSk6812MinHighMv
The 3.4 V input high level of the SK6812 family at 5 V, in millivolts: the minimum of SK6812RGBW Rev ...
Definition ws2812_rmt_types.hpp:351
constexpr const char * ToString(Error error) noexcept
The name of an error, for logs.
Definition ws2812_rmt_types.hpp:65
constexpr uint32_t GetDriverVersionPatch() noexcept
Definition ws2812_rmt_types.hpp:540
constexpr Timing ProfileTiming(Variant variant) noexcept
The window set of a named variant, as nanoseconds. Values are the intersection of the windows of ever...
Definition ws2812_rmt_types.hpp:430
Variant
The timing generation (window set) of the part, chosen by what is printed on or known about it.
Definition ws2812_rmt_types.hpp:176
Error
Why a call failed. Values 0 to 9 are the shared base set; chip-specific values start at 16.
Definition ws2812_rmt_types.hpp:42
constexpr ColourOrder kOrderGrb
Green, red, blue: the wire order of every WS2812 and SK6812 RGB part.
Definition ws2812_rmt_types.hpp:279
constexpr uint32_t GetDriverVersionMajor() noexcept
Definition ws2812_rmt_types.hpp:532
constexpr size_t kMaxPixels
Largest strip the driver accepts, in pixels.
Definition ws2812_rmt_types.hpp:333
constexpr uint32_t kMaxPeriodNs
Longest period a Custom timing may name, in ns.
Definition ws2812_rmt_types.hpp:326
constexpr Timing MakeTiming(const Range &t0h, const Range &t0l, const Range &t1h, const Range &t1l, const Limits &limits) noexcept
A timing from its four windows and its limits.
Definition ws2812_rmt_types.hpp:412
constexpr ColourOrder kOrderGrbw
Green, red, blue, white: SK6812RGBW Rev 07 (the default for Variant::Sk6812Rgbw).
Definition ws2812_rmt_types.hpp:285
@ Warning
Something unexpected that the driver recovered from.
@ Info
Lifecycle events.
@ Debug
Detail for bring-up.
@ W
White (RGBW parts only).
@ Gamma22
round(255 * (v / 255) ^ 2.2) from a committed table.
@ Ws2812
WS2812 (6 pin): 0.35/0.8/0.7/0.6 us +-150 ns, reset above 50 us.
@ Ws2812bV5
WS2812B V5 and V6, WS2812B-2020, WS2812B-1313, WS2812C-2020: reset above 280 us.
@ Ws2812c
WS2812C (5050) and WS2812-2020: T1L window 220 to 420 ns.
@ Ws2812d
WS2812D-F8: 750 to 1000 ns on T0L and T1H.
@ Custom
Any other part with the same frame: the whole timing is Config::custom.
@ Ws2812bPreV5
WS2812B and WS2812S of 2013 to 2017: reset above 300 us.
@ Sk6812
SK6812 RGB (Rev 01): 0.3/0.9/0.6/0.6 us +-150 ns, reset 80 us.
@ Sk6812Rgbw
SK6812RGBW: 32 bit frame, low inside a frame below 20 us.
@ InvalidArgument
Validate() failed, or a pixel index is out of range.
@ NotPowered
Show() or TraceWire() between PowerOff() and PowerOn(): nothing is sent.
@ DeviceIdMismatch
Not returned by this driver: the pixels are write-only.
@ Crc
Not returned by this driver: the frame has no checksum.
@ DeviceFault
Not returned by this driver: no pixel reports a fault.
@ NotInitialized
EnsureInitialized() has not succeeded.
@ TimingUnreachable
The port's tick rate cannot place any tick count inside a timing window.
@ Ok
The call succeeded.
@ Unsupported
PowerOn() or PowerOff() on a port without a GpioSet() hook.
@ Timeout
Not returned by this driver: the port reports a timeout as false.
@ Busy
Not returned by this driver: Show() blocks until the frame is out.
The WS2812_RMT driver: everything it declares lives here; internals in detail.
Definition ws2812_rmt.hpp:29
The order of the channels on the wire, first sent first.
Definition ws2812_rmt_types.hpp:268
friend constexpr bool operator==(const ColourOrder &lhs, const ColourOrder &rhs) noexcept=default
Hidden friend: exact member comparison.
std::array< Channel, 4 > ch
Channels in wire order.
Definition ws2812_rmt_types.hpp:269
uint8_t count
3 or 4 channels used.
Definition ws2812_rmt_types.hpp:271
A pixel colour, 8 bit per channel; w is used only by four-channel orders.
Definition ws2812_rmt_types.hpp:229
uint8_t g
Green.
Definition ws2812_rmt_types.hpp:231
friend constexpr bool operator==(const Colour &lhs, const Colour &rhs) noexcept=default
Hidden friend: exact member comparison.
uint8_t r
Red.
Definition ws2812_rmt_types.hpp:230
uint8_t w
White.
Definition ws2812_rmt_types.hpp:233
static constexpr Colour FromPacked(uint32_t rgb) noexcept
A colour from 0xRRGGBB.
Definition ws2812_rmt_types.hpp:243
static constexpr Colour FromPackedW(uint32_t wrgb) noexcept
A colour from 0xWWRRGGBB.
Definition ws2812_rmt_types.hpp:254
uint8_t b
Blue.
Definition ws2812_rmt_types.hpp:232
constexpr uint32_t Packed() const noexcept
Definition ws2812_rmt_types.hpp:261
Everything EnsureInitialized() uses. The defaults suit a current WS2812B (V5, V6).
Definition ws2812_rmt_types.hpp:509
uint32_t pixel_count
Pixels in the strip; 0 means the whole capacity.
Definition ws2812_rmt_types.hpp:515
ColourOrder order
Wire order when use_default_order is false.
Definition ws2812_rmt_types.hpp:512
uint8_t brightness
Linear dimming at start, 0 to 255.
Definition ws2812_rmt_types.hpp:513
uint32_t transmit_slack_ms
Added to the frame time to form the port timeout.
Definition ws2812_rmt_types.hpp:518
Variant variant
The timing generation; no profile fits every part.
Definition ws2812_rmt_types.hpp:510
Gamma gamma
Transfer curve at start.
Definition ws2812_rmt_types.hpp:514
Timing custom
Used only with Variant::Custom; all zero otherwise.
Definition ws2812_rmt_types.hpp:519
uint32_t reset_us
Reset low time; 0 = datasheet minimum plus kResetMarginUs.
Definition ws2812_rmt_types.hpp:516
static constexpr Config Default() noexcept
Definition ws2812_rmt_types.hpp:522
bool use_default_order
False: order is used. Always false for Custom.
Definition ws2812_rmt_types.hpp:511
uint32_t power_on_settle_us
Wait after PowerOn() (no datasheet value, A-16).
Definition ws2812_rmt_types.hpp:517
The four limits of a Timing (a parameter group of MakeTiming()).
Definition ws2812_rmt_types.hpp:380
uint32_t period_max_ns
Longest bit period, 0 none.
Definition ws2812_rmt_types.hpp:382
uint32_t reset_min_ns
The low time that must be exceeded to latch.
Definition ws2812_rmt_types.hpp:383
uint32_t max_low_ns
The low time that must stay below inside a frame, 0 for reset_min_ns.
Definition ws2812_rmt_types.hpp:384
uint32_t period_min_ns
Shortest bit period, 0 none.
Definition ws2812_rmt_types.hpp:381
A timing window in nanoseconds, with the value the driver aims for.
Definition ws2812_rmt_types.hpp:292
uint32_t nominal_ns
The target inside the window.
Definition ws2812_rmt_types.hpp:295
uint32_t max_ns
Inclusive upper bound; 0 means the document gives none.
Definition ws2812_rmt_types.hpp:294
friend constexpr bool operator==(const Range &lhs, const Range &rhs) noexcept=default
Hidden friend: exact member comparison.
uint32_t min_ns
Inclusive lower bound.
Definition ws2812_rmt_types.hpp:293
constexpr bool ok() const noexcept
Definition ws2812_rmt_types.hpp:138
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition ws2812_rmt_types.hpp:154
static constexpr Result Success() noexcept
Definition ws2812_rmt_types.hpp:146
The value of a call, or why there is none.
Definition ws2812_rmt_types.hpp:102
constexpr bool ok() const noexcept
Definition ws2812_rmt_types.hpp:107
static constexpr Result Success(T v) noexcept
A successful result.
Definition ws2812_rmt_types.hpp:119
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition ws2812_rmt_types.hpp:127
The wire timing of one window set.
Definition ws2812_rmt_types.hpp:308
Range t1h
1 code, high time.
Definition ws2812_rmt_types.hpp:311
uint32_t max_low_ns
The low time that must stay below inside a frame; 0 = reset_min_ns.
Definition ws2812_rmt_types.hpp:316
uint32_t period_max_ns
Longest bit period; 0 none.
Definition ws2812_rmt_types.hpp:314
uint32_t period_min_ns
Shortest bit period (high plus low); 0 none.
Definition ws2812_rmt_types.hpp:313
Range t0l
0 code, low time.
Definition ws2812_rmt_types.hpp:310
uint32_t reset_min_ns
The low time that must be exceeded to latch.
Definition ws2812_rmt_types.hpp:315
friend constexpr bool operator==(const Timing &lhs, const Timing &rhs) noexcept=default
Hidden friend: exact member comparison.
Range t1l
1 code, low time.
Definition ws2812_rmt_types.hpp:312
Range t0h
0 code, high time.
Definition ws2812_rmt_types.hpp:309
What the port needs to send the frame, in ticks of resolution_hz.
Definition ws2812_rmt_types.hpp:354
uint32_t t1h_ticks
1 code, high.
Definition ws2812_rmt_types.hpp:358
uint32_t t0l_ticks
0 code, low.
Definition ws2812_rmt_types.hpp:357
uint32_t resolution_hz
The tick rate the port reported.
Definition ws2812_rmt_types.hpp:355
uint32_t t0h_ticks
0 code, high.
Definition ws2812_rmt_types.hpp:356
uint32_t t1l_ticks
1 code, low.
Definition ws2812_rmt_types.hpp:359
uint32_t max_gap_ticks
The longest low the pixels tolerate inside a frame.
Definition ws2812_rmt_types.hpp:361
friend constexpr bool operator==(const Waveform &lhs, const Waveform &rhs) noexcept=default
Hidden friend: exact member comparison.
uint32_t reset_ticks
Line low after the last bit.
Definition ws2812_rmt_types.hpp:360
Compile-time helpers of the WS2812_RMT driver: exact hook matching and enumeration checks.