Struct led::rgb::LED

source ·
pub struct LED<C, R, G, B, E>where
    C: Common,
    R: OutputPin<Error = E>,
    G: OutputPin<Error = E>,
    B: OutputPin<Error = E>,{ /* private fields */ }
Expand description

An RGB LED

The RGB LED is represented by three owned instances of embedded_hal::digital::v2::OutputPin and a polarity (common anode or common cathode). Because the outputs are binary, only eight colors can be presented: primary colors, secondary colors, white, and black.

Implementations§

source§

impl<C, R, G, B, E> LED<C, R, G, B, E>where C: Common, R: OutputPin<Error = E>, G: OutputPin<Error = E>, B: OutputPin<Error = E>,

source

pub fn new(red: R, green: G, blue: B) -> LED<C, R, G, B, E>

Creates a new RGB LED given three GPIOs.

source

pub fn set(&mut self, color: Color) -> Result<(), <R as OutputPin>::Error>

Sets the RGB LED to the specified color.

Trait Implementations§

source§

impl<C, R, G, B, E> LED for LED<C, R, G, B, E>where C: Common, R: OutputPin<Error = E>, G: OutputPin<Error = E>, B: OutputPin<Error = E>,

source§

fn set(&mut self, color: Color)

Sets the RGB LED to the specified color.

§

type Input = Color

Auto Trait Implementations§

§

impl<C, R, G, B, E> RefUnwindSafe for LED<C, R, G, B, E>where B: RefUnwindSafe, C: RefUnwindSafe, G: RefUnwindSafe, R: RefUnwindSafe,

§

impl<C, R, G, B, E> Send for LED<C, R, G, B, E>where B: Send, C: Send, G: Send, R: Send,

§

impl<C, R, G, B, E> Sync for LED<C, R, G, B, E>where B: Sync, C: Sync, G: Sync, R: Sync,

§

impl<C, R, G, B, E> Unpin for LED<C, R, G, B, E>where B: Unpin, C: Unpin, G: Unpin, R: Unpin,

§

impl<C, R, G, B, E> UnwindSafe for LED<C, R, G, B, E>where B: UnwindSafe, C: UnwindSafe, G: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<L> RGB for Lwhere L: LED<Input = Color>,