|
WS2812_RMT Driver 0.1.0
API reference
|
The port of the WS2812_RMT driver: the CRTP base, its pin enums and the Ws2812RmtPort concept. The part is driven by a timed bit stream (bus: [pio]), and the port is the only place that touches an MCU peripheral (on ESP32 the RMT transmitter).
More...
#include <concepts>#include <cstdint>#include <span>#include "ws2812_rmt_detail.hpp"#include "ws2812_rmt_types.hpp"Go to the source code of this file.
Classes | |
| class | ws2812_rmt::GpioInterface< Derived > |
| CRTP base of the platform port. More... | |
Namespaces | |
| namespace | ws2812_rmt |
The WS2812_RMT driver: everything it declares lives here; internals in detail. | |
Concepts | |
| concept | ws2812_rmt::Ws2812RmtPort |
Satisfied by a class that derives from GpioInterface<Port> and implements the required hooks with exactly the types above, noexcept and returning bool (handbook KB-CPP20-006). | |
Enumerations | |
| enum class | ws2812_rmt::CtrlPin : uint8_t { ws2812_rmt::Power } |
Control pins the port may drive through the optional GpioSet() hook. More... | |
| enum class | ws2812_rmt::GpioSignal : uint8_t { ws2812_rmt::INACTIVE = 0 , ws2812_rmt::ACTIVE = 1 } |
| Logical level of a pin; the port maps it to the physical polarity. More... | |
Variables | |
| constexpr uint32_t | ws2812_rmt::kMinResolutionHz = 20'000'000 |
| constexpr uint32_t | ws2812_rmt::kRecommendedResolutionHz = 20'000'000 |
| constexpr uint32_t | ws2812_rmt::kRmtHalfSymbolMaxTicks = 32'767 |
The port of the WS2812_RMT driver: the CRTP base, its pin enums and the Ws2812RmtPort concept. The part is driven by a timed bit stream (bus: [pio]), and the port is the only place that touches an MCU peripheral (on ESP32 the RMT transmitter).
The driver builds the byte stream and resolves the waveform; the port sends it. Derive your class from ws2812_rmt::GpioInterface<Self> and implement, all noexcept (the contract of each hook is in docs/porting.md):
bool EnsureInitialized(): required; open the channel, idle LOW, drive Power INACTIVE first.bool ResolutionHz(uint32_t& hz): required; the tick rate the channel really runs at.bool Transmit(std::span<const uint8_t>, const Waveform&, uint32_t timeout_ms): required; one gapless stream, then the reset low; false on a failure, a timeout or an underrun it can see, leaving the line low (the driver then waits a full reset before the next frame).void DelayUs(uint32_t): required; wait with the line low.bool GpioSet(CtrlPin, GpioSignal): optional; Power ACTIVE switches the strip supply on. A port with the hook starts unpowered (the application calls PowerOn() before the first Show()); a port with the hook but no pin returns true.void Log(LogLevel, const char*): optional; plain text, never a format.