pub struct LedModule<Driver> { /* private fields */ }Expand description
High-level LED controller that drives a strip of addressable LEDs.
Maintains the on/off state and last selected color.
Implementations§
Source§impl<Driver, E> LedModule<Driver>where
Driver: SmartLedsWrite<Color = RGB8, Error = E>,
impl<Driver, E> LedModule<Driver>where
Driver: SmartLedsWrite<Color = RGB8, Error = E>,
Sourcepub fn new(driver: Driver) -> Self
pub fn new(driver: Driver) -> Self
Create a new LedModule over the given LED driver.
The strip is initially off with no last color.
Sourcepub fn ex_command(&mut self, cmd: LEDCommand) -> Result<(), E>
pub fn ex_command(&mut self, cmd: LEDCommand) -> Result<(), E>
Execute an incoming LEDCommand, updating internal state and LED strip.
On: enable LEDs with the last color or white.Off: disable LEDs (all black).SC {r,g,b}: set a new color, applied immediately if strip is on.
Auto Trait Implementations§
impl<Driver> Freeze for LedModule<Driver>where
Driver: Freeze,
impl<Driver> RefUnwindSafe for LedModule<Driver>where
Driver: RefUnwindSafe,
impl<Driver> Send for LedModule<Driver>where
Driver: Send,
impl<Driver> Sync for LedModule<Driver>where
Driver: Sync,
impl<Driver> Unpin for LedModule<Driver>where
Driver: Unpin,
impl<Driver> UnwindSafe for LedModule<Driver>where
Driver: UnwindSafe,
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