Driver

Struct Driver 

Source
pub struct Driver<VARIANT: LP50xx, T: I2c, STATE: Marker> { /* private fields */ }
Expand description

High level generic driver for the LP50xx family of devices.

See LP50xx on how to instantiate the device.

The channels can be configured per OUT and per RGB LED. Bank-mode is not (yet) supported.

Implementations§

Source§

impl<VARIANT: LP50xx, T: I2c> Driver<VARIANT, T, Standby>

Source

pub async fn enable( self, ) -> Result<Driver<VARIANT, T, Normal>, DeviceError<T::Error>>

Enable the device, turning on the constant current sinks (if any are configured to have a non-zero duty cycle).

This will consume up to 10mA of current, unless power saving is enabled.

Source§

impl<VARIANT: LP50xx, T: I2c> Driver<VARIANT, T, Normal>

Source

pub async fn disable( self, ) -> Result<Driver<VARIANT, T, Standby>, DeviceError<T::Error>>

Disable the device, putting it into Standby mode.

All register values will be retained, but the constant current sinks will no longer be functional, turning off the LEDs.

Consumes up to 12uA of current, depending on the device type.

Source§

impl<VARIANT: LP50xx, T: I2c, MARKER: Marker> Driver<VARIANT, T, MARKER>

Source

pub async fn configure( &mut self, config: &Config, ) -> Result<(), DeviceError<T::Error>>

Set the general configuration parameters of the device.

Source

pub async fn set_channel( &mut self, channel_i: u8, value: u8, ) -> Result<(), Error<T::Error>>

Set the specific OUT channel to a specific color value.

Will return the Error::Index if the device does not have the indexed channel.

Source

pub async fn set_rgb( &mut self, rgb_i: u8, value: impl Into<Rgb>, ) -> Result<(), Error<T::Error>>

Set the RGB LED color values.

Will return the Error::Index if the device does not have the indexed RGB LED.

Source

pub async fn set_rgb_brightness( &mut self, rgb_i: u8, value: u8, ) -> Result<(), Error<T::Error>>

Set the brightness of a RGB LED (not the color).

Will return the Error::Index if the device does not have the indexed RGB LED

Source

pub async fn set_all_brightness( &mut self, value: u8, ) -> Result<(), Error<T::Error>>

Set the brightness of all RGB LEDs (not the color) in one call.

Auto Trait Implementations§

§

impl<VARIANT, T, STATE> Freeze for Driver<VARIANT, T, STATE>
where T: Freeze,

§

impl<VARIANT, T, STATE> RefUnwindSafe for Driver<VARIANT, T, STATE>
where VARIANT: RefUnwindSafe, STATE: RefUnwindSafe, T: RefUnwindSafe,

§

impl<VARIANT, T, STATE> Send for Driver<VARIANT, T, STATE>
where VARIANT: Send, STATE: Send, T: Send,

§

impl<VARIANT, T, STATE> Sync for Driver<VARIANT, T, STATE>
where VARIANT: Sync, STATE: Sync, T: Sync,

§

impl<VARIANT, T, STATE> Unpin for Driver<VARIANT, T, STATE>
where VARIANT: Unpin, STATE: Unpin, T: Unpin,

§

impl<VARIANT, T, STATE> UnwindSafe for Driver<VARIANT, T, STATE>
where VARIANT: UnwindSafe, STATE: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.