[][src]Struct rs_ws281x::Controller

pub struct Controller { /* fields omitted */ }

The main struct used to control lights. Provides ways of accessing the light color values and rendering those values to the string.

Implementations

impl Controller[src]

pub fn new(c_struct: ws2811_t) -> Self[src]

Creates a new Controller

Note: This is only to be called from the Builder struct

pub fn render(&mut self) -> Result<()>[src]

Render the colors to the string.

It doesn't automatically do this because it is a somewhat costly operation that should be batched.

pub fn wait(&mut self) -> Result<()>[src]

Wait for a render to be completed.

pub fn channels(&self) -> Vec<usize>[src]

Gets the channels with non-zero number of LED's associated with them.

I know this is somewhat non-intuitive, but naming it something like active_channels(&self) seemed overly verbose.

pub fn brightness(&self, channel: usize) -> u8[src]

Gets the brightness of the LEDs

pub fn set_brightness(&mut self, channel: usize, value: u8)[src]

Sets the brighness of the LEDs

pub fn leds(&self, channel: usize) -> &[RawColor][src]

Gets a slice view to the color array to be written to the LEDs. See leds_mut for a mutable slice view to this data.

Safety

This function is moderately unsafe because we rely on the promise from the C library that it will stick to its memory layout and that the pointer is valid.

pub fn leds_mut(&mut self, channel: usize) -> &mut [RawColor][src]

Gets a mutable slice pointing to the color array to be written to the LEDs.

Safety

This function is moderately unsafe because we rely on the promise from the C library that it will stick to its memory layout and that the pointer is valid.

Trait Implementations

impl Clone for Controller[src]

impl Debug for Controller[src]

impl Drop for Controller[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.