Module capsules::ltc294x [] [src]

Driver for the LTC294X line of coulomb counters.

The LTC2941 measures battery charge state in battery-supplied handheld PC and portable product applications. Its operating range is perfectly suited for single-cell Li-Ion batteries. A precision coulomb counter integrates current through a sense resistor between the battery’s positive terminal and the load or charger. The measured charge is stored in internal registers. An SMBus/I2C interface accesses and configures the device.

Structure

This file implements the LTC294X driver in two objects. First is the LTC294X struct. This implements all of the actual logic for the chip. The second is the LTC294XDriver struct. This implements the userland facing syscall interface. These are split to allow the kernel to potentially interface with the LTC294X chip rather than only provide it to userspace.

Usage

Here is a sample usage of this capsule in a board's main.rs file:

let ltc294x_i2c = static_init!(
    capsules::virtual_i2c::I2CDevice,
    capsules::virtual_i2c::I2CDevice::new(i2c_mux, 0x64));
let ltc294x = static_init!(
    capsules::ltc294x::LTC294X<'static>,
    capsules::ltc294x::LTC294X::new(ltc294x_i2c, None, &mut capsules::ltc294x::BUFFER));
ltc294x_i2c.set_client(ltc294x);

// Optionally create the object that provides an interface for the coulomb
// counter for applications.
let ltc294x_driver = static_init!(
    capsules::ltc294x::LTC294XDriver<'static>,
    capsules::ltc294x::LTC294XDriver::new(ltc294x));
ltc294x.set_client(ltc294x_driver);

Reexports

use core::cell::Cell;
use kernel::AppId;
use kernel::Callback;
use kernel::Driver;
use kernel::ReturnCode;
use kernel::common::take_cell::TakeCell;
use kernel::hil::gpio;
use kernel::hil::i2c;

Structs

LTC294X

Implementation of a driver for the LTC294X coulomb counters.

LTC294XDriver

Default implementation of the LTC2941 driver that provides a Driver interface for providing access to applications.

Enums

ChipModel

Which version of the chip we are actually using.

InterruptPinConf

Settings for which interrupt we want.

Registers
State
VBatAlert

Threshold options for battery alerts.

Statics

BUFFER

Traits

LTC294XClient

Supported events for the LTC294X.