Smart Multi-Function Battery Charger for Li-ion and Ni-MH