[−][src]Struct rs_ws281x::Controller
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]
pub fn clone(&self) -> Controller
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Controller
[src]
impl Drop for Controller
[src]
Auto Trait Implementations
impl RefUnwindSafe for Controller
[src]
impl !Send for Controller
[src]
impl !Sync for Controller
[src]
impl Unpin for Controller
[src]
impl UnwindSafe for Controller
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,