WS2812_RMT Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
ws2812_rmt_types.hpp File Reference

Public types of the WS2812_RMT driver: errors, Result<T>, colours, the timing profile of every supported part, Waveform and Config. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include "ws2812_rmt_detail.hpp"
#include "ws2812_rmt_version.h"

Go to the source code of this file.

Classes

struct  ws2812_rmt::Result< T >
 The value of a call, or why there is none. More...
 
struct  ws2812_rmt::Result< void >
 The result of a call that returns no value. More...
 
struct  ws2812_rmt::Colour
 A pixel colour, 8 bit per channel; w is used only by four-channel orders. More...
 
struct  ws2812_rmt::ColourOrder
 The order of the channels on the wire, first sent first. More...
 
struct  ws2812_rmt::Range
 A timing window in nanoseconds, with the value the driver aims for. More...
 
struct  ws2812_rmt::Timing
 The wire timing of one window set. More...
 
struct  ws2812_rmt::Waveform
 What the port needs to send the frame, in ticks of resolution_hz. More...
 
struct  ws2812_rmt::Limits
 The four limits of a Timing (a parameter group of MakeTiming()). More...
 
struct  ws2812_rmt::Config
 Everything EnsureInitialized() uses. The defaults suit a current WS2812B (V5, V6). More...
 

Namespaces

namespace  ws2812_rmt
 The WS2812_RMT driver: everything it declares lives here; internals in detail.
 

Enumerations

enum class  ws2812_rmt::Error : uint8_t {
  ws2812_rmt::Error::Ok = 0 , ws2812_rmt::Error::NotInitialized = 1 , ws2812_rmt::Error::InvalidArgument = 2 , ws2812_rmt::Error::Bus = 3 ,
  ws2812_rmt::Error::Timeout = 4 , ws2812_rmt::Error::DeviceIdMismatch = 5 , ws2812_rmt::Error::Crc = 6 , ws2812_rmt::Error::Busy = 7 ,
  ws2812_rmt::Error::DeviceFault = 8 , ws2812_rmt::Error::Unsupported = 9 , ws2812_rmt::Error::TimingUnreachable , ws2812_rmt::Error::NotPowered
}
 Why a call failed. Values 0 to 9 are the shared base set; chip-specific values start at 16. More...
 
enum class  ws2812_rmt::LogLevel : uint8_t { ws2812_rmt::LogLevel::Error = 0 , ws2812_rmt::LogLevel::Warning , ws2812_rmt::LogLevel::Info , ws2812_rmt::LogLevel::Debug }
 Severity passed to the optional Log() hook. More...
 
enum class  ws2812_rmt::Variant : uint8_t {
  ws2812_rmt::Variant::Ws2812 , ws2812_rmt::Variant::Ws2812bPreV5 , ws2812_rmt::Variant::Ws2812bV5 , ws2812_rmt::Variant::Ws2812c ,
  ws2812_rmt::Variant::Ws2812d , ws2812_rmt::Variant::Sk6812 , ws2812_rmt::Variant::Sk6812Rgbw , ws2812_rmt::Variant::Sk6812Mini ,
  ws2812_rmt::Variant::Custom
}
 The timing generation (window set) of the part, chosen by what is printed on or known about it. More...
 
enum class  ws2812_rmt::Channel : uint8_t { ws2812_rmt::Channel::R , ws2812_rmt::Channel::G , ws2812_rmt::Channel::B , ws2812_rmt::Channel::W }
 A colour channel of a pixel. More...
 
enum class  ws2812_rmt::Gamma : uint8_t { ws2812_rmt::Gamma::None , ws2812_rmt::Gamma::Gamma22 }
 The transfer curve applied before brightness (convenience, not a chip feature). More...
 

Functions

constexpr const char * ws2812_rmt::ToString (Error error) noexcept
 The name of an error, for logs.
 
constexpr Range ws2812_rmt::MakeRange (uint32_t min_ns, uint32_t max_ns, uint32_t nominal_ns) noexcept
 A timing window from its three numbers.
 
constexpr Limits ws2812_rmt::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.
 
constexpr Timing ws2812_rmt::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.
 
constexpr Timing ws2812_rmt::ProfileTiming (Variant variant) noexcept
 The window set of a named variant, as nanoseconds. Values are the intersection of the windows of every document of that variant (docs/timing.md, section "Profiles").
 
constexpr ColourOrder ws2812_rmt::DefaultOrder (Variant variant) noexcept
 The colour order a named variant uses unless Config overrides it.
 
constexpr const char * ws2812_rmt::GetDriverVersion () noexcept
 
constexpr uint32_t ws2812_rmt::GetDriverVersionMajor () noexcept
 
constexpr uint32_t ws2812_rmt::GetDriverVersionMinor () noexcept
 
constexpr uint32_t ws2812_rmt::GetDriverVersionPatch () noexcept
 

Variables

constexpr ColourOrder ws2812_rmt::kOrderGrb
 Green, red, blue: the wire order of every WS2812 and SK6812 RGB part.
 
constexpr ColourOrder ws2812_rmt::kOrderRgb
 Red, green, blue.
 
constexpr ColourOrder ws2812_rmt::kOrderGrbw
 Green, red, blue, white: SK6812RGBW Rev 07 (the default for Variant::Sk6812Rgbw).
 
constexpr ColourOrder ws2812_rmt::kOrderRgbw
 Red, green, blue, white: SK6812RGBW Rev 01 and Rev 03.
 
constexpr uint32_t ws2812_rmt::kMaxDurationNs = 100'000
 Longest single high or low duration a Custom timing may name, in ns (covers 400 kbit/s).
 
constexpr uint32_t ws2812_rmt::kMaxPeriodNs = 200'000
 Longest period a Custom timing may name, in ns.
 
constexpr uint32_t ws2812_rmt::kMaxResetUs = 10'000
 Longest reset a timing or Config::reset_us may name, in microseconds.
 
constexpr uint32_t ws2812_rmt::kResetMarginUs = 20
 Added to the datasheet reset minimum when Config::reset_us is 0, in microseconds (A-3).
 
constexpr size_t ws2812_rmt::kMaxPixels = 65'536
 Largest strip the driver accepts, in pixels.
 
constexpr uint32_t ws2812_rmt::kMaxSettleUs = 1'000'000
 Longest power-on settle Config may ask for, in microseconds.
 
constexpr uint32_t ws2812_rmt::kMaxSlackMs = 60'000
 Longest transmit slack Config may ask for, in milliseconds.
 
constexpr uint32_t ws2812_rmt::kMaxResolutionHz = 1'000'000'000
 The highest tick rate the driver accepts from a port, in Hz.
 
constexpr uint32_t ws2812_rmt::kMaxSupplyMv = 6000
 Supplies above this count as 6 V in MinLogicHighMv() (the absolute maximum is 5.3 V).
 
constexpr uint32_t ws2812_rmt::kV5MinHighMv = 2700
 The fixed floor of VIH of the V5 family, in millivolts (V5.0, datasheet p.2); later revisions print a fraction of VDD instead (MinLogicHighMv()).
 
constexpr uint32_t ws2812_rmt::kSk6812MinHighMv = 3400
 The 3.4 V input high level of the SK6812 family at 5 V, in millivolts: the minimum of SK6812RGBW Rev 01 and Rev 03 (p.4), the typical value of SK6812 RGB Rev 01 (p.4, which prints no minimum). SK6812RGBX Rev 07 prints 0.7 x VDD instead (p.6); MinLogicHighMv() takes the larger.
 

Detailed Description

Public types of the WS2812_RMT driver: errors, Result<T>, colours, the timing profile of every supported part, Waveform and Config.

The parts are single-wire addressable LEDs (WS2812 and WS2812B in every published timing generation, WS2812C, WS2812D, SK6812, SK6812RGBW, SK6812MINI) with one 24 bit (32 bit for RGBW) NRZ frame at about 800 kbit/s: a bit is a high pulse then a low pulse, its value is the length of the high pulse, and a low longer than the reset time latches the frame. The family shares the frame; the timing windows, the reset time, the colour order and the channel count differ, and those are the data of this header (docs/timing.md and docs/datasheet.md give each value its document and page).