Crate lc709203

Source
Expand description

A platform agnostic Rust driver for the LC709302 battery gauge sensor.

§Example usage

// some concrete type implementing I2C access, i.e. the embedded_hal::blocking::i2c::WriteRead
// and embedded_hal::blocking::i2c::Write traits
let i2c = I2C::new();

// create a builder
let lc709203 = lc709203::Builder::default()
    .with_battery_capacity(2500) // battery capacity (specified in mAh) must be set!
    .build(&mut i2c)?; // initialize the lc709203 chip
let battery_voltage = lc709203.cell_voltage_v(&mut i2c)?; // query current battery voltage

Re-exports§

pub use device::ChipError;

Modules§

device
Low level device access.

Structs§

Builder
Builder to configure a LC709203 instance.
LC709203
Higher level access to the LC709203 chip. Provides interpreted/converted data.

Enums§

BatteryType
Battery type to use.
BuildError
Error during initialization.
InitTime
Determines which battery voltage should be used to initializes RSOC measurements.
TemperatureMode
Mode for the temperature registers (cell temperature and ambient temperature).