INA219-based battery current and voltage measurement.
INA219
Trapezoid integration for total charge (current × time) and energy (power / time) totals
I2C rules the day