Library to interface to the TI BQ27441, a fuel gauge monitor
Fork of battery-gauge-bq27441 by
Diff: battery_gauge_bq27441.h
- Revision:
- 6:998cc334f8f2
- Parent:
- 5:63b325f2c21a
--- a/battery_gauge_bq27441.h Wed Jun 14 17:11:40 2017 +0100 +++ b/battery_gauge_bq27441.h Wed Dec 13 17:14:51 2017 +0000 @@ -113,8 +113,20 @@ * @return true if successful, otherwise false. */ bool getVoltage (int32_t *pVoltageMV); + + /** Read the power output the battery. + * If battery gauging is off this function will take ~1 second + * to return while the ADCs are activated and the reading is taken. + * If battery gauging is on, the last voltage reading taken + * will be returned without delay. + * @param pPowerMW place to put the power reading. + * @return true if successful, otherwise false. + */ + bool getPower (int32_t *pPowerMW); /** Read the current flowing from the battery. + * Negative value means battery is being drained + * Positive value means battery is being charged * If battery gauging is off this function will take ~1 second * to return while the ADCs are activated and the reading is taken. * If battery gauging is on, the last current reading taken @@ -242,6 +254,14 @@ * @return true if successful, otherwise false. */ bool getTwoBytes (uint8_t registerAddress, uint16_t *pBytes); + + /** Read two bytes starting at a given address (signed int16). + * Note: gpI2c should be locked before this is called. + * @param registerAddress the register address to start reading from. + * @param pBytes place to put the two bytes. + * @return true if successful, otherwise false. + */ + bool getTwoBytesSigned (uint8_t registerAddress, int16_t *pBytes); /** Compute the checksum of a block of memory in the chip. * @param pData a pointer to the 32 byte data block.