pub struct WS28xxSpiAdapter { /* private fields */ }Expand description
Adapter that connects your application via SPI to your WS28xx LEDs.
This requires an SPI device on your machine. This doesn’t work
with #[no-std].
Implementations§
Trait Implementations§
Source§impl WS28xxAdapter for WS28xxSpiAdapter
impl WS28xxAdapter for WS28xxSpiAdapter
Source§fn get_hw_dev(&mut self) -> &mut Box<dyn HardwareDev>
fn get_hw_dev(&mut self) -> &mut Box<dyn HardwareDev>
Returns a reference to the hardware device.
This function only needs to be implemented once in the generic adapter.
Source§fn write_rgb(&mut self, rgb_data: &[(u8, u8, u8)]) -> Result<(), String>
fn write_rgb(&mut self, rgb_data: &[(u8, u8, u8)]) -> Result<(), String>
Encodes RGB values and write them via the hardware device to the LEDs. The length of the vector
is the number of LEDs you want to write to. Note that if you have performance critical
applications (like you need a signal on the LEDS on a given time) it’s a better idea
to encode the data earlier by yourself using
crate::encoding-module and calling
WS28xxAdapter::write_encoded_rgb. Otherwise and if your device is slow the encoding
could cost a few microseconds to milliseconds - depending on your amount of data and machine.Source§fn write_encoded_rgb(&mut self, encoded_data: &[u8]) -> Result<(), String>
fn write_encoded_rgb(&mut self, encoded_data: &[u8]) -> Result<(), String>
Directly writes encoded RGB values via hardware device to the LEDs. This method and the encoded data
must fulfill the restrictions given by
crate::timings and crate::encoding if the hardware
device uses the specified frequency in crate::timings::PI_SPI_HZ.Auto Trait Implementations§
impl Freeze for WS28xxSpiAdapter
impl !RefUnwindSafe for WS28xxSpiAdapter
impl !Send for WS28xxSpiAdapter
impl !Sync for WS28xxSpiAdapter
impl Unpin for WS28xxSpiAdapter
impl !UnwindSafe for WS28xxSpiAdapter
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