lp50xx-async 0.1.0

Async Rust driver for the lp50xx family of Texas Instruments I2C RGB LED drivers
Documentation

lp50xx_async

Async Rust driver for the LP50xx family of Texas Instruments I2C RGB LED drivers.

Supported devices

All devices in the LP50xx family are supported:

How to use

For any I2C peripheral implementing the I2c embedded-hal-async trait you can use this driver as follows:

let hl = LP5030::new(&mut i2c, Address::Address1);
let mut hl = hl.enable().await.unwrap();

hl.configure(&Config {
    log_scale: true,
    power_save: true,
    pwm_dithering: false,
    max_current: ll::MaxCurrentOption::Current35MA,
})
.await
.unwrap();

// Set all LEDs to the same brightness.
hl.set_all_brightness(0x55).await.unwrap();

// Set a specific LED to a specific brightness.
hl.set_rgb_brightness(9, 0x54).await.unwrap();

// Change the color for that LED.
hl.set_rgb(9, (0x01, 0x02, 0x03)).await.unwrap();

// Set the value for a specific channel (when not used with RGB LEDs).
hl.set_channel(22, 0xFF).await.unwrap();

// Put the device in Standby mode.
let hl = hl.disable().await.unwrap();