Skip to main content

Crate bq27441

Crate bq27441 

Source
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.
Bq27441Device
Root block of the Bq27441Device driver
DeviceInterface
Blocking I²C interface wrapper.

Enums§

ChemId
Battery chemistry variant.
ControlCmd
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).