# lm3630a
Barebones Rust driver for the TI LM3630A dual-string white LED backlight driver.
- `no_std`
- `embedded-hal` 1.0 I2C
- Optional `embedded-hal-async` 1.0 I2C support via the `async` feature
- Supports SEL-selected 7-bit I2C addresses `0x36` and `0x38`
- Typed helpers for brightness, current, boost, ramps, PWM, interrupts, and faults
## Status
Early driver. Register coverage is implemented, but it has not yet been validated on hardware.
## Usage
```rust
use lm3630a::{
Address, Bank, Brightness, Configuration, ControlConfig, FullScaleCurrent, Lm3630a,
Mapping,
};
let i2c = /* platform I2C */;
let mut delay = /* platform delay */;
let mut backlight = Lm3630a::new(i2c, Address::SelLow);
// Wait at least 1 ms after HWEN is asserted.
backlight.wait_until_ready(&mut delay);
backlight.set_configuration(Configuration::default())?;
backlight.set_full_scale_current(Bank::A, FullScaleCurrent::from_code(20).unwrap())?;
backlight.set_brightness(Bank::A, Brightness::from_raw(128))?;
backlight.set_control(ControlConfig {
sleep: false,
bank_a_mapping: Mapping::Linear,
bank_b_mapping: Mapping::Linear,
bank_a_enabled: true,
bank_b_enabled: false,
led2_bank: Default::default(),
})?;
```
## Async support
Enable the optional async API with:
```toml
lm3630a = { version = "0.1", features = ["async"] }
```
Async methods are available on the same driver type with an `_async` suffix, for example:
```rust
backlight.wait_until_ready_async(&mut delay).await;
backlight.set_brightness_async(Bank::A, Brightness::from_raw(128)).await?;
```
## Notes
- `Address::SelLow` is `0x36` when SEL is tied to GND.
- `Address::SelHigh` is `0x38` when SEL is tied to VIN.
- The datasheet requires a 1 ms wait after HWEN assertion or software reset before I2C access.
- Reading interrupt status clears the device interrupt status register.
- Brightness registers are not updated by the device while it is in sleep mode.