ws2812-device

xod-dev/ws2812/ws2812-device

Represents a chained sequence of WS2812 pixels.
ws2812-device
@/ws2812-device
Represents a chained sequence of WS2812 pixels.
PORTport
The board port DI is connected to
Wnumber
Number of LEDs in the strip
ws2812-device
PORT
W
DEV
DEV@/ws2812-device
The device
To use the node in your project you should have the xod-dev/ws2812 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#include <WS2812.h>

node {
    static_assert(isValidDigitalPort(constant_input_PORT), "must be a valid digital port");

    meta {
        using Type = WS2812*;
    }

    uint8_t mem[sizeof(WS2812)];

    void evaluate(Context ctx) {
        if (!isSettingUp()) return;
        uint32_t w = (uint32_t)getValue<input_W>(ctx);
        Type t = new (mem) WS2812(constant_input_PORT, w);
        emitValue<output_DEV>(ctx, t);
    }
}