Module capsules_extra::max17205

source ·
Expand description

SyscallDriver for the Maxim MAX17205 fuel gauge.

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


// Two i2c addresses are necessary.
// Registers 0x000-0x0FF are accessed by address 0x36.
// Registers 0x100-0x1FF are accessed by address 0x0B.
let max17205_i2c_lower = static_init!(
    capsules::virtual_i2c::I2CDevice,
    capsules::virtual_i2c::I2CDevice::new(i2c_bus, 0x36));
let max17205_i2c_upper = static_init!(
    capsules::virtual_i2c::I2CDevice,
    capsules::virtual_i2c::I2CDevice::new(i2c_bus, 0x0B));
let max17205_buffer = static_init!([u8; capsules::max17205::BUFFER_LENGTH],
                                   [0; capsules::max17205::BUFFER_LENGTH]);
let max17205 = static_init!(
    capsules::max17205::MAX17205<'static>,
    capsules::max17205::MAX17205::new(max17205_i2c_lower, max17205_i2c_upper,
                                      max17205_buffer));
max17205_i2c.set_client(max17205);

// For userspace.
let max17205_driver = static_init!(
    capsules::max17205::MAX17205Driver<'static>,
    capsules::max17205::MAX17205Driver::new(max17205));
max17205.set_client(max17205_driver);

Structs§

Constants§

Traits§