Struct rs_ws281x::ControllerBuilder[][src]

pub struct ControllerBuilder(pub ws2811_t);

A struct to assist in the process of initializing a Controller instance. One is pretty much required to use this to construct a Controller, unless one happens to have an instance of ws2811_t sitting around.

// Construct a single channel controller. Note that the
// Controller is initialized by default and is cleaned up on drop
let controller = ControllerBuilder::new()
    // default
    .freq(800_000)
    // default
    .dma(10)
    .channel(
        ChannelBuilder::new()
            .pin(18)
            .count(10)
            .strip_type(StripType::Ws2811Rgb)
            .brightness(255)
            .build()
     )
    .build();

// get the strand of LEDs on channel 1
let leds = controller.leds_mut(0);
// set the first LED to white (with the configured
// strip above, this is BGRW)
leds[0] = [255, 255, 255, 0]

// render it to the strand
controller.render();

Methods

impl ControllerBuilder
[src]

Create a new ControllerBuilder

Sets the frequency of the signal to the LED's, usually like 800kHz IIRC.

Sets up a channel on the Controller, there should be two per controller for current versions of the driver.

Sets the DMA channel of the controller

Sets the time to wait before rendering for this controller

Attempts to build and initialize the Controller.

Trait Implementations

impl Debug for ControllerBuilder
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations