Current sensing and coulomb counting