Crate is31fl3743b_driver

Crate is31fl3743b_driver 

Source
Expand description

This is a platform-agnostic Rust driver for the Lumissil IS31FL3743B LED Matrix Driver based on the embedded-hal traits.

For further details of the device architecture and operation, please refer to the official Datasheet.

§Lumissil IS31F13743B

A #[no_std] platform-agnostic driver for the IS31F13743B LED matrix controller using the embedded-hal traits.

§Usage

Blocking, single device

// Construct and initialize driver (resets and powers on device)
let mut driver = Is31fl3743b::new(SpiDevice::new(spi_instance, cs_pin))?;

// Perform a test which detects shorted LEDs
let delay = DelayNs;
let led_status = driver.detect_shorts(delay)?;
if !led_status.all_leds_ok() {
    panic!("There is a short among the LEDs")
}

// Perform some configuration
driver.enable_phase_delay()?;
driver.set_global_current(90)?;

// Adjust current/brightness of specific LED (by given SWx and CSy coordinates)
driver.set_led_peak_current(SWx::SW2, CSy::CS10, 50)?;
driver.set_led_brightness(SWx::SW2, CSy::CS10, 50)?;

Async, multiple sync’d devices

// Construct and initialize driver (resets and powers on device, as well performs proper SYNC function config)
// First instance in array is considered "master" device for sync purposes
let spi = [SpiDevice::new(spi_instance, cs_pin1), SpiDevice::new(spi_instance, cs_pin2)];
let mut driver = Is31fl3743b::new_with_sync(spi).await?;

// Perform a test which detects shorted LEDs on first device
let delay = DelayNs;
let led_status = driver[0].detect_shorts(delay).await?;
if !led_status.all_leds_ok() {
    panic!("There is a short among the LEDs")
}

// Perform some configuration on second device
driver[1].enable_phase_delay().await?;
driver[1].set_global_current(90).await?;

// Adjust current/brightness of specific LED (by given SWx and CSy coordinates) on second device
driver[1].set_led_peak_current(SWx::SW2, CSy::CS10, 50).await?;
driver[1].set_led_brightness(SWx::SW2, CSy::CS10, 50).await?;

§Examples

See the examples/ directory for examples using this driver with the popular async library Embassy and an STM32F411CE microcontroller.

§Features

  • Enable is_blocking to use blocking mode (async mode used by default)
  • Enable preserve_registers to restore previous PWM and Scaling registers after open/short test (disabled by default)

§License

Licensed under the terms of the MIT license.

§Contribution

Unless you explicitly state otherwise, any contribution submitted for inclusion in the work by you shall be licensed under the terms of the MIT license.

License: MIT

Structs§

Configuration
Configuration register.
GlobalCurrentControl
Global current control register.
Is31fl3743b
IS31FL3743B device driver group
Is31fl3743bDevice
IS31FL3743B device driver
OpenShortTestResult
Contains the status of each LED after the last open/short detection test.
PullDownUpResistorSelection
Pull-up/down resistor selection register.
SpreadSpectrum
Spread spectrum register.
TemperatureStatus
Temperature status register.

Enums§

CSy
Current sink row.
CycleTime
Spread spectrum cycle time setting.
Open
Open/short detection enable.
Range
Spread spectrum range setting.
Resistor
Resistor setting (value in Ohms).
SWx
Switch column.
SwxSetting
SWx setting.
Sync
Sync setting.
TemperaturePoint
Temperature point setting.
ThermalRollOff
Thermal roll-off setting.