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]
impl ControllerBuilder
pub fn new() -> Self
[src]
pub fn new() -> Self
Create a new ControllerBuilder
pub fn freq(&mut self, value: u32) -> &mut Self
[src]
pub fn freq(&mut self, value: u32) -> &mut Self
Sets the frequency of the signal to the LED's, usually like 800kHz IIRC.
pub fn channel(&mut self, index: usize, channel: ws2811_channel_t) -> &mut Self
[src]
pub fn channel(&mut self, index: usize, channel: ws2811_channel_t) -> &mut Self
Sets up a channel on the Controller, there should be two per controller for current versions of the driver.
pub fn dma(&mut self, value: i32) -> &mut Self
[src]
pub fn dma(&mut self, value: i32) -> &mut Self
Sets the DMA channel of the controller
pub fn render_wait_time(&mut self, value: u64) -> &mut Self
[src]
pub fn render_wait_time(&mut self, value: u64) -> &mut Self
Sets the time to wait before rendering for this controller
pub fn build(&mut self) -> Result<Controller, WS2811Error>
[src]
pub fn build(&mut self) -> Result<Controller, WS2811Error>
Attempts to build and initialize the Controller.
Trait Implementations
impl Debug for ControllerBuilder
[src]
impl Debug for ControllerBuilder
Auto Trait Implementations
impl !Send for ControllerBuilder
impl !Send for ControllerBuilder
impl !Sync for ControllerBuilder
impl !Sync for ControllerBuilder