Library for I2C communication with LiPo battery fuel gauge to measure battery level.
Dependents: MAX1704X_example_app
Diff: MAX1704X.cpp
- Revision:
- 1:b2d54467330d
- Parent:
- 0:b3b7aff20a1d
--- a/MAX1704X.cpp Mon Oct 09 12:52:15 2017 +0000 +++ b/MAX1704X.cpp Thu Nov 09 21:01:04 2017 +0000 @@ -80,13 +80,11 @@ uint32_t xo; xm = read8(REG_SOC_H); //high byte - xl = read8(REG_SOC_L); //low byte + //xl = read8(REG_SOC_L); //low byte - xo = (xl|(xm << 8)); - - //alternatively can read16 -// xo = read16(REG_SOC_H); //does this work? - + //xo = (xl|(xm << 8)); + xo = xm; //just read out high byte which returns 0-100 + // low byte provides unecessary extra resolution //percent_decimal = (0.003906)*xl + xm; //returns percent