Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query regarding data from class power #8

Open
rmunny opened this issue Jul 9, 2020 · 0 comments
Open

Query regarding data from class power #8

rmunny opened this issue Jul 9, 2020 · 0 comments

Comments

@rmunny
Copy link

rmunny commented Jul 9, 2020

Hello,
From the manual page 29 https://www.ti.com/lit/ug/sluuac9a/sluuac9a.pdf?ts=1594252976133&ref_url=https%253A%252F%252Fwww.google.com%252F I see that power is under Subclass 68, and hibernate I and V can be read from offset 7 and 9. Now in the example BQ27441_Basic, power data is got by calling the function power() which is as following:

int16_t BQ27441::power(void) { return (int16_t) readWord(BQ27441_COMMAND_AVG_POWER); }

The readword() and i2cReadBytes() functions are as following:

uint16_t BQ27441::readWord(uint16_t subAddress)
{
	uint8_t data[2];
	i2cReadBytes(subAddress, data, 2);
	return ((uint16_t) data[1] << 8) | data[0];
}
int16_t BQ27441::i2cReadBytes(uint8_t subAddress, uint8_t * dest, uint8_t count)
{
	int16_t timeout = BQ72441_I2C_TIMEOUT;	
	Wire.beginTransmission(_deviceAddress);
	Wire.write(subAddress);
	Wire.endTransmission(true);
	
	Wire.requestFrom(_deviceAddress, count);
	
	for (int i=0; i<count; i++)
	{
		dest[i] = Wire.read();
	}
	
	return timeout;
}

My questions are:

  1. The power() function is reading 2 bytes so which 2 bytes it is reading (Hibernate I at offset 7 or Hibernate V at offset 9)?

  2. In the BQ27441_Basic.ino how can, it is reporting power in mW just by reading Hibernate I or Hibernate V?
    int power = lipo.power(); // Read average power draw (mW)

  3. If I want to see both the Hibernate I at offset 7 and Hibernate V at offset 9, how should I modify the library to print the individual data of Hibernate I at offset 7 and Hibernate V at offset 9 and also the power?

Please correct me if I am wrong. Thanks for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant