Expand description

An embedded-hal driver for the Maxim MAX17205 fuel gauge.

Loosely based on https://github.com/tock/tock/blob/master/capsules/src/max17205.rs rewritten to use the embedded-hal I2C driver.

https://www.maximintegrated.com/en/products/power/battery-management/MAX17205.html

The MAX1720x/MAX1721x are ultra-low power stand-alone fuel gauge ICs that implement the Maxim ModelGauge™ m5 algorithm without requiring host interaction for configuration. This feature makes the MAX1720x/MAX1721x excellent pack-side fuel gauges. The MAX17201/MAX17211 monitor a single cell pack. The MAX17205/MAX17215 monitor and balance a 2S or 3S pack or monitor a multiple-series cell pack.

Usage

use rppal::i2c::I2c; fn main() { let mut i2c = I2c::new().unwrap(); let mut max17205 = MAX1720x::new(&mut i2c); let soc = max17205.state_of_charge(&mut i2c).unwrap(); let status = max17205.status(&mut i2c).unwrap(); let voltage = max17205.voltage(&mut i2c).unwrap(); let current = max17205.current(&mut i2c).unwrap(); println!(“State of charge: {}%”, soc); println!(“Voltage: {}V”, voltage); println!(“Current: {}A”, current); println!(“Status: {:#?}”, status); }

Structs

Represents the status of the MAX1720x fuel gauge IC read from the STATUS register