max170xx 1.0.0

Platform-agnostic Rust driver for the MAX170xx 1-cell/2-cell fuel-gauge systems with ModelGauge for lithium-ion (Li+) batteries. Compatible with MAX17043, MAX17044, MAX17048 MAX17049, MAX17058 and MAX17059.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use linux_embedded_hal::I2cdev;
use max170xx::Max17043;

fn main() {
    let dev = I2cdev::new("/dev/i2c-1").unwrap();
    let mut sensor = Max17043::new(dev);
    loop {
        let soc = sensor.soc().unwrap();
        let voltage = sensor.voltage().unwrap();
        println!("Charge: {:.2}%", soc);
        println!("Voltage: {:.2}V", voltage);
    }
}