pub struct Ws2811<'a, SPI, DEVICE = Ws2811> { /* private fields */ }
Implementations§
Source§impl<'a, SPI, E> Ws2811<'a, SPI>where
SPI: FullDuplex<u8, Error = E>,
impl<'a, SPI, E> Ws2811<'a, SPI>where
SPI: FullDuplex<u8, Error = E>,
Sourcepub fn new(spi: SPI, data: &'a mut [u8]) -> Self
pub fn new(spi: SPI, data: &'a mut [u8]) -> Self
Use Ws2811 devices via spi
The SPI bus should run within 2 MHz to 3.8 MHz
You may need to look at the datasheet and your own hal to verify this.
You need to provide a buffer data
, whoose length is at least 12 * the
length of the led strip + 20 byes (or 40, if using the mosi_idle_high
feature)
Please ensure that the mcu is pretty fast, otherwise weird timing issues will occur
Trait Implementations§
Source§impl<'a, SPI, E> SmartLedsWrite for Ws2811<'a, SPI>where
SPI: FullDuplex<u8, Error = E>,
impl<'a, SPI, E> SmartLedsWrite for Ws2811<'a, SPI>where
SPI: FullDuplex<u8, Error = E>,
Auto Trait Implementations§
impl<'a, SPI, DEVICE> Freeze for Ws2811<'a, SPI, DEVICE>where
SPI: Freeze,
impl<'a, SPI, DEVICE> RefUnwindSafe for Ws2811<'a, SPI, DEVICE>where
SPI: RefUnwindSafe,
DEVICE: RefUnwindSafe,
impl<'a, SPI, DEVICE> Send for Ws2811<'a, SPI, DEVICE>
impl<'a, SPI, DEVICE> Sync for Ws2811<'a, SPI, DEVICE>
impl<'a, SPI, DEVICE> Unpin for Ws2811<'a, SPI, DEVICE>
impl<'a, SPI, DEVICE = Ws2811> !UnwindSafe for Ws2811<'a, SPI, DEVICE>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more