This is a userspace I2C/SMBus driver for the Texas Instruments BQ27441 series of battery fuel gauge monitor microcontrollers. It is found in the SparkFun Battery Babysitter, an IC that performs power path management for a connected LiPo battery.
With the I2C headers and libraries installed on your machine, simply run make. Since the outputted library
libbq27441.a is static, you are able to compile your program with it simply by passing it as a source to your CC
command line and adding the proper directory as an include for the headers. Alternatively, to install libbq27441
system-wide, run make install as root to copy the headers and static objects to their directories in /usr/local.
The PREFIX environment variable may be specified when running make to override the installation directory.
To use this library, your first need to know the I2C bus occupied by your BQ2x. This will typically be the number
x in the file dev/i2c-x.
After installation, include the header in any C file with #include <bq27441.h>. Then, call bq27441_init with
the bus number mentioned earlier to initialize the driver. bq27441_init will return 1 if an error occurs during
setup, otherwise it will return 0 and you may call any of the bq27441 functions to get the associated data from
the device.