Expand description
High-level BQ27441 battery fuel gauge driver with synchronous and asynchronous support.
This driver provides access to the BQ27441-G1 battery fuel gauge IC from Texas Instruments. It supports I²C communication with both blocking and async modes.
§Features
- State of Charge (SOC) monitoring
- Voltage, current, and temperature measurements
- Remaining capacity and full charge capacity reporting
- Power and current averaging
- State of Health (SOH) reporting
- Configuration via Data Memory
- SEALED/UNSEALED access modes
- Multiple power modes (NORMAL, SLEEP, HIBERNATE, SHUTDOWN)
§Examples
§Blocking I2C
use bq27441::Bq27441;
// Create driver with default I2C address (0x55)
let mut gauge = Bq27441::new(i2c)?;
// Read battery voltage
let voltage_mv = gauge.voltage()?;
// Read state of charge (0-100%)
let soc = gauge.state_of_charge()?;
// Read remaining capacity
let capacity_mah = gauge.remaining_capacity()?;
§Async I2C
ⓘ
use bq27441::Bq27441Async;
// Create async driver
let mut gauge = Bq27441Async::new(i2c).await?;
// Read battery status asynchronously
let voltage = gauge.voltage().await?;
let soc = gauge.state_of_charge().await?;
Modules§
- field_
sets - Module containing the generated fieldsets of the registers and commands
Structs§
- Bq27441
- Blocking BQ27441 driver.
- Bq27441
Device - Root block of the Bq27441Device driver
- Device
Interface - Blocking I²C interface wrapper.
Enums§
- ChemId
- Battery chemistry variant.
- Control
Cmd - Control subcommand codes.
- Error
- Error type for BQ27441 operations.
Constants§
- DEFAULT_
I2C_ ADDRESS - Default I²C address for BQ27441.
- DEVICE_
TYPE_ ID - Expected device type ID.
- UNSEAL_
KEY - Unseal key value (sent twice to unseal device).