Struct is31fl3743a::IS31FL3743

source ·
pub struct IS31FL3743<I2C> {
    pub i2c: I2C,
    pub address: u8,
    pub width: u8,
    pub height: u8,
    pub calc_pixel: fn(x: u8, y: u8) -> u8,
}
Expand description

A struct to integrate with a new IS31FL3743A powered device.

Fields§

§i2c: I2C

The i2c bus that is used to interact with the device. See implementation below for the trait methods required.

§address: u8

The 7-bit i2c slave address of the device. By default on most devices this is 0x74.

§width: u8

Width of the LED matrix

§height: u8

Height of the LED matrix

§calc_pixel: fn(x: u8, y: u8) -> u8

Method to convert an x,y coordinate pair to a binary address that can be accessed using the bus.

Implementations§

source§

impl<I2C, I2cError> IS31FL3743<I2C>
where I2C: Write<Error = I2cError> + Read<Error = I2cError>,

source

pub fn fill_matrix(&mut self, brightnesses: &[u8]) -> Result<(), I2cError>

Fill all pixels of the display at once. The brightness should range from 0 to 255. brightness slice must have 0xC5 elements

source

pub fn fill(&mut self, brightness: u8) -> Result<(), I2cError>

Fill the display with a single brightness. The brightness should range from 0 to 255.

source

pub fn setup<DEL: DelayMs<u8>>( &mut self, delay: &mut DEL ) -> Result<(), Error<I2cError>>

Setup the display. Should be called before interacting with the device to ensure proper functionality. Delay is something that your device’s HAL should provide which allows for the process to sleep for a certain amount of time (in this case 10 MS to perform a reset).

When you run this function the following steps will occur:

  1. The chip will be told that it’s being “reset”.
  2. The chip will be put in shutdown mode
  3. The chip will be configured to use the maximum voltage
  4. The chip will be taken out of shutdown mode
source

pub fn pixel( &mut self, x: u8, y: u8, brightness: u8 ) -> Result<(), Error<I2cError>>

Set the brightness at a specific x,y coordinate. Just like the fill method the brightness should range from 0 to 255. If the coordinate is out of range then the function will return an error of InvalidLocation.

source

pub fn set_address(&mut self, address: u8)

Change the slave address to a new 7-bit address. Should be configured before calling setup method.

source

pub fn reset<DEL: DelayMs<u8>>( &mut self, delay: &mut DEL ) -> Result<(), I2cError>

Send a reset message to the slave device. Delay is something that your device’s HAL should provide which allows for the process to sleep for a certain amount of time (in this case 10 MS to perform a reset).

source

pub fn set_scaling(&mut self, scale: u8) -> Result<(), I2cError>

Set the current available to each LED. 0 is none, 255 is the maximum available

source

pub fn shutdown(&mut self, yes: bool) -> Result<(), I2cError>

Put the device into software shutdown mode

source

pub fn sw_enablement(&mut self, setting: SwSetting) -> Result<(), I2cError>

How many SW rows to enable

Auto Trait Implementations§

§

impl<I2C> RefUnwindSafe for IS31FL3743<I2C>
where I2C: RefUnwindSafe,

§

impl<I2C> Send for IS31FL3743<I2C>
where I2C: Send,

§

impl<I2C> Sync for IS31FL3743<I2C>
where I2C: Sync,

§

impl<I2C> Unpin for IS31FL3743<I2C>
where I2C: Unpin,

§

impl<I2C> UnwindSafe for IS31FL3743<I2C>
where I2C: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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.