Module capsules_extra::ltc294x
source · Expand description
SyscallDriver for the LTC294X line of coulomb counters.
- http://www.linear.com/product/LTC2941
- http://www.linear.com/product/LTC2942
- http://www.linear.com/product/LTC2943
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 buffer = static_init!([u8; capsules::ltc294x::BUF_LEN], [0; capsules::ltc294x::BUF_LEN]);
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, 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);
Structs§
- Implementation of a driver for the LTC294X coulomb counters.
- Default implementation of the LTC2941 driver that provides a Driver interface for providing access to applications.
Enums§
- Which version of the chip we are actually using.
- Settings for which interrupt we want.
- Threshold options for battery alerts.
Constants§
Traits§
- Supported events for the LTC294X.