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>
impl<I2C, I2cError> IS31FL3743<I2C>
sourcepub fn fill_matrix(&mut self, brightnesses: &[u8]) -> Result<(), I2cError>
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
sourcepub fn fill(&mut self, brightness: u8) -> Result<(), I2cError>
pub fn fill(&mut self, brightness: u8) -> Result<(), I2cError>
Fill the display with a single brightness. The brightness should range from 0 to 255.
sourcepub fn setup<DEL: DelayMs<u8>>(
&mut self,
delay: &mut DEL
) -> Result<(), Error<I2cError>>
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:
- The chip will be told that it’s being “reset”.
- The chip will be put in shutdown mode
- The chip will be configured to use the maximum voltage
- The chip will be taken out of shutdown mode
sourcepub fn pixel(
&mut self,
x: u8,
y: u8,
brightness: u8
) -> Result<(), Error<I2cError>>
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.
sourcepub fn set_address(&mut self, address: u8)
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.
sourcepub fn reset<DEL: DelayMs<u8>>(
&mut self,
delay: &mut DEL
) -> Result<(), I2cError>
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).
sourcepub fn set_scaling(&mut self, scale: u8) -> Result<(), I2cError>
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
sourcepub fn shutdown(&mut self, yes: bool) -> Result<(), I2cError>
pub fn shutdown(&mut self, yes: bool) -> Result<(), I2cError>
Put the device into software shutdown mode
sourcepub fn sw_enablement(&mut self, setting: SwSetting) -> Result<(), I2cError>
pub fn sw_enablement(&mut self, setting: SwSetting) -> Result<(), I2cError>
How many SW rows to enable