Crate bq25887

Crate bq25887 

Source
Expand description

§BQ25887 battery charger driver

bq25887 is a platform-agnostic Rust driver for the Texas Instruments BQ25887 synchronous battery charger. It targets no_std environments and provides an async-friendly I²C interface built on the embedded-hal-async traits.

The optional embassy feature supplies helpers for constructing shared-bus drivers that integrate smoothly with the Embassy async ecosystem.

§Examples

Create a driver with an async I²C peripheral and read the charger status:

use bq25887::Bq25887Driver;

async fn inspect<I2C>(i2c: I2C) -> Result<(), bq25887::BQ25887Error<I2C::Error>>
where
    I2C: embedded_hal_async::i2c::I2c,
{
    let mut driver = Bq25887Driver::new(i2c);
    let status = driver.read_charger_status_1().await?;
    // Evaluate charger status or update application state here.
    let _ = status;
    Ok(())
}

For a deeper tour of the API and hardware integration tips, see the project README and the device datasheet.

Modules§

field_sets
Generated register field definitions for the charger. Module containing the generated fieldsets of the registers and commands

Structs§

Bq25887
Type-safe register accessor for the BQ25887 device. Root block of the Bq25887 driver
Bq25887Driver
High-level async driver for the BQ25887 charger.
ConfigurationCache
Cached configuration register values for addresses 0x00 through 0x06.
DeviceInterface
Adapter that bridges the generated register API to an async I²C peripheral.
PartInformationSummary
Summary of identifying information reported by register 0x25.
StatusCache
Cached status and fault register values observed by the driver.

Enums§

BQ25887Error
Error type produced by operations on the BQ25887 driver.
Ichg
Enumeration of fast charge current limit selections.
Pn
Enumerated part number identifiers reported by the device.

Constants§

DEFAULT_I2C_ADDRESS
Default 7-bit I²C address for the BQ25887 charger.