pub trait Led<C: Clock> {
// Required methods
fn is_on(&mut self) -> bool;
fn turn_on(&mut self);
fn turn_off(&mut self);
fn toggle(&mut self);
fn set_effect(&mut self, effect: LedEffect<C>);
fn set_effect_duration(&mut self, dur: Milliseconds<C::T>);
fn get_effect(&self) -> Option<&LedEffect<C>>;
fn clear_effect(&mut self);
fn poll(&mut self, now: Instant<C>);
}Expand description
UI LED
This LED abstraction tracks it’s status and provides an interface for setting visual effects such as blinking on the LED.
Implementors should own their resources TODO: implement ability to set the default state for the user
Required Methods§
fn is_on(&mut self) -> bool
Sourcefn set_effect(&mut self, effect: LedEffect<C>)
fn set_effect(&mut self, effect: LedEffect<C>)
Sets the effect on this LED instance
By default effect will have infinite duration unless set otherwise by set_effect_duration call
Setting the effect while another one is active will overwrite it on the next poll call
Sourcefn set_effect_duration(&mut self, dur: Milliseconds<C::T>)
fn set_effect_duration(&mut self, dur: Milliseconds<C::T>)
Sets the current effect duration on this LED instance
Can be used to prolong current effect duration
Does nothing if no effect is currently in place
Sourcefn get_effect(&self) -> Option<&LedEffect<C>>
fn get_effect(&self) -> Option<&LedEffect<C>>
Returns the current LED effect
Returns None if no effect is in place
Sourcefn clear_effect(&mut self)
fn clear_effect(&mut self)
Clears current the effect
This should also revert the LED to the state it was in before the effect took place
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".